|
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!
|
|
|
|
|
Hi All,
I have one MFC application, I removed the resource(.rc file) in the "File View". I created a "Reource-Only DLL" and I added that removed resource(.rc file and resource.h file) in "Resource-Only DLL". With Linker option as /NOENTRY.
I have done one small test program and its working fine. But if I implement same in my application I'm getting Error code as 1407 (i.e., "Cannot find window class.") in my application workspace.
If i debug through I will get this error in "hWnd = ::CreateDialogIndirect(hInst, lpDialogTemplate,pParentWnd->GetSafeHwnd(), AfxDlgProc);" and file path is "..\MFC\SRC\DLGCORE.CPP".
I feel associated class and dialog is not mapping, But I'm not sure.
Please can you help me on this...
Pradeep
|
|
|
|
|
You may need to use AfxSetResourceHandle() to set the HINSTANCE of the DLL before creating
the dialog. If only some resources are in the DLL and some are in your app then you'll want to
restore the HINSTANCE of the app with AfxSetResourceHandle when you're done creating the dialog.
HINSTANCE hResourceDLLInstance = NULL;
hResourceDLLInstance = LoadLibrary("MyResource.dll");
...
...
// Create a dialog - Dialog resource is in MyResource.dll
HINSTANCE hOldResourceInstance = AfxGetResourceHandle();
AfxSetResourceHandle(hResourceDLLInstance);
...
// Create the dialog here
...
AfxSetResourceHandle(hOldResourceInstance);
|
|
|
|
|
Hi Thanks for quick response.
Infact application don't have resource, all resource is in DLL. Still I'm using "AfxSetResourceHandle( )". But still it's failing...
Pradeep
|
|
|
|
|
Does the DIALOG resource have a CLASS statement?
|
|
|
|
|
Probably he's not using MFC extension dll for resource dll, and the resource is not found in dll chain?
|
|
|
|
|
Cristian Amarie wrote: Probably he's not using MFC extension dll...
Yes. I'm thinking that the MFC initialization code which registers the built-in window classes
needs to be called in the DLL since it associates the class with the HINSTANCE.
I didn't think this was necessary because I use a resource-only DLL (without any MFC in the DLL)
and use dialog resources from the DLL in a MFC app but I just looked at the code (I haven't looked
at it in years ) and I'm loading the dialog resource into memory then creating the dialog
indirectly with MFC
|
|
|
|