|
Chapter 12 of the following book contains what you need:
Network Programming for Windows[^]
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I have a CMDIChildWnd derived frame – a static splitter - and would like to dynamically modify its menu.
I used Spy and MFC tracer to find out what messages are send when the mouse hovers over the menu item - WM_NCHITTEST with HTMENU parameter.
WindowProc should intercept the message, however the doc is not clear where the message goes, and I cannot see it in the frame.
Is there a way to use Spy or MFC trace to find where to process the “nonclient” message?
Any help is as always greatly appreciated.
Cheers
Vaclav
Answer
<b>To the main frame of the MFC app where OnNcHitTest can process it.
</b>
-- modified 25-Feb-14 12:17pm.
|
|
|
|
|
The menu belongs to the frame.
So you need to create a handler for the WM_NCHITTEST message in the CMDIFrameWnd derived class.
The handler would look something like this -
LRESULT CMainFrame::OnNcHitTest(CPoint point)
{
LRESULT result = CMDIFrameWnd::OnNcHitTest(point);
if (HTMENU == result)
{
AfxMessageBox(L"On the menu");
}
return result;
}
The thing to keep note is that the message box will popup whenever the mouse hovers anywhere on the menu bar and not only on the menu items.
«_Superman_»
I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++) (October 2009 - September 2013) Polymorphism in C
|
|
|
|
|
Thanks for the reply.
I can detect the mouse hits, but only on the title bar of the splitter frame.
I may have problem with the adittional window whose function is to provide tab access to additional documents.
I am still not sure where the message goes from the frame menu.
I'll keep working on that, thanks for the suggestion, it really helps.
Cheers
Vaclav
|
|
|
|
|
OK, I am making progress.
Using default MDI app I can see the WM_NCHITTEST being processed ( WindowProc) by main frame - the menus hits, and by the doc/view frame - the window title area.
I am getting message #867 (?) as hit in my frame menu and WindowsProc in splitter ( my frame) catching it but since it is not near WM_NCHITTEST it is not processed.
I need to find out about this rogue 867 message origin.
|
|
|
|
|
The code that I posted earlier is working code on a default MDI application.
Here is some information on command routing in an MDI application - Command Routing Illustration[^]
The message #867(0x363) is an internal MFC message defined as -
#define WM_IDLEUPDATECMDUI 0x0363
You can find this in the afxpriv.h header file.
Here is some information about internal MFC messages - MFC Defined Messages[^]
Here is an excerpt from the above link -
WM_IDLEUPDATECMDUI
This message is sent in idle time to implement the idle-time update of update-command UI handlers.
«_Superman_»
I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++) (October 2009 - September 2013) Polymorphism in C
|
|
|
|
|
Thanks for the update.
In retrospect - my "mistake" was not understanding how main frame non-client message gets back to windows message processing. After accessing the current active MDI frame I have a better understanding of things.
Of couse few "new" documents ( DirectShow graph) insterted during test and left in did not help.
Many thanks for your assistance, appreciate it.
Vaclav
|
|
|
|
|
Hi, am new to coding and to mfc, am on an application development on mfc, the problem is in my toolbar alignment, i have 9 toolbars and i want to arrange as follows
T1-T2-T3-T4-T9
T5-T6-T7-T8
Am using VS2010 and already tried of "DockPaneLeftOf" but its not helping me whenever i rebuilt my project all toolbars is appearing in a single column. please help me out, am tired out of searching
|
|
|
|
|
Don't forget to remove the registry entry associated with your application.
The toolbar position might be written and read from the registry and position you try to setup in the code will be overridden by that.
Also, be careful at the order you call DockPaneLeftOf; I think that you need to order them from right to left:
DockPaneLeftOf(&T4, &T9);
DockPaneLeftOf(T3, T4);
DockPaneLeftOf(T2, T3);
DockPaneLeftOf(T1, T2);
Good luck.
I'd rather be phishing!
|
|
|
|
|
Thanks it works for the docking , but multiple columns i cant achieve that Does SetRows function do this job, then how to implement SetRows()
modified 25-Feb-14 2:19am.
|
|
|
|
|
thanks for the replay,i did the following and i got the order well but its still on a single row as some of the toolbar is not visible, how to end up in multiple rows
DockPane(&m_wndMenuBar);
DockPane(&tb9);
DockPaneLeftOf(&tb8, &tb9);
DockPaneLeftOf(&tb4, &tb8);
DockPaneLeftOf(&m_wndToolBar, &tb4);
DockPaneLeftOf(&tb1, &m_wndToolBar);
DockPaneLeftOf(&tb7, &tb1);
DockPaneLeftOf(&tb6, &tb7);
DockPaneLeftOf(&tb3, &tb6);
DockPaneLeftOf(&tb2, &tb3);
A learner
|
|
|
|
|
i want to write my own MAKEFILE for our Internal Compiler,if anyone having source code..please help me
|
|
|
|
|
|
Member 9978154 wrote: i want to write my own MAKEFILE for our Internal Compiler,if anyone having source code..
A make file might be consider source. A make file would be consumed by the "make" utility. You can look for examples of make files.
If you want to write your own "make" application (not make file) then that would be a different source. However in that case I question why you think you would need to modify make itself. Have you looked a the documentation and understood it? If yes then what feature do you think is missing for your internal compiler?
|
|
|
|
|
Thanx for your advice.But as we are developing our own debugger,so i want to develop my own makefile.
I want some source code...please suggest me
|
|
|
|
|
Member 9978154 wrote: But as we are developing our own debugger,so i want to develop my own makefile.
The former has nothing to do with the latter.
Member 9978154 wrote: I want some source code...please suggest me
You can find open source for the make application.
Still no idea what you think you are going to get from it.
|
|
|
|
|
|
How to embed webbrowser control in the MFC DLL?
Download this page by the MFC DLL and extract data.
thanks.
|
|
|
|
|
I think you are talking about using the Internet Explorer based CDHtmlDialog[^] (MSDN sample[^]) or something like SimpleBrowser[^].
If you don't want to use Internet Explorer, look into Webkit[^] - I have not tried this out myself, so I am not sure how easy it is to use.
[EDIT]
Here is another useful CodeProject article: IWebBrowser2 Wrapper Class[^]
[/EDIT]
Soren Madsen
"When you don't know what you're doing it's best to do it quickly" - Jase #DuckDynasty
|
|
|
|
|
|
The application (CFrameWndEx) creates a dialog box (CDialogEx) with future ambitions of adding CMFCTooltipCtrl etc. I am trying to just get CTooltipCtrl to work first. In the dialog class I have:
.h -
CToolTipCtrl* p_TTCtrl;
.ccp -
<pre lang="cs">p_TTCtrl = new CToolTipCtrl;
ASSERT(p_TTCtrl->Create(this));
CWnd* p_Wnd = this->GetDlgItem(IDCTL_Pref_CB_Exit);
VERIFY(p_TTCtrl->AddTool(p_Wnd, IDCTL_Pref_CB_Exit, NULL, 0));
p_TTCtrl->Activate(TRUE);</pre>
When I run the debugger, there are no ASSERT or Verify errors. If I hover over IDCtrl_Pref_CB which is a checkbox created from the .rc file, nothing happens.
Can someone please point out what I am missing or have wrong.
Thanks,
Barry
|
|
|
|
|
Did you add the text for the tooltip? UpdateTipText()[^]
EDIT:
Nevermind, I didn't notice that the AddTool function already specifies the text.
The difficult we do right away...
...the impossible takes slightly longer.
modified 23-Feb-14 17:04pm.
|
|
|
|
|
In an ancient VC6.0 there is a "add C++ components " option which
does the grunt work of adding tooltip for you. I would guess that the latest VS has a similar tool.
|
|
|
|
|
I found it. I was creating the CMFCTooltipCtrl class improperly.
Thanks for the effort,
Barry
|
|
|
|
|
Maybe it sounds stupid, but how can i shutdown my app gracefully at CMainFrame Initialization ? I just want to do some system checks and if they fail, then immediately terminate the app before any window is created.
Any known methods like PostQuitMessage(0), PostMessage or OnClose etc fails because mainframe window is not created yet. Where to use exit code ?
PS: I dont want to use the InitInstance from my App.
Regards,
sdancer75
|
|
|
|