fork download
  1. #include <windows.h>
  2. #include "test.h"
  3. static HBRUSH hbrBackColor;
  4.  
  5. LRESULT CALLBACK WndProc(HWND hwnd , UINT msg , WPARAM wp , LPARAM lp) {
  6. static int enable = 0;
  7.  
  8. switch (msg) {
  9. case WM_DESTROY:
  10. PostQuitMessage(0);
  11. return 0;
  12.  
  13. case WM_CTLCOLORDLG:
  14. return (LRESULT)hbrBackColor;
  15.  
  16. case WM_CTLCOLORSTATIC:
  17. SetBkColor((HDC)wp, RGB(0xf0, 0xb0, 0xb0));
  18. SetClassLongPtr((HWND)lp, GCL_HBRBACKGROUND, (LONG)hbrBackColor);
  19. return (LRESULT)hbrBackColor;
  20.  
  21. case WM_COMMAND:
  22. switch (LOWORD(wp)) {
  23. case IDBUTTON:
  24. if (enable) { SendMessage(GetDlgItem(hwnd, IDEDIT), WM_ENABLE, 0, 0); enable = 0; }
  25. else { SendMessage(GetDlgItem(hwnd, IDEDIT), WM_ENABLE, 1, 0); enable = 1; }
  26. }
  27. return 0;
  28. }
  29. return DefWindowProc(hwnd , msg , wp , lp);
  30. }
  31.  
  32. int WINAPI WinMain(HINSTANCE hInstance , HINSTANCE hPrevInstance ,
  33. PSTR lpCmdLine , int nCmdShow ) {
  34. HWND hwnd;
  35. MSG msg;
  36. WNDCLASS winc;
  37.  
  38. hbrBackColor = CreateSolidBrush(RGB(0xf0, 0xb0, 0xb0));
  39.  
  40. winc.style = CS_HREDRAW | CS_VREDRAW;
  41. winc.lpfnWndProc = WndProc;
  42. winc.cbClsExtra = 0;
  43. winc.cbWndExtra = DLGWINDOWEXTRA; /* need for dialog-base application */
  44. winc.hInstance = hInstance;
  45. winc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
  46. winc.hCursor = LoadCursor(NULL , IDC_ARROW);
  47. // winc.hbrBackground = hbrBackColor;
  48. winc.hbrBackground = NULL;
  49. winc.lpszMenuName= NULL;
  50. winc.lpszClassName = TEXT("TEST");
  51.  
  52. if (!RegisterClass(&winc)) return -1;
  53. hwnd = CreateDialog(hInstance , TEXT("TEST") , 0 , NULL); /* NULL: need for dialog-base application */
  54. if (hwnd == NULL) return -1;
  55.  
  56. while(GetMessage(&msg , NULL , 0 , 0)) {
  57. TranslateMessage(&msg);
  58. DispatchMessage(&msg);
  59. }
  60. DeleteObject(hbrBackColor);
  61. return msg.wParam;
  62. }
  63. /* end */
  64.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c:1:21: fatal error: windows.h: No such file or directory
 #include <windows.h>
                     ^
compilation terminated.
stdout
Standard output is empty