|
Hi,
I have an MFC (VC6) app that uses a splitter window. There are buttons on the left and info is displayed on the right.
I have added a "Quit" button to the left splitter with the following code"
void CControlPanel::OnBtnQuit()
{
PostMessage(WM_QUIT);
}
And some clean up operation is done in CResidentialEstimatorApp::ExitInstance()
int CResidentialEstimatorApp::ExitInstance()
{
CString file;
file = GetPath("tempEst","html");
CleanUPm(file);
return CWinApp::ExitInstance();
}
The program crashes sometimes when the 'Quit' button is clicked. I can't figure out why this is happening. If the program is closed using the 'X' button or File-Exit from the menu, there is no problem.
Any help is highly appreciated!
Thanks,
Tara
Fortitudine Vincimus!
|
|
|
|
|
Have you tried this?
AfxGetMainWnd()->PostMessage( WM_QUIT );
|
|
|
|
|
Thanks.
I have tried as you suggested. But the program still crashes.
For some reason, it is happening on some XP systems. It doesn't happen on my computer. Also if the 'X' button is clicked or File-Exit is clicked there is no problem. I just don't understand why this is happening.
Fortitudine Vincimus!
|
|
|
|
|
Debugging the application may help you? If we got a "Abort Retry Ignore" message box when it crashes, then we can locate the code part.
|
|
|
|
|
It turned out that the computers on which this was happening, after re-installing MS Office, the problem disappeared.
I wonder why. Would you be having any idea?
The program only uses the IE browser to display reports; nothing else that would clash with MS Office.
Fortitudine Vincimus!
|
|
|
|
|
|
use
VOID PostQuitMessage(
int nExitCode
);
|
|
|
|
|
Hi,
I want to work some functionalities by pressinmg keys in external keyboard.For that i give some shortcut keys for the keys.
From that i get ASCII of keys and i coded for seperate ascii codes.
My problem is,in some keys the shortcut are combination keys like Ctrl-a,Shift-5,Alt-6 like this.
When i press that particular key,in OnkeyUp(0 fucntion i get ASCII for only ctrl,shift like 16,18 like that.
But i need ASCII code for combination keys (Ctrl-A,Shift-F5....)
What can i do for that?
Anu
|
|
|
|
|
I guess u need to try with EBCDIC code.
try getting the ASCII values twice for the keys . u may get it....
If U Get Errors U Will Learn
If U Don't Get Errors U Have Learnt
|
|
|
|
|
I need only ASCII values for combination value.
What is the ASCII value for shift+F1?
I get only ASCII value for shift or F1...not for both.
I need help for this only.
Anu
|
|
|
|
|
the following link has a javascript method find the ascii values for each key at the bottom of the page
Try it http://www.quirksmode.org/js/keys.html[^]
If U Get Errors U Will Learn
If U Don't Get Errors U Have Learnt
|
|
|
|
|
Anu_Bala wrote: My problem is,in some keys the shortcut are combination keys like Ctrl-a,Shift-5,Alt-6 like this.
When i press that particular key,in OnkeyUp(0 fucntion i get ASCII for only ctrl,shift like 16,18 like that.
Take a look at GetKeyState API in MSDN --> http://msdn2.microsoft.com/en-us/library/ms646301(VS.85).aspx[^]
Nibu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http:\\nibuthomas.wordpress.com
|
|
|
|
|
Hi All,
In the dialog box, I can put a bitmap by importing the bitmap in the Resource View. However, as far as I know (and tried), it is limited to 256 color bitmap only. Is it possible to put higher color space bitmap such as 24-bit for picture in the dialog box?
Thank you
-Houari
|
|
|
|
|
You must be using an older Visual Studio
If I remember correctly, older versions didn't have an editor for
bit-depths > 8 but you could still add them to a resource script (RC file).
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
ah yes, i am using VS 6.0 ^^
and how can add them using resource script?
thanks...
-Houari
|
|
|
|
|
A typical BITMAP resource[^] in your app's .RC file looks something like
IDB_BITMAP1 BITMAP "res\\bitmap1.bmp"
where IDB_BITMAP1 is the identifier and the pathname of the bitmap file
is in quotes.
If you want VS to insert the code for you, you could add an 8-bit bitmap
in the editor then replace the created BMP file with your 24-bit bitmap.
Or edit the RC file by hand - it's a text file.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I'm writing an ISAPI Dll, but without the full MFC Overhead, i.e. I'm rolling my own! What should I include in stdafx.h to have access to the CString Object.
I am currently including windows.h, the ANSI Standard C Headers, and httpext.h. I know that <windows.h> will conflict with a lot of MFC Windows stuff, and it is easy to run into Linker trouble, if an inconsistent set of libraries is specified.
By the way, Happy New Year to All.
Bram van Kampen
|
|
|
|
|
If all you need is CString, then you don't need MFC.
atlstr.h should be the header you need for non-MFC projects.
See CStringT Class[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
you can use ATL::CString in your project i.e. ISAPI dll!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/codeProject$$>
|
|
|
|
|
Bram, since you're still using VC5, CString isn't available separately from the MFC library.
Starting in VS2002 or VS2003 (I don't remember which), they moved CString out of the MFC library and into the ATL.
Software Zen: delete this;
|
|
|
|
|
Thanks Garry,
Good from you to remember that I still use VC5.
Santa has been and gone and did not leave a compiler package under the tree.
Hopefully, the Easter bunny is more generous, ( or Maybe St Valintine, although he HAS been very good to me in finding me a partner in Love,Life and Business) or even St Patric if all else fails.
Seeing that I use MFC as a DLL, I think that afterall the overhead is not all that big, so I included 'afx.h' in 'stdafx.h', and deleted 'windows.h' Code back on track with minor modifications!
Thanks again, and a happy 2008 for you and yours
Regards,
Deirdre
+
Bram van Kampen
|
|
|
|
|
Hello.
my prob that i can't change the default caption of my application on the main bar.
So how could i change it to smth like "BioHazard Engine"
"The Ultimate Limit Is Only Your Imagination."
|
|
|
|
|
The text can be set when the window is created, and can be
changed later with SetWindowText() or WM_SETTEXT.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
So, how Could i use the fuction SetWindowText ?? shoud i create any specific handler or what ?
Thx
IO found This Peace of code
#include <afxpriv.h>
pMainFrame->ShowWindow(m_nCmdShow);
pMainFrame->UpdateWindow();
AfxSetWindowText(m_pMainWnd->m_hWnd,"TestSDI- Farscape");
but i dont know what is the Type of the var m_pMainWnd. My prog is calles AUTO so i have AUTODOC AUTOVIEW & AUTOAPP classes
"The Ultimate Limit Is Only Your Imagination."
|
|
|
|
|
When a window is created, you get a window handle (HWND).
You can use that handle in a call to SetWindowText():
::SetWindowText(hwnd, _T("My Window Title"));
If you're using MFC, and you've created your main window in
the usual way, you can use something like this:
if (AfxGetApp()->GetMainWnd())
AfxGetApp()->GetMainWnd()->SetWindowText(_T("My Window Title"));
No message handlers are necessary - just call it.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|