Thread: RE: [Dev-C++] MDI window again
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Igor P. <igo...@po...> - 2002-11-12 15:26:29
|
Hi, =20 Without more information on what exactly you did I can only guess but most probably you did something wrong in WinMain. That is: - check handling of WM_CREATE in your frame window procedure and see if CreateWindow of the frame window returns a valid handle. - you did not use ShowWindow before entering the message loop or - there is something wrong with the message loop. After that you schould at least have a visible frame window. =20 Regards =20 Igor Pierscinski -----Original Message----- From: Vlada Djurovic [mailto:dj...@im...] Sent: Tuesday, November 12, 2002 3:08 PM To: 'DevC++ help' Subject: [Dev-C++] MDI window again Hi all I have another unusual problem here. I wrote some code t display MDI = window. It compiled OK, but when I run it, nothing happens, I don't see = the window. In Task menager, I found my exe file under prosesses tab, so = I guess it is running, only the window doesn't show. I used SW_SHOW = when creating every window.=20 The compiler log output: g++.exe MDImain.o -o "MDIFinal.exe" -L"C:\Dev-Cpp\lib" = -I"C:\Dev-Cpp\include" -I"C:\Dev-Cpp\myInc" = -I"C:\Dev-Cpp\include\g++-3" -I"C:\Dev-Cpp\include" = -I"C:\Dev-Cpp\myInc" -g3 -mwindows =20 Execution terminated Compilation successful =20 Hope someone can help. =20 Regards, Vlada |
|
From: Igor P. <igo...@po...> - 2002-11-13 09:38:16
|
Hi,
In programming even a small thing can make a big difference
so you schould be more careful about the exact meaning
of what you write. The problem is in the line below:
if(hFrameWnd=3DNULL)
it should be changed to
if(hFrameWnd=3D=3DNULL)
Regards
Igor Pierscinski
|
|
From: Vlada D. <dj...@im...> - 2002-11-13 12:47:47
|
----- Original Message ----- From: "Igor Pierscinski" <igo...@po...> To: "DevC++ help" <dev...@li...> Sent: Wednesday, November 13, 2002 10:37 AM Subject: RE: [Dev-C++] MDI window again >Hi, > >In programming even a small thing can make a big difference >so you schould be more careful about the exact meaning >of what you write. The problem is in the line below: > if(hFrameWnd=NULL) >it should be changed to > if(hFrameWnd==NULL) > >Regards > >Igor Pierscinski Thanks a lot, man!!!!! You're a saviour! Regards, Vlada ------------------------------------------------------- This sf.net email is sponsored by: Are you worried about your web server security? Click here for a FREE Thawte Apache SSL Guide and answer your Apache SSL security needs: http://www.gothawte.com/rd523.html _______________________________________________ Dev-cpp-users mailing list Dev...@li... TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
|
From: Vlada D. <dj...@im...> - 2002-11-13 07:31:45
|
Hi, Igor
I checked the code and it seems exectly like the code you sent me the other
day (which works). I can't figure out what's the problem. I'm sending the
code, hope anyone can figure out what's wrong.
#include<windows.h>
#include "resource.h"
char g_sFrameClass[]="FrameWnd";
char g_sChildClass[]="ChildWnd";
HWND hFrameWnd=NULL;
HWND hMDIClient=NULL;
HWND hChildWnd=NULL;
HINSTANCE g_hInstance;
LRESULT CALLBACK FrameWndProc(HWND,UINT,WPARAM,LPARAM);
LRESULT CALLBACK ChildWndProc(HWND,UINT,WPARAM,LPARAM);
file://main function
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
WNDCLASSEX wc;
MSG msg;
g_hInstance=hInstance;
/*frame window class*/
wc.cbSize=sizeof(WNDCLASSEX);
wc.style=0;
wc.lpfnWndProc=FrameWndProc;
wc.cbClsExtra=0;
wc.cbWndExtra=0;
wc.hInstance=hInstance;
wc.hIcon=LoadIcon(NULL,IDI_APPLICATION);
wc.hCursor=LoadCursor(NULL,IDC_ARROW);
wc.hbrBackground=(HBRUSH)COLOR_WINDOW;
wc.lpszMenuName=NULL;
wc.lpszClassName=g_sFrameClass;
wc.hIconSm=LoadIcon(NULL,IDI_APPLICATION);
/*register frame wnd class*/
if(!RegisterClassEx(&wc))
return 0;
/*child window class*/
wc.lpfnWndProc=(WNDPROC)ChildWndProc;
wc.cbClsExtra=20;
wc.hIcon=LoadIcon(NULL,IDI_APPLICATION);
wc.lpszMenuName=(LPCTSTR)NULL;
wc.lpszClassName=g_sChildClass;
/*register child window class*/
if(!RegisterClassEx(&wc))
return 0;
/*create frame window*/
hFrameWnd=CreateWindowEx(WS_EX_CLIENTEDGE,g_sFrameClass,"MDI
Window",WS_OVERLAPPEDWINDOW|
WS_CLIPCHILDREN,CW_USEDEFAULT,CW_USEDEFAULT,600,400,NULL,(HMENU)NULL,hInstan
ce,NULL);
if(hFrameWnd=NULL)
{
MessageBox(NULL,"Could not create
window","Error",MB_ICONSTOP|MB_OK);
return 0;
}
ShowWindow(hFrameWnd,SW_SHOW);
UpdateWindow(hFrameWnd);
/*message loop*/
while(GetMessage(&msg,NULL,0,0))
{
if(!TranslateMDISysAccel(hMDIClient,&msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return msg.wParam;
}
/*frame window procedure*/
LRESULT CALLBACK FrameWndProc(HWND hFrameWnd,UINT msg,WPARAM wParam,LPARAM
lParam)
{
switch(msg)
{
case WM_CREATE:
{
CLIENTCREATESTRUCT ccs;
ccs.hWindowMenu=NULL;
ccs.idFirstChild=50000;
/*create client window*/
hMDIClient=CreateWindowEx(0,"MDICLIENT",(LPCTSTR)NULL,WS_CHILD|WS_CLIPCHILDR
EN,CW_USEDEFAULT,
CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,hFrameWnd,(HMENU)ccs.idFirstChild,
g_hInstance,(LPVOID)&ccs);
ShowWindow(hMDIClient,SW_SHOW);
/*create child window*/
hChildWnd=CreateMDIWindow(g_sChildClass,"Untitled",WS_HSCROLL|WS_VSCROLL,CW_
USEDEFAULT,
CW_USEDEFAULT,300,200,hMDIClient,g_hInstance,lParam);
ShowWindow(hChildWnd,SW_SHOW);
}
break;
case WM_CLOSE:
DestroyWindow(hFrameWnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefFrameProc(hFrameWnd,hMDIClient,msg,wParam,lParam);
}
return 0;
}
LRESULT CALLBACK ChildWndProc(HWND hMDIChild,UINT msg,WPARAM wParam,LPARAM
lParam)
{
return DefMDIChildProc(hMDIChild,msg,wParam,lParam);
}
----- Original Message -----
From: "Igor Pierscinski" <igo...@po...>
To: "DevC++ help" <dev...@li...>
Sent: Tuesday, November 12, 2002 4:26 PM
Subject: RE: [Dev-C++] MDI window again
Hi,
Without more information on what exactly you did I can only guess
but most probably you did something wrong in WinMain. That is:
- check handling of WM_CREATE in your frame window procedure
and see if CreateWindow of the frame window returns a valid handle.
- you did not use ShowWindow before entering the message loop
or
- there is something wrong with the message loop.
After that you schould at least have a visible frame window.
Regards
Igor Pierscinski
-----Original Message-----
From: Vlada Djurovic [mailto:dj...@im...]
Sent: Tuesday, November 12, 2002 3:08 PM
To: 'DevC++ help'
Subject: [Dev-C++] MDI window again
Hi all
I have another unusual problem here. I wrote some code t display MDI window.
It compiled OK, but when I run it, nothing happens, I don't see the window.
In Task menager, I found my exe file under prosesses tab, so I guess it is
running, only the window doesn't show. I used SW_SHOW when creating every
window.
The compiler log output:
g++.exe MDImain.o -o
MDIFinal.exe" -L"C:\Dev-Cpp\lib" -I"C:\Dev-Cpp\include" -I"C:\Dev-Cpp\myIn
c" -I"C:\Dev-Cpp\include\g++-3" -I"C:\Dev-Cpp\include" -I"C:\Dev-Cpp\myIn
c" -g3 -mwindows
Execution terminated
Compilation successful
Hope someone can help.
Regards,
Vlada
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Dev-cpp-users mailing list
Dev...@li...
TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
|