I forgot to mention that if you want to start the external process in a suspended state, you can call CreateProcess() with a special flag called CREATE_SUSPENDED, and the process will be loaded, but will not run until you resume each of its threads.
I have to look into that. With Pause and Resume I noticed how much I could have used PROCESS_INFORMATION. I could have skipped thread list traverse with SuspendThread(pi.dwThreadId),if I am not mistaken
You know while I was investigating this I have thought about switching back to CreateProcess base on what I read. Before, I had gone back and forth between CreateProcess and ShellExecuteEx (at one point I had two launch functions). But ultimately I stuck with the one that allows me to use lpOperation, open associated program automatically and open url using default application. Also I was influence by An Introduction to Processes: Asynchronous Process Notification[^], where Microsoft recommend the use of ShellExecute.
Now if there is someway for CreateProcess to use lpOperation that would be nice. OR have ShellExecuteEx populate PROCESS_INFORMATION.
I always wonder why there isn't a function that encapsulate both strengths.
I'd like to use a transparent PNG image as the background of a top level window (WS_POPUP).
Using GDI+ I have the image displayed correctly, but the problem is the transparent area (eg what is under my window) is not refreshed when I move the window.
I have already tried to use the WS_EX_LAYERED style and the UpdateLayeredWindow function to get the image displayed and it works fine. But the problem is I want to add child controls to my window and with this approach they are not rendered.
Well, if you use layered windows you have to draw (and possible also handle) controls yourself. As far as i know there's no safe, reliable way to do what you want to do (i mean the way you are trying to do it). An alternative can be using Window regions[^], you can use these with windows displaying normal controls BUT this does not give you a nice look, it just lets you clip the window to some shape, but you can't nicely antialias the window for example. Another way would be combining a layered window and a non-layered window. The layered part would contain the transparent parts and the non-layered part would contain the controls, you would need to keep the Z-Order and visibility state synchrnoized between the two types of windows. It is probably a pain in the ass to implement correctly but it can be done.
> The problem with computers is that they do what you tell them to do and not what you want them to do. < > Sometimes you just have to hate coding to do it well. <
Just to clarify things up, here is what the window looks like: http://img52.imageshack.us/img52/3956/81503777.jpg
And here is what happens when I move the window over the desktop: http://img186.imageshack.us/img186/7079/96798366.jpg
What do you think would be the best way to display this kind of window (transparent background image + controls)?
I want to write a small mfc dialog based program to test the functionality which the third-party library provides.
The flow of test program is simple. I made some buttons on the program.
When I pressed button A, then execute the action A. Pressed button B, then execute the action B...etc.
According to the library document, each action usually contains 3~5 steps.
Each step must call some functions which are provided by the library.
The document said some functions will use PostThreadMessage() to send some specific library-defined message within a specific time.
If the program doesn't receive library-defined message within a specific time, regard it as timeout.
And the frequency of this type function is often, not a little.
But now I don't know how to do this timeout functionality properly.
For now, I used a for loop and difftime() to check the time period repeatedly and didn't create any new thread in my program.
In the for loop, I use GetMessage(&MSG, 0, 0, 0) to receive the message which library function sent.
Although the library function can't work (because the library relies on a specific machine, and the machine doesn't connect to my pc),
I think that it's enough to test the timeout functionality.
But the test result seemed that it didn't work correctly. I use a MessageBox() which is outside the for loop.
And the message box always was showed later than the time I set.
Another problem is if I pressed the button to start the timeout functionality then press the OK or CANCEL button earlier than the timeout
message box, the program will disappear but still resides in the task manager...
(Even if I add OnDestroy() to call DestroyWindow(), the result is same)
So I thought the method which I use now is correct or not. But even it is the incorrect method, I don't know what the proper method is...
So does anyone can give me some suggestions, helpful references, related samples or why my program failed ?
Thank you very much.
Last Visit: 28-Nov-20 10:48 Last Update: 28-Nov-20 10:48