|
Can you give me an exemple? And yes I want it to be checked.
|
|
|
|
|
Use ClassWizard to add a BOOL for the checkbox named m_bCheck . Double-click on the checkbox to add a handler. Populate the handler with code like the following:
void CMFCDialogDlg::OnCheck1()
{
UpdateData(TRUE);
if (m_bCheck)
{
AfxMessageBox(_T("Dialog goes here..."));
}
}
Steve
|
|
|
|
|
|
Hi
I have a dll with exported functions, which I protect with AFX_MANAGE_STATE(AfxGetStaticModuleState()) . Fine. Now, to those functions I send a callback function as a param. This callback function is in the exe. Is there a corresponding way to restore the module state when I get back into the exe, or do I need to roll up my sleves for this one?
It's a requirement that the writer of the dll shouldn't be bothered with restoring the state before calling the callbacks, but just setting his own state correctly using the AFX_MANAGE_STATE macro.
tia
Niklas
|
|
|
|
|
Do you really need to do this? Are you accessing resources in the dll and the callback?
Mark
|
|
|
|
|
Yes.
The dlls may supply dialogs, as well as calling one of the callbacks to invoke the exes dialogs (along with other things)
|
|
|
|
|
I would think you'd just need AFX_MANAGE_STATE(AfxGetStaticModuleState()) at the top of the
callback function.
As long as the module handle is set properly so MFC can find and load resources when it needs to.
This can also be overriden by loading the resources yourself if you need to.
Mark
|
|
|
|
|
I already tried that. AfxGetStaticModuleState() only seems to work in dlls. It returns null for resource and instance handles.
|
|
|
|
|
After some investigation I found that
AFX_MODULE_STATE* pPrevModuleState = AfxSetModuleState(NULL);
on entry, and
AfxSetModuleState(pPrevModuleState);
on exit seems to work. This will allow me to load the correct resources and also use AfxGetApp() and its compadres.
(though I'm not entirely convinced yet)
thanks for your time.
Niklas
|
|
|
|
|
|
Hi all guys,
I've a big trouble with my application.
It's based on some lib that must be compiled using setting MD[DLL Multithread].
The application runs without problems on my two pc that have VisualStudio 2003 & 2005 installed.
But i tried it on a pc without any visualstudio and it cannot start:
it gives this kind of error:
"Impossible to start specified application. Application configuration is not correct. A new installation of application could solve the problem".
I imported mfc80.dll thinking that here was the problem...but it doesn't solve!
Please help
|
|
|
|
|
|
thank you very much!!
it solved the problem!
|
|
|
|
|
Is there some reason why, when I create a new dialog (CMyKeypad) that I get an error message from the Class Wizard stating:
"Unable to open the files (directory path) for class CMyKeypad".
Thanks
John P.
|
|
|
|
|
Can you manually (e.g. with Windows Explorer) create a file in that location?
Elaine
|
|
|
|
|
I can create a Word file in that directory with no problem
John P.
|
|
|
|
|
Hi,
During the creation of the MainFrame, i call a function called StartUp,
which initialises different configs.
If something goes wrong during this initialisation, i would close the application.
an exit(1) terminates hardly the program and provokes MemoryLeaks ( Destructor isn't called )
Anyone an idea?
Thanks
|
|
|
|
|
baerten wrote: an exit(1) terminates hardly the program and provokes MemoryLeaks ( Destructor isn't called )
Which means you should not be using exit() . Send a WM_CLOSE message instead.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
So you are in (your CFrameWnd -derived class) CMainFrame::OnCreate ?
Simply
return -1<br />
this is the official notification that the creation went wrong.
See the MFC-standard code:
if (!m_wndToolBar.CreateEx( this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
AfxMessageBox( "Failed to create wndToolBar\n", MB_ICONERROR);
return -1;
}
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
Thanks you two
|
|
|
|
|
I am using ADO to connect to an ORACLE database. After a network failure (disable/enable network interface or unplug/plug network cable) ADO cannot restore the connection. I close the connection, then even create a new one with CoCreateInstance but queries rise exception
ORA-03114: not connected to ORACLE. Do you know how to solve this?
modified 8-Mar-17 3:50am.
|
|
|
|
|
Hi,
This is actually a second part to a previous option.
Assuming I "caught" the VK_TAB in PreTranslateMessage function of my custom CEdit control and did what I want.
Now, how do I force the cursor to stay at the end of the line inside my CEdit control. right now, after I am done processing the VK_TAB, the focus goes to the next control. I want to prevent that.
I tried SetFocus and return w/o running the CEdit::PreTranslateMessage after my processing but that did not help.
Thank.
|
|
|
|
|
from MSDN Pretran
CWnd::PreTranslateMessage
virtual BOOL PreTranslateMessage( MSG* pMsg );
Return Value
Nonzero if the message was translated and should not be dispatched;
0 if the message was not translated and should be dispatched.
Hence you have simply make your PreTranslateMessage implemantation to return 0 when Tab is intercepted.
-- modified at 13:26 Monday 8th January, 2007
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
please don't use the <pre> tag to quote long sentences. this enforce the page to display the line till the end, requiering us to scroll then...
|
|
|
|
|
I've modified it.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|