dax
May 17th, 2006, 10:57 PM
I'm using a big class system, to create a popup window. This is not an ordinary window like a dialog box. This is a new class and program that is inside the same EXE as the launcher program.
I launch a new class system at a certain moment of the program. This registers the WND class again, and creates a new window... With the parent handle of the first program.
I defined WS_OVERLAPPEDWINDOW | WS_CHILD; didn't work. I defined WS_POPUPWINDOW | WS_CHILD didnt work. I tried a bunch of different combinations and everytime i launch it dissappears.
So when i press launch the second program, the initial program dissappears, and the new program doesn't launch. Before it closes, i hear a beep, the MB_ICONERROR sound. If i remove the hwnd defining the Parent handle of CreateWindowEx, i get an error when making the CreateWindowEx (hwnd is returned as null).
Heres some code. This is inside the CPP of my main program. Which is suppose to launch the second program, which is included in another file as a CppWnd2 class instead of CppWnd.
CppWnd2 App2;
int CppWnd::LaunchLobby(){
HINSTANCE hInstance;
App2.SetInstance(hInstance);
//give the wnd a class name to register with os
App2.SetWndClassName(TEXT("WndClass"));
//give the wnd a caption
App2.SetWndCaption(TEXT("Second Program"));
CoInitialize(NULL);
//register and create wnd,checking the return value to ensure that a valid wnd handle has
//been made.
if (App2.Create(hAppWnd)){
MSG Msg; //a simple structure for storing message information
//start message loop
while (GetMessage(&Msg,NULL,0,0)){
//translate and dispatch other messages
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
CoUninitialize();
return Msg.wParam;
}
return 0;
}
LRESULT CALLBACK MainWndProc2(HWND hwnd,UINT Message,WPARAM wParam,LPARAM lParam){
//just send the message and other parameters to the class function for handling
return App2.CppWndProc2(hwnd,Message,wParam,lParam);
}
Was i not suppose to put this code here? If you want to see more of it just tell me. But as i said the class works, the only problem is it doesnt create the popup. I am not sure what "class style" or "window style" to add to this new popup tho.
I launch a new class system at a certain moment of the program. This registers the WND class again, and creates a new window... With the parent handle of the first program.
I defined WS_OVERLAPPEDWINDOW | WS_CHILD; didn't work. I defined WS_POPUPWINDOW | WS_CHILD didnt work. I tried a bunch of different combinations and everytime i launch it dissappears.
So when i press launch the second program, the initial program dissappears, and the new program doesn't launch. Before it closes, i hear a beep, the MB_ICONERROR sound. If i remove the hwnd defining the Parent handle of CreateWindowEx, i get an error when making the CreateWindowEx (hwnd is returned as null).
Heres some code. This is inside the CPP of my main program. Which is suppose to launch the second program, which is included in another file as a CppWnd2 class instead of CppWnd.
CppWnd2 App2;
int CppWnd::LaunchLobby(){
HINSTANCE hInstance;
App2.SetInstance(hInstance);
//give the wnd a class name to register with os
App2.SetWndClassName(TEXT("WndClass"));
//give the wnd a caption
App2.SetWndCaption(TEXT("Second Program"));
CoInitialize(NULL);
//register and create wnd,checking the return value to ensure that a valid wnd handle has
//been made.
if (App2.Create(hAppWnd)){
MSG Msg; //a simple structure for storing message information
//start message loop
while (GetMessage(&Msg,NULL,0,0)){
//translate and dispatch other messages
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
CoUninitialize();
return Msg.wParam;
}
return 0;
}
LRESULT CALLBACK MainWndProc2(HWND hwnd,UINT Message,WPARAM wParam,LPARAM lParam){
//just send the message and other parameters to the class function for handling
return App2.CppWndProc2(hwnd,Message,wParam,lParam);
}
Was i not suppose to put this code here? If you want to see more of it just tell me. But as i said the class works, the only problem is it doesnt create the popup. I am not sure what "class style" or "window style" to add to this new popup tho.