|
-
Dec 1st, 2002, 09:05 AM
#1
Thread Starter
Junior Member
Resize MFC SDI Window?
How do I resize my SDI window (i want to do it in my OnNewDocument in the document class)?
Is it something like this?
Code:
CMainFrame *pMF = (CMainFrame*)AfxGetMainWnd();
pMF->SetWindowPos(NULL, 0,0,50,50, SWP_NOMOVE);
thanks.
-
Dec 1st, 2002, 09:14 AM
#2
Monday Morning Lunatic
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Dec 1st, 2002, 09:23 AM
#3
Thread Starter
Junior Member
my program crash with that piece of code, i've tried several things, but i think that i have to create a pointer to my mainframe, but i dunno how...
-
Dec 1st, 2002, 06:04 PM
#4
What kind of crash? I don't think you may pass NULL as first parameter. Use SWP_NOZORDER and pass any of the constants if you don't want to change the z order.
And you don't need to cast to a CMainFrame, CWnd supports SetWindowPos, so you can write
AfxGetMainWnd()->SetWindowPos(...);
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Dec 1st, 2002, 06:05 PM
#5
Oh, and I recommend that you learn using the debugger, it's a wonderful thing...
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Dec 4th, 2002, 01:09 PM
#6
Thread Starter
Junior Member
Well, the pointer to the MainFrame "pMF" or "AfxGetMainWnd()" returns with no value. (pMF = 0x00000000 {CMainFrame hWnd=???})
So I get the error: "Unhandled exception at 0x7c208dd4 (mfc70d.dll) in MineSweeper.exe: 0xC0000005: Access violation reading location 0x00000020".
-
Dec 4th, 2002, 02:08 PM
#7
Then you obviously don't have a valid main window, at least not one that's properly registered with MFC.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Dec 4th, 2002, 02:09 PM
#8
Can you post your InitInstance function here?
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|