Createprocess()现在是什么? [英] Createprocess() now what?

查看:59
本文介绍了Createprocess()现在是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好:



我有一个应用程序(用VC ++ MFC编写),需要播放一些媒体文件,包括MP4,JPEG,HTML。

我认为最简单的方法是激活与这些文件扩展名相关联的本地安装的应用程序,并要求这些应用程序打开我的媒体文件。

然后我开始使用CreateProcess ()启动那些本地安装的应用程序,如Chrome或MediaPlayer,并通过调用CreateProcess()将我的媒体文件名作为cmd行参数传递给他们。



And我很高兴说它有效。我的文件按顺序播放。



然而,在调用本地应用程序并通过调用CreateProcess()获取进程句柄后,我想要求应用程序执行其他任务,例如将PageViewMode从Portrait更改为LandScape,或以最大化模式显示,或其他有趣的东西。



所以我的问题是,

1- br />


2-如果我想要求这些应用程序执行某些任务,我可以使用哪些选项,我可以轻松访问他们的API吗?



欢迎您提出明智的建议?



非常感谢Rez。



我尝试过的事情:



除了上面描述的内容之外没什么别的

解决方案

查看是否有相关命令您可以更改的行参数,配置文件或失败的注册表项。



如果没有这些,您唯一的办法是获取窗口处理和编程,通过给定的应用程序的UI更改设置(不仅是丑陋的,但它可能会打扰用户看到他的屏幕上没有他的介入事件发生垃圾。



您的最终选择(以及涉及最多工作,但可能是您最好的方法)是在您自己的应用程序中提供查看功能来执行这些操作,或者编写您自己可以控制的应用程序套件,您可以从您的应用程序运行。



如果你最终自己滚动,你可以包括一个免责声明,用户可以通过完整运行获得更愉快的体验 - 特定于正在查看的媒体类型的吹制应用程序,甚至为他们提供了一种方法,如果他们愿意,可以执行他们的默认应用程序。


1)使用Wa itForInputIdle等待进程完成初始化。

2)使用EnumThreadWindows枚举所有顶级窗口。



这应该足够了开始。

开始google搜索。


@realJSOP所说的是完全有效的和有用的



您可以从命令行全屏显示WMP。你可以在 CreateProcess()中添加这些参数



全屏如下:

命令行参数 - Windows应用程序| Microsoft Docs [ ^ ]

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

解决方案

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.


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.


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[^]


这篇关于Createprocess()现在是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆