Hello all, The child-thread ends (I trace and find it calls "endthreadex()"). But why in the parent thread, after the childthread ends, the function GetExitCodeThread(ChildThreadHandle, ...) returns TRUE, and the ExitCode = "STILL_ACTIVE" ? Does the child-thread really end ? If it not, why? The function WaitForSingleObject() which waits the child-thread to end also can't return. Thanks a lot
Jin Yao
Posts
-
The state of child-thread is always STILL_ACTIVE -
How to use DrawCaption() to draw a window captionHello all, Who can give me a sample about how to use DrawCaption(). eg: There is a dialog without default caption as it being created. I want to draw it with the text "MY DIALOG" by calling DrawCaption(). But which paramenter in this function can obtain the text "MY DIALOG" ? Thanks a lot
-
How to notify one thread to terminateThanks Dudi, I get an idea now.
-
How to notify one thread to terminateHello all, I want to notify thread1 to end by itself. I don't like to use the function TerminateThread() to do this job. But thread1 is a worker thread not a UI thread so it doesn't have a message queue. I can't send some messages to it. How can I do? Thanks a lot
-
CoGetClassObject( ) and Shell extensionHello all, In my shell extension dll, there are some codes like that (call another COM component): ...... hr = CoGetClassObject(CLSID_Class1, CLSCTX_ALL, NULL, IID_IClassFactory, (void**)&pcf); (now hr = S_OK) hr = pcf->CreateInstance(NULL, IID_Interface1, (void**)&pi); (ERROR: "Can't find the registered interface") CLSID_Class1 is also a COM component written by myself and I've written a simple exe app to test this component and find it runs ok. So it means the GUIDs have been registered in the registry successfully and the component itself is correct. Why the shell extension dll calls the CLSID_Class1 component will be fail but the exe application calls it successfully? Both the shell extension COM and CLSID_Class COM are all "Apartment" thread model. Thanks a lot
-
WaitForMultipleObjects( ) and thread objectAt the first time, thread1 terminates and WaitForMultipleObjects() returns the WAIT_OBJECT_0 + 0. The state of thread1 object is set to signaled. When the thread2 ends, the thread2 object will also be set to signaled. but at that time, the state of thread1 object is already signaled. So WaitForMultipleObjects() still returns the WAIT_OBJECT_0 + 0 not WAIT_OBJECT_0 + 1. I wish WaitForMultipleObjects() can return the WAIT_OBJECT_0 + 1 when thread2 ends. Thanks
-
WaitForMultipleObjects( ) and thread objectFor example: ..... // Create 2 threads and save their handles to hThread1, hThread2 rgHandles[0] = hThread1; rgHandles[1] = hThread2; while (TRUE) { dwIndex = ::WaitForMultipleObjects(2, rgHandles, FALSE, INFINITE); dwIndex -= WAIT_OBJECT_0; ...... // farther process at here } When the thread1 is terminated, the state of thread1 is set to signaled, then WaitForMultipleObjects() returns the index 0 of the array. But when the thread2 is terminated, the WaitForMultipleObjects() still returns the index 0 not index 1. I want WaitForMultipleObjects() to return the correct index, so I can process for this terminated thread. who can help me? Thanks a lot
-
How to implement the NTLM authorizationHello all, I'm writing a tool which must provide the function of sending data to some hosts in the internet via our company's http proxy. The proxy uses the NTLM authorization rule. I don't want to use the winHTTP API because they control socket transfer. I'd like to control it by myself. Who can tell me which API (except WinHttpSetCredentials()) may help me to realize the NTLM authorization? Thanks a lot