NO ToolTips when MFC app in _AFXDLL, _USRDLL DLL
Dicky Singh -- Dicky@landmark.com Thursday, April 11, 1996 ENV: Using 95+patch, VC++ 4.1 Here is a more easy to read and complete version of a question I asked a while back. I also wrote an application that shows what I am talking about. You can download Problem.zip from ftp://advn.com/pub/mfc (Thanks, Dave.) Instructions for extracting: With Winzip, select all files, click on extract, make sure "Use Directory Names" is checked. OR Copy to empty directory and Use command: Pkunzip -d Problem.zip) Question:------------------------------------- I recently moved a portion of a MFC application Shell.EXE to RunningReport.DLL. RunningReport has a CWinApp Object and is of the type "Regular DLL using Shared MFC DLL" and defines the following preprocessor definitions: _MBCS, WIN32, _DEBUG, _WINDOWS, _WINDLL, _AFXDLL, _USRDLL The Shell's main window and the RunningReport's main Window follow an interface similar to the MS Exchange, i.e. multiple SDI windows. Both Shell.EXE and RunningReport.DLL have their own resources (toolbars dialogs etc.). To access the correct resources I use AFX_MANAGE_STATE(AfxGetStaticModuleState( )); before each function in the DLL. Both Shell and Running Report have CFrameWnd derived windows with CToolbar derived toolbars. ****** The Tool tips on the Toolbars in RunningReport.DLL DO NOT show up. The ToolTips in Shell Toolbars DO show up. ******* Is there a way of doing what I am trying here? Or a better way to handle Toolbar ToolTips in a DLL? Appreciate any suggestions. -Dicky // Dicky@Landmark.COM I am also attaching my previous message, it includes what I have tried. ------------------------------------------- 95+patch, VC++ 4.1 I recently moved an application which compiled as an EXE to a DLL (regular DLL using a shared version of MFC DLL: i.e. The DLL has a CWinApp and uses the shared version of MFC DLL) This DLL (RunningReport.DLL) is called from an MFC EXE app (Shell.EXE). The Shell's main window and the RunningReport's main Window follow the multiple template interface. RunningReport.DLL has its own resources (toolbars dialogs etc.). The Main window in the RunningReport.DLL is a CFrameWnd derived frame, has CToolbar and CStatusbar derived toolbars and statusbar respectively. I correctly push the module state on every DLL function entry and Pop it on DLL function exit, because the Toolbars, Dialogs, etc. come up correctly. I further handle the Toolbar button states (depressed or not, enabled / disabled ) by borrowing some processing time from Shell's CWinApp::OnIdle( ) and calling CWinApp::OnIdle in the RunningReport.DLL (again setting the correct module state at entry and resetting at exit) The Tool tips on the Toolbars in RunningReport.DLL DO NOT show up. The ToolTips in Shell Toolbars DO show up. (Yes, they have what I think is required for ToolTips to show. The ToolTips worked when RunningReport was a part of Shell.EXE). This is what I tried: In the Shell's PreTranslate Method I added a method to call a function in RunningReport, which in turn calls the following method on RunningReport's CFrame (CFrameWnd derived): [pushed Module state, before calling this etc.] void CFrame::LetRunningReportHandleTheseToo(LPMSG pMsg) { /*TRACE("H:%d M:%d W:%d X:%d Y:%d\n", pMsg->hwnd, pMsg->message-WM_MOUSEFIRST, pMsg->wParam, LOWORD(pMsg->lParam), HIWORD(pMsg->lParam)); */ try { if (pMsg->hwnd == m_wndToolBar.m_hWnd) { if (pMsg->hwnd) { CToolTipCtrl* p = m_wndToolBar.GetToolBarCtrl().GetToolTips(); if (p) p->RelayEvent(pMsg); else TRACE("."); } } } catch (...) { TRACE("#"); } } BUT p is always NULL :-( Is there a way of doing what I am trying here? Or a better way to handle Toolbar ToolTips in a DLL? All suggestions welcome. -Dicky // Dicky@Landmark.COM // Dragon Team
John W. Podlogar Jr. -- podlogar@telerama.lm.com Monday, April 15, 1996 This is probably related to the fact that PreTranslateMessage doesn't get called when your CWinApp in in a DLL. The way I get around this is to install a hook function. See the KB article titled "Using a Tooltip Control with a Dialog Box" for more info... John W. Podlogar Jr. The wise man doesn't pose the right answers, podlogar@lm.com he asks the right questions. http://www.lm.com/~podlogar On Thu, 11 Apr 1996, Dicky Singh wrote: > ENV: Using 95+patch, VC++ 4.1 > > Here is a more easy to read and complete version of a question I asked a > while back. I also wrote an application that shows what I am talking > about. You can download Problem.zip from ftp://advn.com/pub/mfc (Thanks, > Dave.) > > Instructions for extracting: > With Winzip, select all files, click on extract, make sure "Use Directory > Names" is checked. > OR > Copy to empty directory and Use command: Pkunzip -d Problem.zip) > > Question:------------------------------------- > I recently moved a portion of a MFC application Shell.EXE to > RunningReport.DLL. RunningReport has a CWinApp Object and is of the type > "Regular DLL using Shared MFC DLL" and defines the following preprocessor > definitions: > _MBCS, WIN32, _DEBUG, _WINDOWS, _WINDLL, _AFXDLL, _USRDLL > > The Shell's main window and the RunningReport's main Window follow an > interface similar to the MS Exchange, i.e. multiple SDI windows. > > Both Shell.EXE and RunningReport.DLL have their own resources (toolbars > dialogs etc.). To access the correct resources I use > AFX_MANAGE_STATE(AfxGetStaticModuleState( )); before each function in the > DLL. > > Both Shell and Running Report have CFrameWnd derived windows with CToolbar > derived toolbars. > > ****** > The Tool tips on the Toolbars in RunningReport.DLL > DO NOT show up. The ToolTips in Shell Toolbars DO show up. > ******* > > Is there a way of doing what I am trying here? Or a better way to handle > Toolbar ToolTips in a DLL? > Appreciate any suggestions. > > -Dicky > // Dicky@Landmark.COM > > > > I am also attaching my previous message, it includes what I have tried. > ------------------------------------------- > 95+patch, VC++ 4.1 > > I recently moved an application which compiled as an EXE to a DLL (regular > DLL using a shared version of MFC DLL: i.e. The DLL has a CWinApp and uses > the shared version of MFC DLL) > > This DLL (RunningReport.DLL) is called from an MFC EXE app (Shell.EXE). > The Shell's main window and the RunningReport's main Window follow the > multiple template interface. > > RunningReport.DLL has its own resources (toolbars dialogs etc.). The Main > window in the RunningReport.DLL is a CFrameWnd derived frame, has CToolbar > and CStatusbar derived toolbars and statusbar respectively. I correctly > push the module state on every DLL function entry and Pop it on DLL > function exit, because the Toolbars, Dialogs, etc. come up correctly. > > I further handle the Toolbar button states (depressed or not, enabled / > disabled ) by borrowing some processing time from Shell's CWinApp::OnIdle( > ) and calling CWinApp::OnIdle in the RunningReport.DLL (again setting the > correct module state at entry and resetting at exit) > > The Tool tips on the Toolbars in RunningReport.DLL DO NOT show up. The > ToolTips in Shell Toolbars DO show up. > > (Yes, they have what I think is required for ToolTips to show. The > ToolTips worked when RunningReport was a part of Shell.EXE). > > This is what I tried: In the Shell's PreTranslate Method I added a method > to call a function in RunningReport, which in turn calls the following > method on RunningReport's CFrame (CFrameWnd derived): [pushed Module > state, before calling this etc.] > > void CFrame::LetRunningReportHandleTheseToo(LPMSG pMsg) > { > /*TRACE("H:%d M:%d W:%d X:%d Y:%d\n", pMsg->hwnd, > pMsg->message-WM_MOUSEFIRST, pMsg->wParam, > LOWORD(pMsg->lParam), HIWORD(pMsg->lParam)); */ > try { > if (pMsg->hwnd == m_wndToolBar.m_hWnd) { > if (pMsg->hwnd) { > CToolTipCtrl* p = > m_wndToolBar.GetToolBarCtrl().GetToolTips(); > if (p) > p->RelayEvent(pMsg); > else TRACE("."); > } > } > } catch (...) { TRACE("#"); } > } > > > BUT p is always NULL :-( > > Is there a way of doing what I am trying here? Or a better way to handle > Toolbar ToolTips in a DLL? > All suggestions welcome. > > > -Dicky > // Dicky@Landmark.COM > // Dragon Team > >
| Вернуться в корень Архива |