G
Hi
Also ich habe folgendes problem:
Ich habe ein MDI mit childwindows und nun möchte ich das das parentwindow maximiert gestartet wird.
Das hab ich dann so gemacht:
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
{
HWND hwnd, hwndFrame ;
MSG msg ;
WNDCLASS wndclass ;
hInst = hInstance ;
//Hauptfenster
wndclass.style = CS_HREDRAW | CS_VREDRAW ;
wndclass.lpfnWndProc = WndProc ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInstance ;
wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ;
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
wndclass.hbrBackground = (HBRUSH) (COLOR_APPWORKSPACE + 1) ;
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = szFrameClass ;
if (!RegisterClass (&wndclass))
//Kindfenster
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = HelloWndProc ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = sizeof (HANDLE) ;
wndclass.hInstance = hInstance ;
wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ;
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = szHelloClass;
RegisterClass (&wndclass) ;
hMenuInit = LoadMenu (hInstance, TEXT ("MAINMENU")) ;
hMenuHello = LoadMenu (hInstance, TEXT ("MAINMENU")) ;
hMenuInitWindow = GetSubMenu (hMenuInit, INIT_MENU_POS) ;
hMenuHelloWindow = GetSubMenu (hMenuHello, HELLO_MENU_POS) ;
hwnd = CreateWindow (szFrameClass, TEXT ("osIRC v1.0"),
WS_MAXIMIZE | WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
NULL, hMenuInit, hInstance, NULL) ;
ShowWindow(hwnd, SW_MAXIMIZE); // das hier sollte das fenster maximieren
hwndFrame = GetWindow (hwnd, GW_CHILD) ;
ShowWindow (hwnd, iCmdShow) ;
UpdateWindow (hwnd) ;
while (GetMessage (&msg, NULL, 0, 0))
{
if (!TranslateMDISysAccel (hwndFrame, &msg))
{
TranslateMessage (&msg) ;
DispatchMessage (&msg) ;
}
}
DestroyMenu (hMenuHello) ;
return msg.wParam ;
}
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_CREATE:
//Rahmenfenster
clientcreate.hWindowMenu = hMenuInitWindow ;
clientcreate.idFirstChild = IDM_FIRSTCHILD ;
hwndFrame = CreateWindow (TEXT ("MDICLIENT"), NULL,
WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE,
0, 0, 0, 0, hwnd, (HMENU) 1, hInst,
&clientcreate) ;
ShowWindow(hwnd, SW_MAXIMIZE); //und das hier sollte den rahmen maximieren
return 0;
so jetzt startet er das programm auch maximiert, aber man kann es nun nicht mehr verkleinern. Also wenn man auf den mittleren button oben rechts klickt.