Board index » Visual Studio » CWnd as a main application window
|
FoundThisOnline
|
|
FoundThisOnline
|
CWnd as a main application window
Visual Studio205
Hello, I have problem with parent wundow. I create MFC project based on CDialog as a main window of application. creator does it in OnInstance method of class derived from CWin|App. I woul like to change the CDialog class to CWnd. I would like to make CWnd instance and use CreateEx method to create it. as parent parameter I write NULL, becouse I want my window to be main window. but CreateEx always return FALSE. Could onybody help me?? regards woyt/. - |
| VSP
Registered User |
Thu Mar 09 07:05:20 CST 2006
Re:CWnd as a main application window
If you are directly using CWnd derived class means, first you have to
register a window class and then use CreateEx CString csClassName = AfxRegisterWndClass(0, ::LoadCursor(NULL, IDC_ARROW), (HBRUSH)(COLOR_WINDOW+1), ::LoadIcon(NULL, IDI_APPLICATION)); int iRet = pWnd->CreateEx(0, csClassName, "Test", WS_OVERLAPPEDWINDOW|WS_VISIBLE, 0,0, 100,100, NULL, NULL); Instead of using CWnd, it is better to use CFrameWnd, it is easy to create and provides lot of functinalities. pWnd->Create(NULL, "Test"); pWnd->ShowWindow(SW_NORMAL); -VSP "yopwojtek" <yopwojtek@wp.pl>wrote in message QuoteHello, - |
| Ajay
Registered User |
Thu Mar 09 07:39:15 CST 2006
Re:CWnd as a main application window
You shold at least use CFrameWnd or its derived class as a parent.
Thats what it is meant for. You can have nothing buy a CFrameWnd, no doc, view etc. I would go that way instead of messing around with CWnd and reaching exactly where CFrameWnd already is. ------- Ajay Kalra ajaykalra@yahoo.com - |
| Tom
Registered User |
Thu Mar 09 10:20:14 CST 2006
Re:CWnd as a main application window
Unless I'm reading this wrong... why not just create an SDI program where
you could have any kind of view you want and they are all based on CWnd? That might save you trouble over trying to convert the older program. Tom "yopwojtek" <yopwojtek@wp.pl>wrote in message QuoteHello, - |
| yopwojtek
Registered User |
Thu Mar 09 12:47:29 CST 2006
Re:CWnd as a main application window
it works:) thanks a lot!!!! i registered class window in my application
early but got wrong extended styles in CreateEx method. You got nothing as parameter, i did the same and is ok. thanks best regards woyt - |
| yopwojtek
Registered User |
Thu Mar 09 12:50:33 CST 2006
Re:CWnd as a main application window
It is really easier to create SDI via wizard but I need to hav CWnd
base window. And I got it:) regards Woyt/. - |
| Tom
Registered User |
Thu Mar 09 13:22:45 CST 2006
Re:CWnd as a main application window
Great. I hope that works out for you. That's the nice thing about the
community groups here. You get lots of suggestions to choose from so you almost always get some sort of answer at the end of the day ... Tom "yopwojtek" <yopwojtek@wp.pl>wrote in message QuoteIt is really easier to create SDI via wizard but I need to hav CWnd - |
