更改应用程序窗口样式
我将 IE 作为一个进程启动,然后我想更改应用程序的以下属性。
- 删除应用程序的标题栏、工具栏(如果是 IE)
- 通过 C# 设置顶部、左侧位置和大小
防止进程最小化,我使用了以下代码,但没有运气(找到进程的句柄,然后将其传递)到下面的函数)
public void SetFormOnDesktop(int hwnd) { int hwndf = hwnd; IntPtr hwndParent = FindWindow("ProgMan", null); SetParent(hwndf, hwndParent); }
编辑1:
是否可以阻止 IE 上下文菜单并阻止其显示在任务栏上
I start IE as a process and then i would like to change the following properties of a application.
- remove title bar, toolbar of a application(if IE)
- set top,left location and size through c#
prevent process from minimizing , i have used the following code but had no luck(find the handle of the process and then pass it to below function)
public void SetFormOnDesktop(int hwnd) { int hwndf = hwnd; IntPtr hwndParent = FindWindow("ProgMan", null); SetParent(hwndf, hwndParent); }
EDIT 1:
Is it possible to prevent IE context menu and prevent it from showing on taskbar
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这里的术语不太正确。标题栏或工具栏属于一个窗口,而不是一个进程。窗口“属于”进程,因为进程可以调用 CreateWindow。
现在,要删除标题栏,请从窗口中删除 WS_CAPTION 样式,为此,您可以使用 GWL_STYLE 标志调用 SetWindowLong 并使用波形符运算符将其删除:
SetWindowPos 两者皆可
窗口,而不是进程,你不能,你可以从标题栏中删除控件,但是如果你想要的话,这也会删除最大化和关闭查找 WS_SYSMENU
The terminology is not quite right here. A title bar or a toolbar belongs to a window, not a process. And a window "belongs" to a process, in the sense that a process can call CreateWindow.
Now, to remove the title bar remove the WS_CAPTION style from the window, to do so you can call SetWindowLong with the GWL_STYLE flag and use the tilde operator to remove it:
SetWindowPos can do both
window, not process, you can't, well you can kind of remove the controls from the title bar, but that removes maximize and close as well, if you want that look for WS_SYSMENU
听起来您想使用 Internet Explorer 的 Kiosk 模式,它提供全屏、无工具栏、非- 可最小化的窗口。
请检查前面的链接以获取更多信息,然后,呃,给我投票:)
Sounds like you want to use Internet Explorer's Kiosk Mode, which provides a full screen, toolbarless, non-minimizable window.
Please check the preceeding link for more information and, er, vote me up :)
这是一个 SO 答案 我放弃了改变窗口的样式。 (它是用 VB.NET 编写的,所以你必须翻译,但它应该可以帮助你理解这个想法。)
Here's an SO answer I gave on changing the style of a window. (It's in VB.NET so you'll have to translate, but it should help you get the idea.)
只是想一想:如果您不将 IE 作为单独的进程启动(基本上是:打开浏览器并将其完全释放到您的控制之外),而是在您控制的 C# 应用程序中使用一个表单(大小、位置、否),会有帮助吗?标题栏,不允许最小化 - 带有(只是?) WebBrowser 控件就可以了吗?无论如何,WebBrowser 基本上只是 IE,但作为表单上的控件,您可以(几乎)完全控制它。
Just a thought: would it help if you did not start IE as a separate process (basically: opening a browser and releasing it out of your control completely), but use a form in your C# application that you control - size, location, no title bar, no minimizing allowed - with (just?) a WebBrowser control on it? The WebBrowser is basically just IE anyway but then as a control on your form, that you have (near) total control over.