Thanks to everyone who provided a recommendation. --Julberto
Julberto Danray
Posts
-
Can anyone recommend a good C#/.NET tutorial for an MFC old hand? -
Can anyone recommend a good C#/.NET tutorial for an MFC old hand?Hi all, Can anyone recommend a good C#/.NET tutorial (online or print) for an old MFC guy? I have been programming C++/MFC for a long while and the time has come for me to bite the bullet and switch to C#/.NET. Maybe it would be a good idea for The Code Project to have a contest for such a tutorial. Maybe it already exists but I don't know where it is. Thanks in advance, Julberto
-
Call of OnCreate in a CTreeCtrl derived classI'm assuming the the control is being subclassed via SubclassDlgItem() or DDX_Control(). In either case PreSubClassWindow() will be called. This is a very convenient way to initialize your subclassed controls because it does not require any special treatment from the dialog that contains the control. Julberto
-
Call of OnCreate in a CTreeCtrl derived classmadmax0001, There is yet a third option for you. You can override the virtual function PreSubclassWindow() in your CTreeCtrl-derived class. You can do you initialization there. Julberto
-
Looking for a good PDF writerRichard, Thanks for the information. The information you provided is good and practical. I'll give it a try. Thanks again buddy, Julberto
-
Looking for a good PDF writerRichard, Have you used it? Do you like it? I need something trouble-free. Julberto
-
Looking for a good PDF writerI wonder if anyone can recommend a good pdf writer. I need to produce pdf files of some word processing documents, spreadsheets, etc. and Adobe Acrobat is just too expensive ($300). Google searches on "pdf writer" show a bunch of apps that seem to do the job. Has anyone used any of these apps? Can anyone recommend a good (an inexpensive) one? Julberto
-
function timeCheck
::GetSystemTimeAsFileTime()
in the MSDN library. -
Semaphore countThanks for the links to the article and books. I'll look into them. By the way, it is important to me to know when all threads are done so the code can proceed to release resources. The background threads are somewhat short-lived since they just generate a synthetic HTML page and send it to the requesting client. The foreground thread waits until all background threads (if any) are done and then deletes the server object. Julberto
-
Semaphore countThat's a good idea but I want to emphasize that the motivation to determine the number of active threads via the semaphore handle is to simplify the code. The mechanism I'm currently using gets the job done. However, complexity is the enemy of good code. A solution based on a GetSemaphoreCount-like function would be not only simple and elegant but very understandable to anyone maintainig the code. For the time being it is likely that I will continue to use the method descrived in my original post. Julberto
-
Semaphore countDoes anyone know how to determine the current count associated with a semaphore? Let me explain. I have a server app that creates a background thread every time a client app makes a request. Before each background thread is created my app goes through ::WaitForSingleObject(m_hSemaphore, INFINITE) to ensure that I do not exceed a safe number of concurrent threads. When the background thread finishes its work, it calls ::ReleaseSemaphore(m_hSemaphore, 1, NULL) to balance the semaphore count. There are times that I need to wait for all background threads to end (for example when the program ends). If I could check for the current semaphore count, I would know how many background threads are still running. Currently I'm keeping a counter (protected with a critical section) that is incremented when the background thread starts and decremented when it ends. This works but it seems somewhat silly since this information is implicit in the semaphore object. There is yet another possibility, The 3rd argument of ::ReleaseSemaphore() is a pointer to a LONG that receives the previous count. However, it seems to me that there is a problem here since you have several threads writing to this LONG at about the same time without any thread synchronization mechanism. Semanticaly, I need something like ::GetSemaphoreCount(m_hSemaphore). So far as I know such function does not exist. Thanks, Julberto Danray