Advertisement
Guest User

Untitled

a guest
May 27th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. namespace Form
  2. {
  3. #include <Windows.h>
  4. void CreaForm(HINSTANCE hInstance, LPCSTR NomeFinestra , int larghezza, int altezza, int Color, &WndProc)
  5. {
  6. #define MY_CLASSNAME "classname"
  7. WNDCLASSEX wc;
  8. memset(&wc, 0x00, sizeof(WNDCLASSEX));
  9. wc.cbSize = sizeof WNDCLASSEX;
  10. wc.style = CS_VREDRAW | CS_HREDRAW;
  11. wc.lpszClassName = MY_CLASSNAME;
  12. wc.hbrBackground = (HBRUSH)(Color + 1);
  13. wc.hInstance = hInstance;
  14. wc.lpfnWndProc = &WndProc;
  15. ATOM test = RegisterClassEx(&wc);
  16. if(test == NULL)
  17. {
  18. MessageBox(NULL, "Fallita registrazione classe", "Errore", MB_OK);
  19. ExitProcess(0);
  20. }
  21. HWND hForm = CreateWindowEx(NULL, MY_CLASSNAME, NomeFinestra, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, larghezza, altezza, NULL, NULL, hInstance, NULL);
  22. ShowWindow(hForm, SW_SHOWNORMAL);
  23. UpdateWindow(hForm);
  24. MSG message;
  25. while(GetMessage(&message, NULL, 0, 0))
  26. {
  27. TranslateMessage(&message);
  28. DispatchMessage(&message);
  29. }
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement