Click here to Skip to main content
15,917,321 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# how to get the directory and file names from a OPEN server Pin
CDBob200221-Oct-08 21:00
CDBob200221-Oct-08 21:00 
GeneralRe: C# how to get the directory and file names from a OPEN server Pin
Dave Kreskowiak22-Oct-08 5:44
mveDave Kreskowiak22-Oct-08 5:44 
GeneralRe: C# how to get the directory and file names from a OPEN server Pin
CDBob200222-Oct-08 9:01
CDBob200222-Oct-08 9:01 
GeneralRe: C# how to get the directory and file names from a OPEN server Pin
Dave Kreskowiak22-Oct-08 13:44
mveDave Kreskowiak22-Oct-08 13:44 
GeneralRe: C# how to get the directory and file names from a OPEN server Pin
CDBob200222-Oct-08 14:33
CDBob200222-Oct-08 14:33 
QuestionIdeas for writing an emulator around firmware update images Pin
Justin Weber21-Oct-08 13:08
Justin Weber21-Oct-08 13:08 
AnswerRe: Ideas for writing an emulator around firmware update images Pin
Simon P Stevens21-Oct-08 22:13
Simon P Stevens21-Oct-08 22:13 
QuestionControlling an External Applications Window from C# App. Pin
Shanep21-Oct-08 12:13
Shanep21-Oct-08 12:13 
Hi,

I'looking for a little help regarding Windows API from C#.

First, let me explain what I am trying to do.

I'm opening an external application (Internet Explorer) from a C# App, and I want the window to open maximized and then remove the ability from the user to Mnimize, Restore, Maximize, Move and Size the IE Window. It was easy enough to open the Windows in a Maximized state and then use Win API to modify the Window style not to have a Minimize and Maximize button. Here is the basic code I used...

const int GWL_STYLE = -16;
const int SW_HIDE = 0;
const int SW_SHOW = 5;

[DllImport("user32.dll")]
public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);

Process inet_pro = new Process();

   private void button1_Click(object sender, EventArgs e)
   {

       inet_pro.StartInfo.WorkingDirectory = @"C:\Program Files\Internet Explorer\";
       inet_pro.StartInfo.FileName = @"C:\Program Files\Internet Explorer\iexplore.exe";
       inet_pro.Start();
       inet_pro.WaitForInputIdle(1000);
       int newStyle = 0x15CC0000;
       Thread.Sleep(300);
       GetWindowLong(inet_pro.MainWindowHandle, GWL_STYLE);
       SetWindowLong(inet_pro.MainWindowHandle, GWL_STYLE, newStyle);
       ShowWindow(inet_pro.MainWindowHandle, SW_SHOW);

   }


This code sets the Window to a maximized state and removes the Maximize, Minimize and Restore buttons and also removes these abilities from the System Menu. But the problems I still have are...

1. Once you have set the style, the window is no longer locked in position e.g you can move it by dragging the windows titlebar.

2. The Window is sizeable, which it should not be if in true Maximized state.

I need to resolve these two key issues, and I was hopeing to do it with out having to implement any type of global hook, which relies on an external custom DLL. Any suggestions would be most appreciated?

Thanks
Shane
AnswerRe: Controlling an External Applications Window from C# App. Pin
Anthony Mushrow21-Oct-08 14:04
professionalAnthony Mushrow21-Oct-08 14:04 
GeneralRe: Controlling an External Applications Window from C# App. Pin
Shanep22-Oct-08 9:55
Shanep22-Oct-08 9:55 
Questionhave u seen these codes Pin
netJP12L21-Oct-08 10:00
netJP12L21-Oct-08 10:00 
AnswerRe: have u seen these codes Pin
Ennis Ray Lynch, Jr.21-Oct-08 10:13
Ennis Ray Lynch, Jr.21-Oct-08 10:13 
AnswerRe: have u seen these codes [modified] Pin
Mark Salsbery21-Oct-08 10:15
Mark Salsbery21-Oct-08 10:15 
GeneralRe: have u seen these codes Pin
Gideon Engelberth21-Oct-08 11:18
Gideon Engelberth21-Oct-08 11:18 
GeneralRe: have u seen these codes Pin
Mark Salsbery21-Oct-08 11:25
Mark Salsbery21-Oct-08 11:25 
AnswerRe: have u seen these codes Pin
harold aptroot21-Oct-08 13:40
harold aptroot21-Oct-08 13:40 
QuestionEnvironment.GetCommandLineArgs(); [modified] Pin
schiebel-t21-Oct-08 9:30
schiebel-t21-Oct-08 9:30 
AnswerRe: Environment.GetCommandLineArgs(); Pin
Dave Kreskowiak21-Oct-08 10:37
mveDave Kreskowiak21-Oct-08 10:37 
GeneralNtSuspendProcess (save a n00b) Pin
boberick221-Oct-08 9:20
boberick221-Oct-08 9:20 
GeneralRe: NtSuspendProcess (save a n00b) Pin
SeMartens21-Oct-08 9:45
SeMartens21-Oct-08 9:45 
QuestionbindingNavigator Pin
ahmadbakro21-Oct-08 8:22
ahmadbakro21-Oct-08 8:22 
QuestionObjForScrpt Pin
Christopher Hernandez21-Oct-08 5:37
Christopher Hernandez21-Oct-08 5:37 
AnswerRe: ObjForScrpt Pin
Simon P Stevens21-Oct-08 5:41
Simon P Stevens21-Oct-08 5:41 
GeneralRe: ObjForScrpt Pin
Christopher Hernandez22-Oct-08 9:09
Christopher Hernandez22-Oct-08 9:09 
GeneralRe: ObjForScrpt Pin
Pete O'Hanlon22-Oct-08 9:27
mvePete O'Hanlon22-Oct-08 9:27 

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.