Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2018
523
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.88 KB | None | 0 0
  1. #include <windows.h>
  2. #include "resource.h"
  3.  
  4.  
  5. BOOL CALLBACK DialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
  6.  
  7. int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
  8. {
  9.     HWND hDlg;
  10.     MSG msg;
  11.  
  12.     hDlg = CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), 0, DialogProc, 0);
  13.     ShowWindow(hDlg, iCmdShow);
  14.     while (GetMessage(&msg, NULL, 0, 0))
  15.     {
  16.         TranslateMessage(&msg);
  17.         DispatchMessage(&msg);
  18.     }
  19.  
  20.     return 0;
  21. }
  22.  
  23. BOOL CALLBACK DialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
  24. {
  25.     static HWND edit1;
  26.  
  27.     switch (message)
  28.     {
  29.     case WM_INITDIALOG:
  30.         edit1 = GetDlgItem(hDlg, IDC_EDIT1);
  31.         return TRUE;
  32.     case WM_CLOSE:
  33.         EndDialog(hDlg, 0);
  34.         DestroyWindow(hDlg);
  35.         return 0;
  36.     case WM_DESTROY:
  37.         PostQuitMessage(0);
  38.         return 0;
  39.     }
  40.     return DefWindowProc(hDlg, message, wParam, lParam);
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement