Guest User

Untitled

a guest
Jul 17th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.92 KB | None | 0 0
  1. #include <windows.h>
  2. #include "resource.h"
  3.  
  4.  
  5. /* Declare Windows procedure */
  6. LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
  7.  
  8. /* Make the class name into a global variable */
  9. char szClassName[ ] = "Saeko";
  10.  
  11. /* Dialog stuff goes here */
  12. /*BOOL CALLBACK AboutDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
  13. {
  14. switch(Message)
  15. {
  16. case WM_INITDIALOG:
  17.  
  18. return TRUE;
  19. case WM_COMMAND:
  20. switch(LOWORD(wParam))
  21. {
  22. case IDOK:
  23. EndDialog(hwnd, IDOK);
  24. break;
  25. }
  26. break;
  27. default:
  28. return FALSE;
  29. }
  30. return TRUE;
  31. }
  32.  
  33. BOOL CALLBACK CtrlrDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
  34. {
  35. switch(Message)
  36. {
  37. case WM_INITDIALOG:
  38.  
  39. return TRUE;
  40. case WM_COMMAND:
  41. switch(LOWORD(wParam))
  42. {
  43. case IDOK:
  44. EndDialog(hwnd, IDOK);
  45. break;
  46. }
  47. break;
  48. default:
  49. return FALSE;
  50. }
  51. return TRUE;
  52. }
  53.  
  54. BOOL CALLBACK DirDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
  55. {
  56. switch(Message)
  57. {
  58. case WM_INITDIALOG:
  59.  
  60. return TRUE;
  61. case WM_COMMAND:
  62. switch(LOWORD(wParam))
  63. {
  64. case IDOK:
  65. EndDialog(hwnd, IDOK);
  66. break;
  67. case IDCANCEL:
  68. EndDialog(hwnd, IDCANCEL);
  69. break;
  70. }
  71. break;
  72. default:
  73. return FALSE;
  74. }
  75. return TRUE;
  76. }*/
  77.  
  78. int WINAPI WinMain (HINSTANCE hThisInstance,HINSTANCE hPrevInstance,LPSTR lpszArgument,int nFunsterStil)
  79.  
  80. {
  81. HWND hwnd; /* This is the handle for our window */
  82. MSG messages; /* Here messages to the application are saved */
  83. WNDCLASSEX wincl; /* Data structure for the windowclass */
  84.  
  85. /* The Window structure */
  86. wincl.hInstance = hThisInstance;
  87. wincl.lpszClassName = szClassName;
  88. wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */
  89. wincl.style = CS_DBLCLKS; /* Catch double-clicks */
  90. wincl.cbSize = sizeof (WNDCLASSEX);
  91.  
  92. /* Use default icon and mouse-pointer */
  93. wincl.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MAINICO));
  94. wincl.hIconSm = LoadImage (GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MAINICO), IMAGE_ICON, 16, 16, 0);
  95. wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
  96. wincl.lpszMenuName = MAKEINTRESOURCE (IDM_MENU);
  97. wincl.cbClsExtra = 0; /* No extra bytes after the window class */
  98. wincl.cbWndExtra = 0; /* structure or the window instance */
  99. /* Use Windows's default color as the background of the window */
  100. wincl.hbrBackground = (HBRUSH) COLOR_WINDOW+1;
  101.  
  102. /* Register the window class, and if it fails quit the program */
  103. if (!RegisterClassEx (&wincl))
  104. return 0;
  105.  
  106. /* The class is registered, let's create the program*/
  107. hwnd = CreateWindowEx (
  108. 0, /* Extended possibilites for variation */
  109. szClassName, /* Classname */
  110. "PC-FXtra", /* Title Text */
  111. WS_OVERLAPPEDWINDOW, /* default window */
  112. CW_USEDEFAULT, /* Windows decides the position */
  113. CW_USEDEFAULT, /* where the window ends up on the screen */
  114. 256, /* The programs width */
  115. 240, /* and height in pixels */
  116. HWND_DESKTOP, /* The window is a child-window to desktop */
  117. NULL, /* No menu */
  118. hThisInstance, /* Program Instance handler */
  119. NULL /* No Window Creation data */
  120. );
  121.  
  122. /* Make the window visible on the screen */
  123. ShowWindow (hwnd, nFunsterStil);
  124.  
  125. /* Run the message loop. It will run until GetMessage() returns 0 */
  126. while (GetMessage (&messages, NULL, 0, 0))
  127. {
  128. /* Translate virtual-key messages into character messages */
  129. TranslateMessage(&messages);
  130. /* Send message to WindowProcedure */
  131. DispatchMessage(&messages);
  132. }
  133.  
  134. /* The program return-value is 0 - The value that PostQuitMessage() gave */
  135. return messages.wParam;
  136. }
  137.  
  138.  
  139. /* This function is called by the Windows function DispatchMessage() */
  140.  
  141. LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
  142. {
  143. switch (message) /* Handle the messages */
  144. {
  145. case WM_COMMAND: /* Let's actually make the menu items *do* something */
  146. switch(LOWORD(wParam));
  147. /*case IDM__ABOUT1:
  148. {
  149. int ret = DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_ABOUTDLG), hwnd, AboutDlgProc);
  150. }
  151. break;
  152. case IDM_CONFIGURE_JOYSTICK1:
  153. {
  154. int ret = DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_CTRLRCFG), hwnd, CtrlrDlgProc);
  155. }
  156. break;
  157. case IDM__DIRECTORIES1:
  158. {
  159. int ret = DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_DIRCFGDLG), hwnd, DirDlgProc);
  160. }
  161. break;*/
  162. case IDM_E_XIT1:
  163. {
  164. PostMessage(hwnd, WM_CLOSE, 0, 0);
  165. }
  166. break;
  167. case WM_CLOSE:
  168. DestroyWindow(hwnd);
  169. break;
  170. case WM_DESTROY:
  171. PostQuitMessage (0); /* send a WM_QUIT to the message queue */
  172. break;
  173. default: /* for messages that we don't deal with */
  174. return DefWindowProc (hwnd, message, wParam, lParam);
  175. }
  176. return 0;
  177. }
Add Comment
Please, Sign In to add comment