Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Form
- {
- #include <Windows.h>
- void CreaForm(HINSTANCE hInstance, LPCSTR NomeFinestra , int larghezza, int altezza, int Color, &WndProc)
- {
- #define MY_CLASSNAME "classname"
- WNDCLASSEX wc;
- memset(&wc, 0x00, sizeof(WNDCLASSEX));
- wc.cbSize = sizeof WNDCLASSEX;
- wc.style = CS_VREDRAW | CS_HREDRAW;
- wc.lpszClassName = MY_CLASSNAME;
- wc.hbrBackground = (HBRUSH)(Color + 1);
- wc.hInstance = hInstance;
- wc.lpfnWndProc = &WndProc;
- ATOM test = RegisterClassEx(&wc);
- if(test == NULL)
- {
- MessageBox(NULL, "Fallita registrazione classe", "Errore", MB_OK);
- ExitProcess(0);
- }
- HWND hForm = CreateWindowEx(NULL, MY_CLASSNAME, NomeFinestra, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, larghezza, altezza, NULL, NULL, hInstance, NULL);
- ShowWindow(hForm, SW_SHOWNORMAL);
- UpdateWindow(hForm);
- MSG message;
- while(GetMessage(&message, NULL, 0, 0))
- {
- TranslateMessage(&message);
- DispatchMessage(&message);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement