|
Perhaps in your OnClose handler you could have...
ShowWindow(SW_HIDE);
WaitForSingleObject(m_hThread, INFINITE);
|
|
|
|
|
SWDevil wrote: then there is an assertion.
Is the assertion a Debug only mechanism? What is the behavior in "Release" mode?
|
|
|
|
|
SWDevil wrote: How can I overcome this?
Read here.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
You will need to do 2 things to do this cleanly:
First, create an event and pass the event to the thread. Each pass of the Thread, use WaitForSingleObject with a low timeout value to see if the thread needs to exit (if it does, do any cleanup you need to and return from the thread).
The first step will allow the thread to exit cleanly. In your main thread, you will need to also add a WaitforSingleObject and use the thread's handle as the object. Use a timeout value appropriate for you (INFINITE is NOT appropriate here as it will deadlock your application's shutdown procedures). If the Wait times out, call TerminateThread with the handle for the thread (this is a forceful killing of the thread).
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Maybe one of my previous posts can help: click here.
- It's easier to make than to correct a mistake.
|
|
|
|
|
Hi All
I am using a CString array which holds a list of ID's
for ex
arr[0]='37373';
arr[1]='37432';
arr[2]='37213';
arr[3]='37666';
i need to add an extra element to each array item
so my array would be something like
arr[0]='37373','fred';
arr[1]='37432','bob';
arr[2]='37213','june';
arr[3]='37666','alf';
what would be the best way to do this, and how would i go about it
thanks
Si
|
|
|
|
|
Do you mean
arr[0]="37373"; and
arr[0]="37373,fred"; ?
- It's easier to make than to correct a mistake.
|
|
|
|
|
Jun Du wrote: Do you mean
arr[0]="37373";
and
arr[0]="37373,fred";
?
no, only
arr[0]="37373,fred";
|
|
|
|
|
|
Or std::vector<std::pair<std::string, std::string> >
|
|
|
|
|
si_69 wrote:
what would be the best way to do this, and how would i go about it
You have to use some delimiter for adding extra data into each element of the array..like following.
arr[0]="43545" + "," + "mydata";
or use the Append method of the CString for each element.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
Is it better to link .lib files using a line such as:
#pragma comment(lib,"XXXXXX.lib")
or, should they be linked via the project settings? What are the practical differences to these approaches?
Thanks, -mutty
|
|
|
|
|
|
I think there is no difference regarding the final executable, but I think putting of #pragma comment(lib,"XXXXXX.lib") in your files at least requires less configuration work when you re-use your code in other applications. You will not need to remember each time which external libraries must be used.
For instance, this practice can be seen in the header files supplied with MFC.
|
|
|
|
|
Hi:
Does anybody know about this problem?
I have been developing this application for several weeks now. I've created all sorts of dialog boxes and used Class Wizard to create a CDialog based class for each one.
Since late last week, Class Wizard has simply stopped working. I create a dialog resource, double click it to invoke Class Wizard, the window pops up, I fill it out and press "Finish". Nothing happens. It does NOT generate the class files. No error is reported, it just doesn't do anything.
I am at a dead stop here. Is anyone familiar with this problem? Somebody suggested last week that I delete the NCB file. This is Visual Studio 2003. I do not see an NCB file in my project directory. I have tried deleting the ASP file but this has had no effect.
Thanks in advance,
Mark
|
|
|
|
|
|
I don't see a CLW file either. Perhaps that is the problem...
Mark
|
|
|
|
|
there is no .clw in VC++ 2003
|
|
|
|
|
I want to convert a string to LPWSTR to be used in RegOpenKeyEx.
i had been able to do it to the string directly i.e. L"xxx"
but unable to do it using string variable.
how can i do that please help.
|
|
|
|
|
|
If performance is not important, I think the easier alternative way is using of _bstr_t type. You can assign and you can get strings of both types:
_bstr_t s;
s = "abc";
s = L"abc";
char * a = s;
wchar_t * w = s;
So just try ::RegOpenKeyEx(..., _bstr_t(my_non_unicode_string), ...) .
Note that you can explicitly stipulate the version of RegOpenKeyEx function when your strings do not correspond to the project configuration settings. Just use RegOpenKeyExA or RegOpenKeyExW according to your needs.
|
|
|
|
|
So just try ::RegOpenKeyEx(..., _bstr_t(my_non_unicode_string), ...).
this does not work.. gives error at _bstr_t
please help
|
|
|
|
|
The _bstr_t type is defined in comutil.h, so you have to add:
#include <comutil.h>
If this is not enough and you get linker errors, probably you will have to add comsuppw.lib library to project settings (Linker --> Input --> Additional Dependencies).
|
|
|
|
|
i tried that and now it is giving me error: unable to convert from standard string to _bstr_t.
LONG retcode = RegOpenKeyEx(HKEY_CLASSES_ROOT,_bstr_t(ext.toStdString()), 0, KEY_ENUMERATE_SUB_KEYS, ®key);
tell me wat should I do. I am working on QT development env.(based on C++)
|
|
|
|
|
I suppose ext.toStdString() returns a std::string . In this case, you should try ext.toStdString().c_str() . Otherwise investigate which kind of value returns toStdString() .
|
|
|
|