|
Do I need to insert a class for an event?no.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
one easy way is to create a button at design time, and double click on it to add the handler to know what all is needed..
Otherwise also, it is not a mammoth task. You have to declare a function, define it and add an entry for the button click to the message map.
Also you may be interested ON_CONTROL_RANGE
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
modified on Tuesday, April 14, 2009 4:02 AM
|
|
|
|
|
thanks for your reply.I have declared one function.I have added entry in message map.
It is working for me.
|
|
|
|
|
You can insert this code on your code and then if you want you can make your button.
#define IDC_DYNAMICBUTTON 3000
BEGIN_MESSAGE_MAP(CMFCDlg, CDialog)
ON_BN_CLICKED(IDC_DYNAMICBUTTON,&CMFCDlg::OnBnClickedbutton)
END_MESSAGE_MAP()
void CMFCDlg::OnBnClickedbutton()
{
}
//header file
public:
afx_msg void OnBnClickedbutton();
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
I need to catch the 0xC0000005 Exception in my code. I've tried try{}catch(CException *e){}, but it didn't work.
|
|
|
|
|
I think you are on the look out for First and Second chance exception[^]
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
Well, I've already searched Google, And I found using SEH could resolve this problem. But in my case, the code which throw the Exception is a dll. So the SEH didn't work for me.
|
|
|
|
|
normal C++ not handling "0xC0000005 Access Violation Error"" exception, you need to give more compiler option to handle it.
but you can try "__try __except", exception handling of C, it will help you. Usage[^]
Parag Patel
|
|
|
|
|
Thanks for your suggestion!
I tried it before, but it didn't work. Anyway, I found it is better to fix this problem in the dll file which throw the exception using __try__catch.
|
|
|
|
|
I am writing a code to do a long time draw like:
void MyDialog::DoSlowDraw(DWORD tDelay){
while(notFinished){
DrawNextLine();
Sleep(tDelay);
}
}
And it's better to have a "cancel button" because it may take a long time according to tDelay.
---------------------
My try:
To handle "cancle button clicked Message" , Drawing must be done by another thread.
UINT DrawProc( LPVOID pParam )
{
CMyDialog* pform = (CMyDialog*)pParam;
int timeDelay = pform->timeD;
Line_list* pLines = pform->m_pLines;
CClientDC cdc(pform);
It's worked, but as far as I know
1. Work thread should not touch the GUI ---- (Do the drawing).
2. MFC object should not passed to another thread ---- (passing drawing data by CMyDialog*)
Is there a good way to cancle long time drawing.
|
|
|
|
|
fitatc wrote: Is there a good way to cancle long time drawing.
See here.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
|
fitatc wrote: May be You misunderstanding my qustion because of my poor english.
I understood you perfectly. If you are drawing in a worker thread and you need to cancel that thread, my advice is the way to go. Using a message pump is an antiquated and largely unused 16-bit Windows solution.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Sorry for my late response,(I am in a busy work now)
You are right, but before that,
Do you think it is OK to draw in the work thread?
I mean, a good design? because drawing is touching the GUI I thought, maybe I was wrong.
|
|
|
|
|
fitatc wrote: Do you think it is OK to draw in the work thread?
I would think not. Have the worker thread post a message to the main thread (that owns the UI).
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I am writing a code to read the bits from the file. Starting from first bit, i can read the whole file, and can retrieve the whole data as well. But if i want to retrieve the bits from somewhere between the file, how should i do this? One more thing, i am doing a string comparision of a module(and that module repeats several times in the file) and then i am retrieving the bits hence i can,t apply character counting.
It was a woman who drove me to drink but I never got opportunity to thank her
|
|
|
|
|
dubeypankaj wrote: But if i want to retrieve the bits from somewhere between the file, how should i do this?
It depends on how you are reading your file. Are you using an ifstream, a FILE, a CFile, ... ? Typically, you can set the file pointer (e.g. CFile::Seek, ifstream::seekg, ...). You should look at the documentation for more information.
|
|
|
|
|
Read the file in binary mode completly in a buffer, and than you can do what you want.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Hi,
May i know how can read and write registry thru batch file.....
|
|
|
|
|
Link[^]
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
|
Hi,
I would like to build an win32 application which sould not inherit from explorer.exe. By default all MFC/Win 32 applications are loaded in explorer.exe. so any crash of application is causing crash to explorer and vice versa..
So i need to find out a way where my application wont be loaded in explorer.
Thanks in advance.
Birajendu
SonicWALL India.
Bangalore.
India
|
|
|
|
|
birajendu wrote: win32 application which sould not inherit from explorer.exe
I will tell you a trick, try to figure out where your application is crashing and why.
Fix the bug.
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
Obviosly i will do that. But that is not the only solution. It would be nice if we can luch programs with out inheriting from explorer.exe. I saw some apllication from some trusted venders used to do so.. they dont load their application on explorer.
birajendu
CyberG India
Delhi
India
|
|
|
|
|
birajendu wrote: It would be nice if we can luch programs with out inheriting from explorer.exe
Well, that's the case. I have no clue about what you mean by "inheriting explorer"... If your application crashes, explorer doesn't crash. They are two independant things, so why would they interfere ? Unless maybe you are talking about something specific like a shell extension ?
|
|
|
|