Глава 31. Resource Workshop |
889 |
|
4. |
LONG FAR PASCAL WndProc (HWND, UINT, WPARAM, LPARAM); |
|
5. |
static char szProgram[] = "cursor"; |
|
6. |
static char sz!conName[] = "EARTH"; |
|
|
static char szCursorName[] = "HANDFLAT"; |
|
7. |
#pragma argsused |
|
8. |
int PASCAL WinMainf HINSTANCE hinst, HINSTANCE hPrevInst, |
|
|
LPSTR IpszCmdLine, int nCmdShow) |
|
9. |
{ |
|
10. |
HWND hWindow; |
|
11. |
MSG IpMsg; |
|
12. |
.WNDCLASS wcApplication; |
|
13. |
iff !hPrevInst){ |
|
14. |
wcApplication.IpszClassName = szProgram; |
|
15. |
wcApplication.hinstance = hinst; |
|
16. |
wcApplication.IpfnWndProc = WndProc; |
|
17. |
wcApplication.hCursor = LoadCursor(NULL, IDC ARROW); |
|
18. |
wcApplication. hicon = Loadlcon (NULL, 'szIconName) ; |
|
19. |
wcApplication. IpszMenuNanie = NULL; |
|
20. |
wcApplication.hbrBackground = GetStockObject(WHITE eRUSH) ; |
|
21. |
wcApplication. style = -CS HREDRAW ¦ CSVREDRAW; |
|
22. |
wcApplication.cbClsExtra = 0; |
|
23. |
iff 'RegisterClass( &wcApplication)) |
|
24. |
return FALSE; |
|
25. |
) |
|
26. |
hWindow = CreateWindow(szProgram, "Cursor Example", |
|
27. |
WS OVERLAPPEDWINDOW, CWUSEDEFAULT, |
|
28. |
CWUSEDEFAULT, CWUSEDEFAULT, |
|
29. |
CW USEDEFAULT, (HWND)NULL, (HMENU)NULL, |
|
30. |
(HANDLE)hinst, (LPSTR)NULL) ; |
|
31. |
ShowWindow(hWindow, nCmdShow) ; |
|
32. |
UpdateWindow(hWindow) ; |
|
33. |
while( GetMessage(&lpMsg, NULL, NULL, NULL)){ |
|
34. |
TranslateMessage(&lpMsg) ; |
|
35. |
DispatchMessage(sIpMsg); } |
|
36. |
return(IpMsg.wParam); } |
|
37. |
LONG FAR PASCAL WndProc(HWND hWnd, UINT message, |
|
38. |
WPARAM wParam, LPARAM IParam){ |
|
39. |
PAINTSTRUCT ps; |
|
40. |
HOC hdc; |
|
41. |
switch(message) ( |
|
42. |
case WMPAINT: |
|
43. |
hdc=BeginPaint(hWnd, &ps) ; |
|
44. |
ValidateRect(hWnd.NULL) ; |
|
45. |
EndPaint(hWnd, &ps); |
|
46. |
break; |
|
47. |
case WMDESTROY: |
|
48. |
PostQuitMessage(0) ; |
|
49. |
break; |
|
50. |
default: |
|