Download Dynamic Link Library Solver User`s Guide
Transcript
return (FALSE);
if (!InitInstance (hInstance, &hWnd2, szWinTitle2, 330, 10, 300, 300))
return (FALSE);
#ifdef WIN32
srand( GetTickCount());
CreateThread( NULL, 0, RunThread, (LPVOID)hWnd1, 0, &dwID1);
CreateThread( NULL, 0, RunThread, (LPVOID)hWnd2, 0, &dwID1);
#endif
while (GetMessage(&msg, 0, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (msg.wParam);
}
BOOL InitApplication (HINSTANCE hInstance)
{
WNDCLASS wc;
wc.style = 0;
wc.lpfnWndProc = MainWndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = GetStockObject(WHITE_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = szClassName;
return (RegisterClass(&wc));
}
BOOL InitInstance(HINSTANCE hInstance, HWND *hWnd, char *szWinTitle,
long nX, long nY, long nWidth, long nHeight)
{
hInst = hInstance;
*hWnd = CreateWindow(
szClassName,
szWinTitle,
WS_OVERLAPPEDWINDOW,
nX, nY, nWidth, nHeight,
NULL, NULL, hInstance, NULL);
if (!*hWnd) return (FALSE);
ShowWindow(*hWnd, SW_SHOW);
UpdateWindow(*hWnd);
return (TRUE);
}
#ifdef WIN32
DWORD WINAPI RunThread( LPVOID lpVoid)
{
HWND hWnd = (HWND)lpVoid;
int i;
/* Cause Solver DLL to be called 9 more times for each window... */
for (i = 1; i < 10; i++)
{
Sleep( rand() * 1000 / RAND_MAX ); /* wait random time (0-1 sec) */
InvalidateRect( hWnd, NULL, TRUE); /* cause WM_PAINT for window */
UpdateWindow( hWnd);
}
Dynamic Link Library Solver User's Guide
Native Windows Applications • 65