|
I think before anything else you should read and understand all the functionality of CMDIFrameWnd Class[^] and perhaps review the Win32 MDI documentation[^]
Then you might replace your OnCreateClient with this
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) <br />
{<br />
CMenu* pMenu = NULL;<br />
if (m_hMenuDefault == NULL)<br />
{<br />
pMenu = GetMenu();<br />
ASSERT(pMenu != NULL);<br />
pMenu = pMenu->GetSubMenu(0);<br />
ASSERT(pMenu != NULL);<br />
}<br />
<br />
return CreateClient(lpcs, pMenu);<br />
}
That will append the window list to your single Operator Station menu, you might also need to override other member functions of CMDIFrameWnd such as GetWindowMenuPopup which expects to find a standard window menu.
Alternately you could add a standard Window menu after Operator Station and replace your OnCreateClient with this
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) <br />
{<br />
CMenu* pMenu = NULL;<br />
if (m_hMenuDefault == NULL)<br />
{<br />
pMenu = GetMenu();<br />
ASSERT(pMenu != NULL);<br />
pMenu = pMenu->GetSubMenu(1);<br />
ASSERT(pMenu != NULL);<br />
}<br />
<br />
return CreateClient(lpcs, pMenu);<br />
}
this is the way I would do it, if I really had to leave out the help menu, as it reduces the number of member functions that you might have to override.
Personally I would include the standard Window menu and a simple Help menu with just an about box.
|
|
|
|
|
Yes, It works.I includeed OnCreateClient() and it works fine.
Anu
|
|
|
|
|
It works fine. But i cannot close,minimize,maximize the mainframe as well as child window.Even i have buttons for all this.
Whats the problem in that?Pls help me.
Anu
|
|
|
|
|
Not sure where to start with this. Do you get any messages in the Output window when you debug the application and try to close,minimize,maximize the mainframe or child windows ?
|
|
|
|
|
the output windows shows like this..but no repsonse when i click close or minimize button.
SENDING command id 0x8032 to CMainFrame target.
GUS: PumpMessage: hwnd=0x9F03C4, msg = WM_TIMER (0x0000, 0x00000000)
GUS: WndProc: hwnd=0x9F03C4, msg = WM_TIMER (0x0000, 0x00000000)
GUS: PumpMessage: hwnd=0x7F0376, msg = 0x0373 (0x0000, 0x00000000)
GUS: WndProc: hwnd=0x7F0376, msg = 0x0373 (0x0000, 0x00000000)
GUS: WndProc: hwnd=0x9F03C4, msg = WM_IDLEUPDATECMDUI (0x0001, 0x00000000)
GUS: WndProc: hwnd=0x3C02C4, msg = WM_IDLEUPDATECMDUI (0x0001, 0x00000000)
GUS: WndProc: hwnd=0x35038C, msg = WM_IDLEUPDATECMDUI (0x0001, 0x00000000)
GUS: WndProc: hwnd=0x3C02C4, msg = WM_IDLEUPDATECMDUI (0x0001, 0x00000000)
....Like this only.
Actually we using this application without any frame i.e., we use without any close buttons and minimize and maximize button.
For that we change the code precreatewindow in both mainframe and childframe.
But now we need all windows with these buttons.So i commented the cs Style in precreatewindow in both frames.So i get the buttons but it does not work. Particularly if it is restore position,i can mimimize it. But when i maximize it, i cannot do anything.When i click in that button no clicking action takes place.it just sit as it is.I have OnClose() in CMainframe().But when i close the button it does not move to Onclose() function.
Anu
|
|
|
|
|
Does your CMainFrame have its own OnSysCommand() handler?
If so does it call that base class OnSysCommand()?
|
|
|
|
|
My CMainFrame() don't have OnSysCOmmand function.
I made some sample application in MDI.
But there we dont use OnsysCommand(), but every buttons work perfectly it gets minimized,maximized etc.,
My application also MDI application. Then why this problem?
Really i confused why this problem particularly occur in my application.
Even again i started from the scratch,selectin all project settings and added my class codings.But no use.The same problem exists.
Anu
|
|
|
|
|
I'm sorry I have insufficient information to further analyse this problem. Something in your "class codings" must be interfering with the default message handling.
|
|
|
|
|
Using windows address book, its possible to search active directory for a group or user, right click on it and show the properties.
Can anyone point me in the right direction for this, or possibly give me a clue so I can work it out myself?
Regards
Martin
|
|
|
|
|
I have no idea if this is the right direction, but hopefully it's a possible clue...
Active Directory Domain Services[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks for your suggestion, and sorry for writing a completly useless message to describe what I'm trying to do. No-one in the world could figure out what I meant by that, having read back my original message.. It has been a long week!
I am actually trying to programmatically open the properties dialog of a security group or user.. the same dialog which would be displayed by following the steps I descibed before. That is..
Windows Address Book, Edit, Find people, typing in either a user name or a group, right clicking on it and choosing properties.
I am interested in any advice in at the very least locating which dll might be responsible for displaying this dialog.
And if anyone actually has a way of programatically showing this box given maybe an ads path, etc, that would be perfect
Regards
Martin
|
|
|
|
|
hi, i'm a beginner in both MFC and multithreading.
i created a dialog and in my CMy61xxTestDlg.h, i declared:
UINT __cdecl Start(LPVOID pParam);
// CMy61xxTestDlg dialog
class CMy61xxTestDlg : public CDialog
{......
and in my cpp file, i have
hDrv=0;
CWinThread* pThread=AfxBeginThread(Start,(UINT)hDrv,THREAD_PRIORITY_BELOW_NORMAL);
i got error like:
error C2665: 'AfxBeginThread' : none of the 2 overloads could convert all the argument types
.....\afxwin.h(4202): could be 'CWinThread *AfxBeginThread(AFX_THREADPROC,LPVOID,int,UINT,DWORD,LPSECURITY_ATTRIBUTES)'
.....\afxwin.h(4205): or 'CWinThread *AfxBeginThread(CRuntimeClass *,int,UINT,DWORD,LPSECURITY_ATTRIBUTES)'
while trying to match the argument list '(UINT (__cdecl *)(LPVOID), UINT, int)'
could anyone help me with this?
thx!!!
|
|
|
|
|
Two possibilities I see...
1) Start is a non-static member function
2) hDrv should be cast to a LPVOID, not a UINT
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
hmm...isn't a start a global function?
|
|
|
|
|
If yes then ignore #1
I meant those were two possible reasons for the error based on what I could see.
I put #1 just in case you had it declared inside a class.
Did fixing the cast work then?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
yes! it worked, now i only got a warning C4312: 'type cast' : conversion from 'int' to 'LPVOID' of greater size
I hope this warning doesn't affect anything.
Thanks!
|
|
|
|
|
You get a warning if you do it like this?
CWinThread* pThread=AfxBeginThread(Start,(LPVOID)hDrv,THREAD_PRIORITY_BELOW_NORMAL);
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
yes, the warning is warning C4312: 'type cast' : conversion from 'int' to 'LPVOID' of greater size
i think it's because hDrv was declared as int
|
|
|
|
|
Ohh it's a 64-bit compatibility warning
You can use the LONG_PTR type instead of int or disable the warning if you want to.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
ok...thanks!
and 1 more question regarding start() function,
i need to use the function and variable in the my CXXXDlg class, what's the syntax for that?
say what if i want to use the m_CListBox.AddString function, m_ClistBox is the CListBox object declared in the CXXXDlg class
-- modified at 17:08 Friday 27th July, 2007
|
|
|
|
|
Typically you'd pass a pointer to the class object to the thread.
In the thread proc, cast the LPVOID back to a pointer to the object.
In your case, a pointer to the dialog class object that creates the thread is probably appropriate.
The thread proc can be a static member of the class.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
How would you implement a critical section between two or more windows in a single thread, i.e. if one winproc tries to access it, it halts in place till its available, while other windows in thread continue to function and continue to recieve messages. I know CriticalSections work for threads, not windows - I was thinking of something implemented with GetMessage, PeekMessage or whatever. Maybe this is impossible.
|
|
|
|
|
If you only have one thread there's no way to halt that thread and have anything else happen in your windows or window proc(s) (aside from asynchronous
callbacks, of course, but those are separate threads).
With a single thread, while a windowproc is handling a message, all other window procs are halted.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: If you only have one thread there's no way to halt that thread and have anything else happen in your windows or window proc(s) (aside from asynchronous
callbacks, of course, but those are separate threads).
With a single thread, while a windowproc is handling a message, all other window procs are halted.
Well, if a resource is unavailable, why couldn't a WinProc start a GetMessage-Translate-Dispatch loop right there until a special message was sent indicating the resource was available, at which point the WinProc would halt the GetMessage Loop and continue as normal. I'm not understanding why this doesn't work.
|
|
|
|
|
Because that "GetMessage-Translate-Dispatch loop" is running on the same thread you start it on. Everything occurs serially until there's another thread.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|