|
|
Aha.
Anyone know offhand the easy way to get a handle to my mainframe's m_wndToolBar so I can send this message?
|
|
|
|
|
It's kept as m_wndToolbar in your CMainFrame class, however the proper way to disable buttons is to write an UPDATE_COMMAND_UI handler for that particular button's ID. That way MFC will automatically call your handler so you can disable the button (and associated menu item, if there is one).
--Mike--
Just released - RightClick-Encrypt v1.4 - Adds fast & easy file encryption to Explorer
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
I have a dialog based app, whose main dialog (dlgMain ) has 3 buttons: "Exit App" (which exits the app), "Create Modeless Dialog" which creates a modeless dialog (dlgModeless ), and "Options", which displays a modal options dialog.
dlgModeless also sports an "Exit App" button. dlgModeless 's handler for "Exit App" simply delegates the task to dlgMain by posting it the appropriate WM_COMMAND message.
The user performs the following actions:
- Clicks "Create Modeless Dialog" in
dlgMain , causing the modeless dialog to appear.
- Clicks "Options" in
dlgMain , causing the modal Options dialog to appear.
- Clicks "Exit" in
dlgModeless , causing dlgMain to exit. While exiting, dlgMain properly destroys the modeless dialog. The problem is the modal "Options" dialog is still hanging around as an orphan window. I need to modify dlgMain 's "Exit App" handler to ignore the command if a modal dialog is being displayed.
My question is, how do I detect this without using ugly booleans? I was looking for Afx.../CWnd/Win32 calls to check this, but have come up empty handed.
Thanks,
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Two ways come to mind:- Make the modal dialog a member of your app or main frame class, then you can call
IsWindow() to tell if the dialog is open. - Call
IsWindowEnabled() on your main frame, which will return TRUE if it is disabled because the modal dlg is open.
--Mike--
Just released - RightClick-Encrypt v1.4 - Adds fast & easy file encryption to Explorer
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Hi Mike,
Actually the example I gave was a simplistic version of the real problem. In reality, the main dialog can display one of numerous modal dialogs (in response to various commands). I was hoping there would be a generic way to check if a window has a descendant modal dialog in progress.
Your IsWindowEnabled() trick fits the bill poifectly! Now why didn't I think of the obvious?
Many thanks!
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Greetings...
I want a have Excel like flat tab in my application at the bottom of my tab control.
Can somebody suggest me a way or any article on net which tells me how to go through it.
I am not using MFC, only Win32 APIs
Thanks in advance.
Ritesh
|
|
|
|
|
I know this is MFC but the extended styles should apply for MFC and Win32 API. I'm not sure what the Excel like tabs are like but this style makes buttons out of the tabs. Is that what you're looking for?
m_pTabCtrl = new CMyTabCtrl;
CRect cltRect;
GetClientRect(&cltRect);
m_pTabCtrl->Create(WS_CHILD|WS_VISIBLE | TCS_BUTTONS | TCS_FLATBUTTONS, cltRect, this, IDC_TAB1);
DWORD dwExtStyle = m_pTabCtrl->GetExtendedStyle();
m_pTabCtrl->SetExtendedStyle(dwExtStyle | TCS_EX_FLATSEPARATORS);
m_pTabCtrl->ShowWindow(true);
TC_ITEM TabCtrlItem;
TabCtrlItem.mask = TCIF_TEXT;
TabCtrlItem.iImage = -1;
for(i = gSites.size(); i > 0; i--)
{
TabCtrlItem.pszText = gSites[i-1].GetId();
m_pTabCtrl->InsertItem( 0, &TabCtrlItem );
}
m_pTabCtrl->SetCurSel(0);
|
|
|
|
|
Hello there,
I'm writing a database program ...
I used ADO and Microsoft.Jet.OLEDB.4.0 for opening my Access 2000 database ...
I must install Jet 4.0 for using Access 2000 ???
or MSDAC 2.6 ???
I downloaded both of them, but i want to know which of them is neccessery to install for using ADO with Access 2000 ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
MDAC contains all you need for ADO with Access 2000.
Michael
Programming is great. First they pay you to introduce bugs into software. Then they pay you to remove them again.
|
|
|
|
|
Thanks
Other question about MSDAC, in microsoft data access downloads i saw thease item available for download:
MSDAC 2.7 (it is version that is currently in xp os)
MSDAC 2.6(SP2)
MSDAC 2.5
Some of my users use still Win98, which item is better to update ?
MSDAC 2.7 or MSDAC 2.6 ??
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Hadi_Rezaie wrote:
I must install Jet 4.0 for using Access 2000 ???
or MSDAC 2.6 ???
Both of them. The Jet files are not a part of MDAC from version 2.5 (or 2.6?) up.
Pavel
Sonork 100.15206
|
|
|
|
|
Hello Pavel
Could you tell me what's the reason to update microsoft Jet engine when i installed MDAC 2.6 or later ?
What Jet engine exactly do ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Jet engine is a database engine for mdb files (MS Access uses it).
If you want use mdb/Access database format, you need it. If you are using other database engine (SQL Server or other) you don't need it. MFC CDao???? classes use the Jet engine.
Pavel
Sonork 100.15206
|
|
|
|
|
Hi,
Here is code :
CString Valeur="1250.20";
int Fractional = ((atof(Valeur) - atoi(Valeur)) * 100);
Value of Fractional variable after thsi operation is 19 ( False )
I must be 20
Where is my error
Thanks in advance
|
|
|
|
|
Hello,
Try this one:
CString Valeur="1250.20";
int Fractional = ((atof(Valeur) - atoi(Valeur)) * 100.0);
change 100 to 100.0
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Result of atof-atoi is converted to int before multiplication.
Pavel
Sonork 100.15206
|
|
|
|
|
Hello there,
How can i get ADO version ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Hello there,
Is there any API function for registering ActiveX or DLLs ??
Or i have to use WinExec to run regsvr32 to regestring ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Try something like:
typedef HRESULT (STDAPICALLTYPE *FnDllEntryPoint)(void);
HMODULE hMod = ::LoadLibrary( pszDllName );
if ( hMod != NULL )
{
FnDllEntryPoint lpDllEntryPoint = (FnDllEntryPoint)::GetProcAddress( hMod, "DllRegisterServer" );
if ( lpDllEntryPoint != NULL )
{
if ( SUCCEEDED( (*lpDllEntryPoint)() ) )
{
// Success
}
else
{
// Registration failed
}
}
else
{
// Failed to find entry point - probably not a COM object
}
::FreeLibrary( hMod );
}
else
{
// Failed to load library
}
Dave
|
|
|
|
|
That's it
Thanks aloooooot !
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Hi!
I've created a MFC Dll. I have exported a function which must display a dialog box. I have tried to use the CDialog class but the dialog doesn't appear.
Here a portion of my code(CreatePageDlg is the dialog class of the dialog I want to display):
#include "stdafx.h"
#include "web.h"
#include "CreatePageDlg.h"
__declspec(dllexport) void __cdecl ShowDialog(CString FileName)
{
CCreatePageDlg dlg;
dlg.DoModal ();
if (dlg.DoModal ()==IDOK)
{
}
}
What's wrong.
Thks in advance!
Appstmd
|
|
|
|
|
Have you tried debug stepping into the DoModal function, this should give you more clues to what the problem. Also the sample code provided will show the dialog twice.
Is the DLL's resource identifier range different to the applications's resource id range?
Michael
Programming is great. First they pay you to introduce bugs into software. Then they pay you to remove them again.
|
|
|
|
|
You might have been bitten by MFC dialog creation code that tries to load the resource with the same name or ID from the executable, not from the DLL itself.
You must make your DLL an "MFC extension DLL". How to do this is reasonably well documented in e.g MSDN.
|
|
|
|
|
Where can I find the registry key for the path of the current WebBrowser / EmailReader?
Who can I get/read the icons from these exe-files ?
Please, give me an answer ...
Stefan-Mihai MOGA
info@mogamihai.ro
|
|
|
|