Click here to Skip to main content
15,886,088 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello all:

I have an Application (written in VC++ MFC) that needs to play some media files, including MP4, JPEG, HTML only.
I thought the easiest way would be to activate the locally installed Applications that are associated with those file extensions, and ask those Apps to open my media files.
I then started using CreateProcess() to start those locally installed Apps, like Chrome or MediaPlayer and passed to them my media file name as cmd line parameters via the call to CreateProcess().

And I'm glad to say it works. My Files are played in sequence.

However, after calling the local Apps, and getting a process handle for them via my call to CreateProcess(), I would like to ask the Apps to perform other tasks such as change PageViewMode from Portrait to LandScape, or display in Maximised Mode, Or other interesting stuff.

So My question is,

1- after retrieving the Process Handle, can I use it to do anything useful at all, or can I just use it to call TerminateProcess() or CloseHandle() ?

2- If I want to ask these Apps to perform certain tasks, what options are available to me, and can i access their APIs easily ?

Your informed suggestions are welcome?

Many Thanks Rez.

What I have tried:

Nothing other than what I described above
Posted
Updated 3-Apr-19 4:12am
Comments
#realJSOP 3-Apr-19 9:44am    
"HTML" isn't generally considered a media file.
Member 13999828 3-Apr-19 9:46am    
Thank you for your informative input.
#realJSOP 3-Apr-19 9:53am    
I added actual informative input below. The statement you're responding to was more a comment regarding what you call "media".
Member 13999828 3-Apr-19 9:54am    
None of what you say is helpful.
But thanks anyhow
#realJSOP 3-Apr-19 10:17am    
Well, you wanted suggestions on how to do what you wanted to do, and I made all the suggestions I could think of. If you had already thought of those options, then having someone else suggest the same things would be an indication that you've already considered all of your options. Honestly, with the dirth of apps that can be installed on a given box, I think it would be nigh-on impossible to have support for every one.

Therefore, rolling your own minimalist app(s) to handle the various media types, and giving the user the chance to pick his own is your best approach, but only having been in the industry for 40 years, I may not have any useful insights for you.

See if there are associated commandline parameters, config files, or failing that, registry entries that you can change.

If there aren't any of those, your only recourse is to get the window handle and programatically, change the settings via the given app's UI (and not only is that ugly, but it might disturb the user to see crap happening on his screen without his involvment.

Your final option (and one that involves the most work, yet is probably your best approach) is to provide viewing functionality in your own app to do those things, or write your own suite of apps that you have more control over, that you can then run from your app.

If you end up rolling your own, you can include a disclaimer that the user may have a more pleasurable experience by running full-blown apps that are specific to the media type being viewed, and even provide a way for them to execute their default apps if they prefer to do so.
 
Share this answer
 
v5
1) Use WaitForInputIdle to wait until process has finished initialization.
2) The use EnumThreadWindows to enumerate all top level windows.

That should be enough to get started.
Start googling.
 
Share this answer
 
Comments
Member 13999828 3-Apr-19 10:30am    
If the process is a console application or does not have a message queue, WaitForInputIdle returns immediately. That is exactly what i found with Chrome and most other Apps.
get Googlin
What @realJSOP says is perfectly valid and helpful.

You can fullscreen WMP from the command line. And you can add such parameters in CreateProcess()

Fullscreen like so:
Command Line Parameters - Windows applications | Microsoft Docs[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900