Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <windows.h>
- char ClassName[] = "ClassName";
- HWND test56;
- HWND ndat;
- LRESULT CALLBACK Windowpr(HWND, UINT, WPARAM, LPARAM);
- int WINAPI WinMain(HINSTANCE hThisInstance,HINSTANCE hPrevInstance,LPSTR lpszArgument,int nFunsterStil)
- {
- WNDCLASSEX t,t5;
- HWND t2,t6;
- MSG t3;
- t.cbSize = sizeof(WNDCLASSEX);
- t.cbWndExtra = 0;
- t.cbClsExtra = 0;
- t.lpfnWndProc = Windowpr;
- t.lpszClassName = ClassName;
- t.lpszMenuName = NULL;
- t.hIcon = LoadIcon(NULL,IDI_APPLICATION);
- t.hIconSm = LoadIcon(NULL,IDI_APPLICATION);
- t.hCursor = LoadCursor(NULL,IDC_ARROW);
- t.hInstance = hThisInstance;
- t.hbrBackground = (HBRUSH)(7);
- if (!RegisterClassEx(&t)){
- printf("Error Ocurred 0001\n");
- return -1;
- }
- t2 = CreateWindowEx(0,ClassName,"My title",WS_OVERLAPPEDWINDOW,0,0,300,300,NULL,NULL,NULL,NULL);
- if (t2 == NULL){
- printf("Error Ocurred 0002\n");
- MessageBox(NULL,"Error Ocurred 0002","Error",MB_ICONERROR);
- return -1;
- }
- ShowWindow(t2,nFunsterStil);
- while(GetMessage(&t3,NULL,0,0) > 0){
- TranslateMessage(&t3);
- DispatchMessage(&t3);
- }
- return 0;
- }
- LRESULT CALLBACK Windowpr(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam){
- switch(message){
- case WM_CREATE:
- test56 = CreateWindow("button",NULL,WS_CHILD | WS_VISIBLE | BS_GROUPBOX,4,4,130,130,hwnd,NULL,NULL,NULL);
- test56 = hwnd;
- ndat = CreateWindow("button","TESTING",WS_CHILD | WS_VISIBLE | WS_BORDER | BS_CENTER,40,65,60,30,test56,(HMENU)45,NULL,NULL);
- break;
- case WM_COMMAND:
- if (LOWORD(wparam) == 45){
- printf("Pressed button inside of groupbox :)\n");
- }
- break;
- case WM_CLOSE:
- DestroyWindow(hwnd);
- break;
- case WM_DESTROY:
- PostQuitMessage(0);
- break;
- default:
- DefWindowProc(hwnd,message,wparam,lparam);
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment