|
Thanks again for the reply.
The problem is the following. I have a function that is being called from OnLButtonUp. Under determined circumstances, must end the dialog. However, the code is being executed twice... that is, after the EndDialog for some weird reason it is executing the same code again... When it is executed again, it throws me an exception because the dialog has already been destroyed (!).
I think that such problem is caused by remaining messages in the queue or something. I can't figure out what is happening really, and the spy++ is not working.
Tahnks again. Regards,
Fernando.
A polar bear is a bear whose coordinates has been changed in terms of sine and cosine.
Personal Site
|
|
|
|
|
That's what I mean...it's not a good idea to do anything after you've called EndDialog().
Even if it's from a nested function - that function shouldn't do anything except return.
Can you return a value from that function indicating that the dialog has been ended? Check
that returned value and if it indicates the dialog has ended then just return.
Mark
|
|
|
|
|
|
Put a return statement after the EndDialog().
|
|
|
|
|
Yep, actually there is a return. That is why this issue is freaking me out... In fact, while I was spy++ing the app, I realized that even a WM_CLOSE and a WM_DESTROY message was sent to the application, and then it ran the code again
Thanks for your reply.
Regards,
Fernando.
A polar bear is a bear whose coordinates has been changed in terms of sine and cosine.
Personal Site
|
|
|
|
|
|
Are you looking for AfxAbort() ?
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
Can you show code, how you are using this dialog ?
|
|
|
|
|
|
Hello. First of all, I'd like to thank you all for the help provided. Indeed, I am so happy now, and after your help and like 50 cigarrettes, I was able to find the bug. Here's the issue.
It was happening something like Mark and Michael told me, about not running a single line of code after the EndDialog. That is, the code must have a return after the EndDialog call. However, in my code there was an EndDialog and a return. Yet in other part of the code, this dialog created another dialog and this new child window, when it ends the dialog, does not have a return and indeed there was more code executing after the call of EndDialog. So a simple return there ended the problem. Something like the following:
<br />
<br />
void CAnotherDialog::EndDialog()<br />
{<br />
DoSomething();<br />
if (m_bSomething)<br />
EndDialog(IDCANCEL);<br />
<br />
DoMoreStuff();<br />
}<br />
<br />
void CMyDialog::DoSomething()<br />
{<br />
CAnotherDialog dlg;<br />
dlg.DoModal();<br />
<br />
if (bSomeFlag)<br />
{<br />
EndDialog(IDCANCEL)<br />
return;<br />
}<br />
<br />
DoMoreStuff();<br />
}<br />
So I just changed it into:
<br />
<br />
void CAnotherDialog::EndDialog()<br />
{<br />
DoSomething();<br />
if (m_bSomething)<br />
{<br />
EndDialog(IDCANCEL);<br />
return;<br />
}<br />
<br />
DoMoreStuff();<br />
}<br />
<br />
void CMyDialog::DoSomething()<br />
{<br />
CAnotherDialog dlg;<br />
dlg.DoModal();<br />
<br />
if (bSomeFlag)<br />
{<br />
EndDialog(IDCANCEL)<br />
return;<br />
}<br />
<br />
DoMoreStuff();<br />
}<br />
Thank you guys, you really saved my nervous system.
One last thing: should I post this issue in the subtle bugs section, or it was only pure lack of knowledge (stupidity, that is) from my part?
Thanks again.
Regards,
Fernando.
A polar bear is a bear whose coordinates has been changed in terms of sine and cosine.
Personal Site
|
|
|
|
|
Hi,
How can I write an instant messenger (IM) that would scale well with increased numbers of users? Any ideas about implementing the server side and handling a large number of connections? I need a place where I can start from.
Do you have any information about current IMs e.g Yahoo, MSN, .. etc? Specifically about their server side implementations and how they can handle those large numbers of users? Any help is appreciated.
Regards,
Wal
|
|
|
|
|
Waleed wrote: How can I write an instant messenger (IM) that would scale well with increased numbers of users?
This is a trick question in a way, and hopefully I can point you in the direction of a decent solution. The only solution that will scale well is, one in which demand indirectly creates supply, this is most commonly seen in Peer to Peer networking. The more users who join the network imply the more capacity the network has, and all P2P is not evil incidently.
Using the traditional client server approach is dangerous, it may never be able to fully cope with spikes in demand. So I suggest you take a look at Pastry, it is a Microsoft P2P client written in Java funnily enough. Another solution would be to look at Ekiga, the most popular Linux IM solution with the full source code available.
|
|
|
|
|
Thanks a lot, I'm going to look for what you pointed out in your message.
Wal
|
|
|
|
|
I need to insert the binary data from a local file into an image column
in a SQL server 2000 database table. Is there a simple procedure for
this, in C++ ?
cheers,
Neil
|
|
|
|
|
See here and here.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
C++ is not much of a help itself. More likely is a DB API you may prefer (or mandatory to use...). OLEDB is probably the best (and hard sometimes) way for C++.
|
|
|
|
|
Thanks to both of you for the replies. This seems to be quite tricky. I was looking at using SQLPutData().
There doesn't seem to be a T-SQL statement that does such an insert either..
cheers,
Neil
|
|
|
|
|
How does one find out what the active default codepage is?
The reason I need this -- is for a server I interact with. It wants to encode a zip file (which doesn't support unicode) using the likely character set in use on this machine...
Any thoughts?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc.</A>
|
|
|
|
|
What do you mean by active codepage? If is the one from control panel/regional settings, you may want to check the functions GetLocaleInfo, GetSystemDefaultLangID etc.
|
|
|
|
|
Hopefully GetOEMACP() get's me what I want...
Thanks for the info...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc.</A>
|
|
|
|
|
What's the major difference between stricmp and _stricmp? I'm porting an application from PC to PocketPC and PPC does not like 'stricmp.' Is the '_' just an indicator for UNICODE, in this case?
Thanks in advance,
Carl
|
|
|
|
|
No. UNICODE calls are usually prefixed with a "w", so the UNICODE counterpart is wcsicmp in this case. The _ is probably and "oldnames.lib" thing. Try to use as a last resort
#ifdef POCKET_PC // or your platform
#define stricmp _stricmp
#endif POCKET_PC
or, alternatively
#ifdef POCKET_PC // or your platform
#define stricmp(x, y) _stricmp((x), (y))
#endif POCKET_PC
|
|
|
|
|
yeah, that's what I'm doing right now. I was just puzzled by the '_'.
Thanks for answering that question for me.
|
|
|
|
|
Like2Byte wrote: What's the major difference between stricmp and _stricmp?
The former comes from oldnames.lib.
Like2Byte wrote: Is the '_' just an indicator for UNICODE, in this case?
Hardly, if ever. When a function is preceded with an underscore, it usually indicates a Microsoft-specific implementation.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: When a function is preceded with an underscore, it usually indicates a Microsoft-specific implementation.
That I can believe. Thank you, very much!
|
|
|
|