Hopefully this test program will enable someone to figure out what
DrawFrame does (I cant work it out)
// menutst.cpp : Defines the entry point for the application.
//
#include <windows.h>
// Global Variables:
HINSTANCE hInst; // current instance
LPSTR szWindowClass = "x";
// Foward declarations of functions included in this code module:
ATOM MyRegisterClass(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE, int, ATOM);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK WndProc2(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM);
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
MSG msg;
ATOM x;
// Initialize global strings
x = MyRegisterClass(hInstance);
// Perform application initialization:
if (!InitInstance (hInstance, nCmdShow, x))
{
return FALSE;
}
// Main message loop:
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
//
// FUNCTION: MyRegisterClass()
//
// PURPOSE: Registers the window class.
//
// COMMENTS:
//
// This function and its usage is only necessary if you want this code
// to be compatible with Win32 systems prior to the 'RegisterClassEx'
// function that was added to Windows 95. It is important to call this function
// so that the application will get 'well formed' small icons associated
// with it.
//
ATOM MyRegisterClass(HINSTANCE hInstance)
{
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = (WNDPROC)WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = 0;
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH);
wcex.lpszMenuName = 0;
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = 0;
return RegisterClassEx(&wcex);
}
//
// FUNCTION: InitInstance(HANDLE, int)
//
// PURPOSE: Saves instance handle and creates main window
//
// COMMENTS:
//
// In this function, we save the instance handle in a global variable and
// create and display the main program window.
//
typedef VOID (CALLBACK *DF)(HDC hdc, RECT *r,DWORD width,DWORD type);
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow, ATOM a)
{
HWND hWnd;
hInst = hInstance; // Store instance handle in our global variable
hWnd = CreateWindow(szWindowClass, "test", WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
if (!hWnd)
{
return FALSE;
}
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
return TRUE;
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HMODULE x;
DF y;
RECT r;
PAINTSTRUCT ps;
HDC hdc;
DWORD type;
INT i;
switch(message)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_PAINT:
x = GetModuleHandle("user32.dll");
y = (DF)GetProcAddress(x,"DrawFrame");
hdc = BeginPaint(hWnd, &ps);
r.top = 0;
r.bottom = r.top + 20;
r.left = 0;
r.right = r.left + 20;
type = 0;
for (i=0;i<40;i++)
{
y(hdc,&r,5,type);
r.left += 20;
r.right += 20;
type++;
}
r.bottom += 20;
r.top += 20;
r.left = 0;
r.right = r.left + 20;
for (i=0;i<40;i++)
{
y(hdc,&r,5,type);
r.left += 20;
r.right += 20;
type++;
}
r.bottom += 20;
r.top += 20;
r.left = 0;
r.right = r.left + 20;
for (i=0;i<40;i++)
{
y(hdc,&r,5,type);
r.left += 20;
r.right += 20;
type++;
}
r.bottom += 20;
r.top += 20;
r.left = 0;
r.right = r.left + 20;
for (i=0;i<40;i++)
{
y(hdc,&r,5,type);
r.left += 20;
r.right += 20;
type++;
}
r.bottom += 20;
r.top += 20;
r.left = 0;
r.right = r.left + 20;
for (i=0;i<40;i++)
{
y(hdc,&r,5,type);
r.left += 20;
r.right += 20;
type++;
}
r.bottom += 20;
r.top += 20;
r.left = 0;
r.right = r.left + 20;
for (i=0;i<40;i++)
{
y(hdc,&r,5,type);
r.left += 20;
r.right += 20;
type++;
}
r.bottom += 20;
r.top += 20;
r.left = 0;
r.right = r.left + 20;
for (i=0;i<40;i++)
{
y(hdc,&r,5,type);
r.left += 20;
r.right += 20;
type++;
}
r.bottom += 20;
r.top += 20;
r.left = 0;
r.right = r.left + 20;
for (i=0;i<40;i++)
{
y(hdc,&r,5,type);
r.left += 20;
r.right += 20;
type++;
}
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
// Mesage handler for about box.
LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_INITDIALOG:
return TRUE;
case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
}
break;
}
return FALSE;
}