-
March 17th, 2003, 04:57 PM
#1
trouble w/SetWindowPos
1. CFormView derived class has a button that opens a CRecordView derived class.
2. In the CRecordView OnInitDlg, I call SetWindowPos(&wndTop, 0, 0, 0, 0,SWP_NOMOVE|SWP_NOSIZE) to try to move the CRecordView derived class to the top of the z-order. This call return non-zero value, which, according to msdn docs, means it was successful.
3. CFormView window is still top window in z-order.
I want the CRecordView to draw on top of the CFormView. Can someone tell me what I'm doing wrong?
Thanks,
-Brian
-
March 17th, 2003, 05:28 PM
#2
Weird. Consider adding SWP_SHOWWINDOW to the last parameter.
Kuphryn
-
March 17th, 2003, 05:53 PM
#3
The really weird thing is that I have another CRecordView derived class that opens a different recordset when a button is pressed on the CFormView derived class. It opens on top! Everything seems to be the same between the two, but one behaves differently.
I must have done something subtley different when I created this view. I'll try recreating it to see if that helps.
Even doing the following trick doesn't work:
//Attach foreground window thread
//to our thread
DWORD ForeGroundID = GetWindowThreadProcessId(::GetForegroundWindow(),NULL);
DWORD CurrentID = GetCurrentThreadId();
AttachThreadInput ( ForeGroundID, CurrentID, TRUE );
//Do our stuff here ;-)
SetActiveWindow()
SetForegroundWindow()
SetFocus(); //Just playing safe
//Detach the attached thread
AttachThreadInput ( ForeGroundID, CurrentID, FALSE );
The call to SetActiveWindow returns 0! Something weird is going on...
-Brian
-
March 17th, 2003, 06:02 PM
#4
What if you called SetWindowPos() from its parent?
Kuphryn
-
March 18th, 2003, 06:50 PM
#5
Thanks for your help, Kuphryn. I just figured out how to get the correct behavior:
code was:
pEmailDocTemplate->OpenDocumentFile(NULL);
((CDialog*) this)->GotoDlgCtrl(GetDlgItem(IDC_PRINTEMAIL));
I'm still learning about the this operator, but my call order is a no-no. If I make the default button call before OpenDocumentFile, it works correctly. This is a case where you probably could have told me the problem if I gave more code...
code should be:
((CDialog*) this)->GotoDlgCtrl(GetDlgItem(IDC_PRINTEMAIL));
pEmailDocTemplate->OpenDocumentFile(NULL);
-Brian
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
|