Click here to Skip to main content
15,895,142 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: "_ _cplusplus" tag error? Not VC++6 compatible? Pin
Axonn Echysttas9-Mar-05 1:54
Axonn Echysttas9-Mar-05 1:54 
Generalcustomizing MS Word Menubar Pin
rjnl7-Mar-05 11:29
rjnl7-Mar-05 11:29 
GeneralRe: customizing MS Word Menubar Pin
Sujan Christo7-Mar-05 17:46
Sujan Christo7-Mar-05 17:46 
Generalusing GetOpenFileName in service Pin
TheGreatAndPowerfulOz7-Mar-05 11:22
TheGreatAndPowerfulOz7-Mar-05 11:22 
GeneralShellExecuteEx and WaitForSingleObject Pin
lulacapixaba7-Mar-05 10:51
lulacapixaba7-Mar-05 10:51 
GeneralRe: ShellExecuteEx and WaitForSingleObject Pin
TheGreatAndPowerfulOz7-Mar-05 11:33
TheGreatAndPowerfulOz7-Mar-05 11:33 
GeneralRe: ShellExecuteEx and WaitForSingleObject Pin
lulacapixaba7-Mar-05 22:38
lulacapixaba7-Mar-05 22:38 
GeneralRe: ShellExecuteEx and WaitForSingleObject Pin
TheGreatAndPowerfulOz8-Mar-05 3:32
TheGreatAndPowerfulOz8-Mar-05 3:32 
Yes, I understand the ease of using ShellExecuteEx. I would have made the same choice myself. I also read your other post about the fact that another instance of the application is already running and gets the file you are ShellExecuteEx-ing. I have some idea about how to go about finding out what application launches the file you are "viewing." For the .gif file you mentioned, you would look in the registry under HKEY_CLASSES_ROOT/giffile/shell/open/command and get the "default" value of that key. Then use FormatMessage to format the command string to run.

There are two problems with this, one you will notice that the executable is "rundll32.exe". This is a program used to launch applications implemented in a dll. This makes it impossible to know if another instance of the application is running. Two, even if you did know if another instance of the application were running how would you tell that application to view the file you want.

I think the approach you want to take is to not wait on the completion of whatever application gets launched by ShellExecuteEx. But rather put the files in the user's temporary files directory and let them clean the files up when they're done with them. Another option: when your application exits, give them the option (in an options dialog) of cleaning up the temporary files you created which is off by default -- this is the approach of most web browsers. To enable this approach use your own directory under the user's temp directory so that you only delete your temporary files. To get the user's temp directory look at SHGetFolderPath.

Hope this helps and good luck.
GeneralRe: ShellExecuteEx and WaitForSingleObject Pin
lulacapixaba8-Mar-05 4:08
lulacapixaba8-Mar-05 4:08 
Questionhow to detect system's idle state? Pin
Kamis7-Mar-05 9:45
Kamis7-Mar-05 9:45 
AnswerRe: how to detect system's idle state? Pin
David Crow7-Mar-05 10:42
David Crow7-Mar-05 10:42 
GeneralRe: how to detect system's idle state? Pin
Kamis7-Mar-05 11:03
Kamis7-Mar-05 11:03 
GeneralTabControl Dialog Pin
aman20067-Mar-05 7:12
aman20067-Mar-05 7:12 
Questionhow to display propertysheet tabs on left rather than on top? Pin
Amyvad7-Mar-05 6:21
Amyvad7-Mar-05 6:21 
AnswerRe: how to display propertysheet tabs on left rather than on top? Pin
David Crow7-Mar-05 10:44
David Crow7-Mar-05 10:44 
GeneralPrintout Bmp image Pin
Larsson7-Mar-05 6:10
Larsson7-Mar-05 6:10 
GeneralRe: Printout Bmp image Pin
Sujan Christo7-Mar-05 17:56
Sujan Christo7-Mar-05 17:56 
QuestionProblem with different size of dialog in resource editor to that on screen? Pin
RichardNN7-Mar-05 5:21
RichardNN7-Mar-05 5:21 
AnswerRe: Problem with different size of dialog in resource editor to that on screen? Pin
Maximilien7-Mar-05 5:44
Maximilien7-Mar-05 5:44 
GeneralRe: Problem with different size of dialog in resource editor to that on screen? Pin
RichardNN7-Mar-05 6:44
RichardNN7-Mar-05 6:44 
GeneralDevice Context Pin
Pazzuzu7-Mar-05 5:07
Pazzuzu7-Mar-05 5:07 
GeneralRe: Device Context Pin
Blake Miller7-Mar-05 10:39
Blake Miller7-Mar-05 10:39 
GeneralRe: Device Context Pin
Pazzuzu7-Mar-05 19:49
Pazzuzu7-Mar-05 19:49 
GeneralRe: Device Context Pin
Blake Miller8-Mar-05 4:26
Blake Miller8-Mar-05 4:26 
GeneralRe: Device Context Pin
Pazzuzu8-Mar-05 4:53
Pazzuzu8-Mar-05 4:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.