Suriyan Suresh
Suriyan Suresh

Reputation: 3024

change application windows style

I start IE as a process and then i would like to change the following properties of a application.

  1. remove title bar, toolbar of a application(if IE)
  2. set top,left location and size through c#
  3. 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

Upvotes: 2

Views: 2325

Answers (4)

peSHIr
peSHIr

Reputation: 6360

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.

Upvotes: 1

user90843
user90843

Reputation:

remove title bar, toolbar of a process (if IE)

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:

SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd) & ~WS_CAPTION);

set top,left location and size through c#

SetWindowPos can do both

prevent process from minimizing...

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

Upvotes: 1

Zach Johnson
Zach Johnson

Reputation: 24232

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.)

Upvotes: 1

Mark
Mark

Reputation: 9428

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 :)

Upvotes: 1

Related Questions