|
Always initialize your main thread with AfxOleInit and it is not recommended at all to use CoInitializeEx(NULL, COINIT_MULTITHREADED) on your main GUI thread.
|
|
|
|
|
Thank you for your help.But use AfxOleInit instead CoInitializeEx(NULL, COINIT_MULTITHREADED) ,the program can not work ! some component CreateInstace fail .
Only can instead CoInitialize(Null).
please help me again!!
|
|
|
|
|
Is there a simple way of deciding when threads are better than not having them at all if optimisation is the goal?
Thanks all!
Kindest regards,
wilche
|
|
|
|
|
I have one rule, if the task may be long or asynchronous operation -> thread [yes]
if short task -> thread [no]
One good thing about getting older, you don't lose the ages you've been!
|
|
|
|
|
Hi,
I just wondered if anybody knew of any good example source code out there for file packers. I essentially just want to write a program that packs various files into one .dat (or whatever) file, which can then be unpacked and repacked on the fly.
Many thanks for any links/suggestions,
Keith
|
|
|
|
|
Keith,
See these articles:/ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I have a class here that packs multiple files into a single file. And allows you to get back the files from the archive. No compression though. It's called CFileTar but is not to be confused with the Unix tar program or format.
http://www.codeproject.com/useritems/cfiletar01.asp
Regards
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Buy it, read it and admire me
|
|
|
|
|
Hey,
I need to programatically retrieve the exact file version number of RICHED20.DLL (such as "5.30.23.1205") and the control version (2, 2.1 or 3)
How can I do that?
I couldn't find the solution in MSDN Library.
Thanks in advance.
|
|
|
|
|
Have you tried loading the VERSIONINFO stuff from the DLL's resources?
Peace!
-=- James.
"Some People Know How To Drive, Others Just Know How To Operate A Car."
(Try Check Favorites Sometime!)
|
|
|
|
|
Hi!
I would like to insert a copy of a string table resource into a VC++ project like i've done with several dialog box resources. But i can't find the input text "Condition" in the resource properties.
Is it possible to make a copy of a string table resource with conditions?
Thks in advance!
Appstmd
|
|
|
|
|
Why does that prevent you from copying the string table itself, or entries within it? You should be able to cut-n-paste between string tables freely.
Peace!
-=- James.
"Some People Know How To Drive, Others Just Know How To Operate A Car."
(Try Check Favorites Sometime!)
|
|
|
|
|
Recently, I wrote on message board, that I had problem PostThreadMessage.
It did not post to the thread as expected, but GetLastError did not indicate that an error has occurred.
The bug disappear when I used:
Sleep(20);
to force it sleep for 20 ms. But when I tested it using larger test data, the same problem occurred, even more serious then before. Furthermore the performance eroded to point that it was better off not using threads.
In both cases, resources was critically reduced.
The "apparent" culprit was that the low resources. As the rate messages entering the message queue was higher than it's removal through processing, net increase in queue. Each message can contain significant amounts of data (up to 20k) and hence low resources. I have checked carefully there is no memory leakage so this was the only conclusion I could draw.
Closer study also showed that SendMessage also failed under these circumstances.
What I want to ask,
1, Has anyone else had this sort of problem?
2, Is my conclusion correct?
3, Is there a fix for this?
Thank you! Any reply is greatly appreciated
Kind regards,
wilche
The more simple things are, the more complex is the way it works.
The more complex things are, there is probably a simpler solution.
|
|
|
|
|
wilche wrote:
PostThreadMessage.
It did not post to the thread as expected, but GetLastError did not indicate that an error has occurred.
Does the thread in question has it's message queue created. That is does it call any of GetMessage, PeekMessage etc. functions before you call PostThreadMessage from other threads. That might be the problem.
|
|
|
|
|
Sorry my fault,
I have made sure that the message queue has been created properly.
This is because the messages inside the queue were correctly being processed.
Thanks for picking this up!
wilche
|
|
|
|
|
Hi,
this was a release build after the code had successfully compiled in debug mode .
nafxcw.lib(winctrl5.obj) : error LNK2005: "public: virtual struct CRuntimeClass * __thiscall CDateTimeCtrl::GetRuntimeClass(void)const " (?GetRuntimeClass@CDateTimeCtrl@@UBEPAUCRuntimeClass@@XZ) already defined in TreeOptionsCtrl.obj
nafxcw.lib(winctrl5.obj) : error LNK2005: "public: static struct CRuntimeClass const CDateTimeCtrl::classCDateTimeCtrl" (?classCDateTimeCtrl@CDateTimeCtrl@@2UCRuntimeClass@@B) already defined in TreeOptionsCtrl.obj
Do you have an idea what actually the problem is?
Thanks
R.
|
|
|
|
|
How does TreeOptionsControl.cpp look like. Does it by any chance has a definition of CDateTimeCtrl like IMPLEMENT_DYNAMIC(CDateTimeCtrl) or in any of the headers it includes?
|
|
|
|
|
TreeOptionsCtrl is from this site (PJ Naughter).
It has definitely IMPLEMENT_DYNAMIC(CDateTimeCtrl, CWnd) in TreeOptionsCtrl.cpp
|
|
|
|
|
...and compiles fine without.
Thanks very much
|
|
|
|
|
Hi,
Does anybody know how to associate some file types with a specific application so I can open those files by double clicking them from the Explorer? Can I use the following functions?
EnableShellOpen();
RegisterShellFileTypes(true);
Even if these two functions can be used for this, how can I add my file types to the CSingleDocTemplate(since I am using Single document in my application)?
Thanks!
|
|
|
|
|
I am attempting to use the valarray STL in an MFC app, but I get a compiler error immediately from within the valarray include. I am copying the code sample provided on MSDN at the following location:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcstdlib/html/vclrf_valarray_pow.asp
In particular, the compiler states that "there are not enough parameters in the Min/Max macros"; with just the include file, no code at all! So, MFC can't even build the include!
I am trying to build an RMS average function for a number of points and it would be great if I could use the speed optimization built into the valarray.
If I build the example code from above within a console app, it works well without any errors and it functions also....
Is there something within MFC that is predefining these macros that interferes with the valarray include?
Can this be done as a library function so that I could reference the class that I am attempting to build?
Thanks in advance for any help,
Dave Leikis
|
|
|
|
|
I guess this is a problem having to do with <windows.h> and the STL headers defining differently min and max . Try #undef ining min and max before including the header for valarray .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
|
|
How do i set the parent window as parent to the dialog? In the CreateDialog, i give it a parent window, but i can still use the parent window even when the dialog isn't closed.
|
|
|
|
|
Now this is turning into a game
|
|
|
|