|
I would first like to thank you for reading this post. I am completly new to Visual C++ Programming . I have no programming experiance. I want to learn C programming. I use the Visual C++ Program from Visual Studios. What I need is a webpage that has a tutorial for complete beginners like me that can help me start. Thanks again for reading this. So please if you know a good tutorial for complete beginners post it here, I appreciate the help, thanks!
The serious newbie programmer.
|
|
|
|
|
|
Hi
all,
How can i put The Application Icon in system tray.
Thanks in Advance
|
|
|
|
|
|
|
Thanks For both replies I am trying these and i will comeback with good result......
|
|
|
|
|
Hi,
I have a worker thread doing a lengthy operation during which it reads data using ReadFile. If I try to abort the operation and call AfxEndThread ReadFile tries to read data until the time limit is reached. Is it possible to stop ReadFile or is there a better way to wait for it to finish than Sleep? The problem with Sleep is that I can't set those time limits myself and I can't be sure how long they are.
-Janetta
|
|
|
|
|
Janetta,
I am a bit confused about the scenario you described. Your worker thread calls first ReadFile(), then AfxEndThread() but ReadFile() continues to execute
Are we talking about one or two threads here? If we are talking about one thread, you are using overlapped IO. In this case you could cancle the IO with CancleIO().
If we are talking about two threads, you misunderstood the function of AfxEndhread(). It could be called only from inside the thread that wants to end and it is not possible to end a foreign thread this way. (Ending a foreign thread would be possible with TerminatThread(), however, using TerminateThread() is a big no-no!)
Or am I completly on the wrong path?
--
Daniel Lohmann
http://www.losoft.de
(Hey, this page is worth looking! You can find some free and handy NT tools there )
|
|
|
|
|
Actually the first option was what I thought I was doing...
I'm trying to make it possible to abort that lengthy operation. A message is posted to the worker thread and I thought that it would call a method of the worker thread that calls AfxEndThread. Posting the message succeedes, but the EndThread method is never called. Is this because the thread is busy performing that lengthy operation and when it is done, the thread is ended?
What would be a better way to do this?
-Janetta
|
|
|
|
|
Well, I desided to use TerminateThread, even though it is no-no. In this case it can't really make any damage.
-Janetta
|
|
|
|
|
A better solution would be to use non-blocking file io (overlapped IO) and wait for the ReadFile() operation in a loop that calls MsgWaitForSingleObject() so outstanding messages are also processed. If you get the message for "end the thing" you cancle the IO via CancelIo() and then just terminate the thread.
However, if you are sure that TerminateThread() is acceptable here, it may be the quick, easy and really dirty solution for your problem
--
Daniel Lohmann
http://www.losoft.de
(Hey, this page is worth looking! You can find some free and handy NT tools there )
|
|
|
|
|
Daniel Lohmann wrote:
A better solution would be to use non-blocking file io (overlapped IO) and wait for the ReadFile() operation in a loop that calls MsgWaitForSingleObject() so outstanding messages are also processed.
Unfortunately I can't do that, because I can't touch the code that is doing the reading.
I'll use TerminateThread and keep my fingers crossed
-Janetta
|
|
|
|
|
Dont use TerminateThread or something like that...
You must use a semaphore
The semaphore is used to tell the thread that it must exit
the thread must test the state of the semaphore in the ReadFile while
and exit if the semaphore tells it to
Casa.Sapo.pt
|
|
|
|
|
hello,
I want to ask how to display colour fonts on CView?
|
|
|
|
|
|
OIC!!! THX YOU VERY MUCH!!!
|
|
|
|
|
Does anybody have examples on exporting templates from an extension DLL:
For instance, the following code does not work:
template <class T> class AFX_EXT_CLASS CDummyClass
{
...
};
Help !
Jonathan de Halleux, Belgium.
|
|
|
|
|
Since templates are resolved at compile time it is not possible to put template-based classes or functions into a DLL. For example, that's why there is no DLL version of the STL. Usually template classes are implemented in header files. You could implement a generic non-template class in a DLL and use this class to write template-based classes in header files.
Look! They have the Internet on computers now! (Homer J. Simpson)
|
|
|
|
|
thank you for the advice.
Jonathan de Halleux, Belgium.
|
|
|
|
|
Hi,
i am looking for a menu/list control as you know from Outlook.
Outlook has on the left side a dark gray menu control. I tried
to find such a control to download, but wasn't successful.
Do you know where to find such a control?
Thanks,
Dominik
|
|
|
|
|
|
Thank you very much!!!
Exactly what i needed!
I only looked in the controls section of CodeProject, but never looked in the WTL section.
Thanks again!
Dominik
|
|
|
|
|
Having just resolved my plugin problems I now face the challenge of allowing my plugins to manipulate the data in my MFC app's CDocument derived class.
This I have done by passing a pointer to my derived doc class to the dll, and everything works fine. The plugin is able to create data in the doc.
However, when the doc deletes its data (OnNew... etc) I get a fatal exception. The object it is trying to delete is valid and does exist - however I beleive that it has been allocated from a different heap (the dll's) meaning the app/doc cannot unallocate it from it's own.
My dll "creates" data through the document itself..
...
pDoc->CreateVertex() ;
...
so why isn't the construction taking place from the "document" heap? I guess it always takes place in the local heap?
I could resolve this by getting the dll to track every single thing it creates and releasing it all on destruction, but that is far too clumsy.
This must be resolvable - otherwise no-one would have every been able to code plugins with MFC apps...
Any ideas?
|
|
|
|
|
Try using AFX_MANAGE_STATE in every function that uses MFC. Usually just put AFX_MANAGE_STATE(AfxGetStaticModuleState()) as the first line in every function.
Look! They have the Internet on computers now! (Homer J. Simpson)
|
|
|
|
|
Already am - this isn't the problem.
(at least afaik! )
|
|
|
|