bringing Pocket Internet Explorer (PIE) to foreground

G

Guest

Hopefully a trivial question -
I have a C# PocketPC 2003 Windows Forms application running under ARMv4.
I want to have the application put itself in the background and bring PIE to
the foreground. PIE is already loading, and can be seen in "Running Programs".

I tried the famous code example where I substituted out "HHTaskBar" for PIE

static public void showTaskBar ()
{
int h = FindWindow ("HHTaskBar", "");
ShowWindow (h, SW_SHOW);
}


[DllImport("coredll.dll")]
public static extern int FindWindow (string lpClassName, string
lpWindowName);
private const int SW_HIDE = 0x0000;
private const int SW_SHOW = 0x0001;

[DllImport("coredll.dll")]
public static extern int ShowWindow (int hwnd, int nTaskShow);

[DllImport("coredll.dll")]
public static extern int MoveWindow (IntPtr hwnd, int X, int Y, int
nWidth, int nHeight, bool bRepaint);
}

My code for show is -
static public void showPIE ()
{
int h = FindWindow ("IEFrame", "");
// int h = FindWindow ("iexplore", "");
// int h = FindWindow ("Internet Explorer", "");
ShowWindow (h, SW_SHOW);
}

However, PIE is not brought to the foreground.

As the commented lines in "showPIE" hint, I tried various names for PIE -
"Internet Explorer" appears in the list of "Running Programs",
"iexplore.exe" is the name of the executable in the PocketPC Windows
directory,
and I saw a web posting that hinted that "IEFrame" might work.

In any of the three cases, the integer h in "showPIE" is bound to "0".

What do I need to change?

Also - No offence intended, but I have a mild preference *not* to have to
use a 3rd-party library such as opennetcf.org
 
P

Peter Foot [MVP]

Since the first argument of FindWindow is the classname and the second is
the window title try

int h = FindWindow(null, "Internet Explorer");

Peter
 
G

Guest

Peter,
Thanks for the swift reply! (I should pay closer attention to the method
signature ;)

When I tried
int h = FindWindow (null, "Internet Explorer");
h is now bound to the integer 941872, which is hopeful.
Unfortunately, the PIE window did not come to the foreground on the ASUS
MyPal PocketPC.

Any other hints?

-Rich

Peter Foot said:
Since the first argument of FindWindow is the classname and the second is
the window title try

int h = FindWindow(null, "Internet Explorer");

Peter

--
Peter Foot
Windows Embedded MVP
www.inthehand.com | www.opennetcf.org

Rich said:
Hopefully a trivial question -
I have a C# PocketPC 2003 Windows Forms application running under ARMv4.
I want to have the application put itself in the background and bring PIE
to
the foreground. PIE is already loading, and can be seen in "Running
Programs".

I tried the famous code example where I substituted out "HHTaskBar" for
PIE

static public void showTaskBar ()
{
int h = FindWindow ("HHTaskBar", "");
ShowWindow (h, SW_SHOW);
}


[DllImport("coredll.dll")]
public static extern int FindWindow (string lpClassName, string
lpWindowName);
private const int SW_HIDE = 0x0000;
private const int SW_SHOW = 0x0001;

[DllImport("coredll.dll")]
public static extern int ShowWindow (int hwnd, int nTaskShow);

[DllImport("coredll.dll")]
public static extern int MoveWindow (IntPtr hwnd, int X, int Y, int
nWidth, int nHeight, bool bRepaint);
}

My code for show is -
static public void showPIE ()
{
int h = FindWindow ("IEFrame", "");
// int h = FindWindow ("iexplore", "");
// int h = FindWindow ("Internet Explorer", "");
ShowWindow (h, SW_SHOW);
}

However, PIE is not brought to the foreground.

As the commented lines in "showPIE" hint, I tried various names for PIE -
"Internet Explorer" appears in the list of "Running Programs",
"iexplore.exe" is the name of the executable in the PocketPC Windows
directory,
and I saw a web posting that hinted that "IEFrame" might work.

In any of the three cases, the integer h in "showPIE" is bound to "0".

What do I need to change?

Also - No offence intended, but I have a mild preference *not* to have to
use a 3rd-party library such as opennetcf.org
 
P

Peter Foot [MVP]

Have you tried calling SetForegroundWindow with this handle:-
http://blog.opennetcf.org/pfoot/PermaLink.aspx?guid=a4bca0e4-439b-411a-87cd-0950e9d16b10

Peter

--
Peter Foot
Windows Embedded MVP
www.inthehand.com | www.opennetcf.org

Rich said:
Peter,
Thanks for the swift reply! (I should pay closer attention to the method
signature ;)

When I tried
int h = FindWindow (null, "Internet Explorer");
h is now bound to the integer 941872, which is hopeful.
Unfortunately, the PIE window did not come to the foreground on the ASUS
MyPal PocketPC.

Any other hints?

-Rich

Peter Foot said:
Since the first argument of FindWindow is the classname and the second is
the window title try

int h = FindWindow(null, "Internet Explorer");

Peter

--
Peter Foot
Windows Embedded MVP
www.inthehand.com | www.opennetcf.org

Rich said:
Hopefully a trivial question -
I have a C# PocketPC 2003 Windows Forms application running under
ARMv4.
I want to have the application put itself in the background and bring
PIE
to
the foreground. PIE is already loading, and can be seen in "Running
Programs".

I tried the famous code example where I substituted out "HHTaskBar" for
PIE

static public void showTaskBar ()
{
int h = FindWindow ("HHTaskBar", "");
ShowWindow (h, SW_SHOW);
}


[DllImport("coredll.dll")]
public static extern int FindWindow (string lpClassName, string
lpWindowName);
private const int SW_HIDE = 0x0000;
private const int SW_SHOW = 0x0001;

[DllImport("coredll.dll")]
public static extern int ShowWindow (int hwnd, int nTaskShow);

[DllImport("coredll.dll")]
public static extern int MoveWindow (IntPtr hwnd, int X, int Y, int
nWidth, int nHeight, bool bRepaint);
}

My code for show is -
static public void showPIE ()
{
int h = FindWindow ("IEFrame", "");
// int h = FindWindow ("iexplore", "");
// int h = FindWindow ("Internet Explorer", "");
ShowWindow (h, SW_SHOW);
}

However, PIE is not brought to the foreground.

As the commented lines in "showPIE" hint, I tried various names for
PIE -
"Internet Explorer" appears in the list of "Running Programs",
"iexplore.exe" is the name of the executable in the PocketPC Windows
directory,
and I saw a web posting that hinted that "IEFrame" might work.

In any of the three cases, the integer h in "showPIE" is bound to "0".

What do I need to change?

Also - No offence intended, but I have a mild preference *not* to have
to
use a 3rd-party library such as opennetcf.org
 
G

Guest

Peter,
I was out for most of the day, and am just reading your reply.
I am not sure I understand.
If I call "SetForegroundWindow", which takes no arguments, from my PocketPC
application, how will it effect the PIE window? Is it assumed that the mouse
has captured the background PIE window with the call to "ShowWindow"? Sorry
for being a bit dense...
-Rich

Peter Foot said:
Have you tried calling SetForegroundWindow with this handle:-
http://blog.opennetcf.org/pfoot/PermaLink.aspx?guid=a4bca0e4-439b-411a-87cd-0950e9d16b10

Peter

--
Peter Foot
Windows Embedded MVP
www.inthehand.com | www.opennetcf.org

Rich said:
Peter,
Thanks for the swift reply! (I should pay closer attention to the method
signature ;)

When I tried
int h = FindWindow (null, "Internet Explorer");
h is now bound to the integer 941872, which is hopeful.
Unfortunately, the PIE window did not come to the foreground on the ASUS
MyPal PocketPC.

Any other hints?

-Rich

Peter Foot said:
Since the first argument of FindWindow is the classname and the second is
the window title try

int h = FindWindow(null, "Internet Explorer");

Peter

--
Peter Foot
Windows Embedded MVP
www.inthehand.com | www.opennetcf.org

Hopefully a trivial question -
I have a C# PocketPC 2003 Windows Forms application running under
ARMv4.
I want to have the application put itself in the background and bring
PIE
to
the foreground. PIE is already loading, and can be seen in "Running
Programs".

I tried the famous code example where I substituted out "HHTaskBar" for
PIE

static public void showTaskBar ()
{
int h = FindWindow ("HHTaskBar", "");
ShowWindow (h, SW_SHOW);
}


[DllImport("coredll.dll")]
public static extern int FindWindow (string lpClassName, string
lpWindowName);
private const int SW_HIDE = 0x0000;
private const int SW_SHOW = 0x0001;

[DllImport("coredll.dll")]
public static extern int ShowWindow (int hwnd, int nTaskShow);

[DllImport("coredll.dll")]
public static extern int MoveWindow (IntPtr hwnd, int X, int Y, int
nWidth, int nHeight, bool bRepaint);
}

My code for show is -
static public void showPIE ()
{
int h = FindWindow ("IEFrame", "");
// int h = FindWindow ("iexplore", "");
// int h = FindWindow ("Internet Explorer", "");
ShowWindow (h, SW_SHOW);
}

However, PIE is not brought to the foreground.

As the commented lines in "showPIE" hint, I tried various names for
PIE -
"Internet Explorer" appears in the list of "Running Programs",
"iexplore.exe" is the name of the executable in the PocketPC Windows
directory,
and I saw a web posting that hinted that "IEFrame" might work.

In any of the three cases, the integer h in "showPIE" is bound to "0".

What do I need to change?

Also - No offence intended, but I have a mild preference *not* to have
to
use a 3rd-party library such as opennetcf.org
 
P

Peter Foot [MVP]

SetForegroundWindow is an API function which takes a hWnd - you pass in the
handle returned from FindWindow. This should then bring PIE to the front.

Peter

--
Peter Foot
Windows Embedded MVP
www.inthehand.com | www.opennetcf.org

Rich said:
Peter,
I was out for most of the day, and am just reading your reply.
I am not sure I understand.
If I call "SetForegroundWindow", which takes no arguments, from my
PocketPC
application, how will it effect the PIE window? Is it assumed that the
mouse
has captured the background PIE window with the call to "ShowWindow"?
Sorry
for being a bit dense...
-Rich

Peter Foot said:
Have you tried calling SetForegroundWindow with this handle:-
http://blog.opennetcf.org/pfoot/PermaLink.aspx?guid=a4bca0e4-439b-411a-87cd-0950e9d16b10

Peter

--
Peter Foot
Windows Embedded MVP
www.inthehand.com | www.opennetcf.org

Rich said:
Peter,
Thanks for the swift reply! (I should pay closer attention to the
method
signature ;)

When I tried
int h = FindWindow (null, "Internet Explorer");
h is now bound to the integer 941872, which is hopeful.
Unfortunately, the PIE window did not come to the foreground on the
ASUS
MyPal PocketPC.

Any other hints?

-Rich

:

Since the first argument of FindWindow is the classname and the second
is
the window title try

int h = FindWindow(null, "Internet Explorer");

Peter

--
Peter Foot
Windows Embedded MVP
www.inthehand.com | www.opennetcf.org

Hopefully a trivial question -
I have a C# PocketPC 2003 Windows Forms application running under
ARMv4.
I want to have the application put itself in the background and
bring
PIE
to
the foreground. PIE is already loading, and can be seen in "Running
Programs".

I tried the famous code example where I substituted out "HHTaskBar"
for
PIE

static public void showTaskBar ()
{
int h = FindWindow ("HHTaskBar", "");
ShowWindow (h, SW_SHOW);
}


[DllImport("coredll.dll")]
public static extern int FindWindow (string lpClassName, string
lpWindowName);
private const int SW_HIDE = 0x0000;
private const int SW_SHOW = 0x0001;

[DllImport("coredll.dll")]
public static extern int ShowWindow (int hwnd, int nTaskShow);

[DllImport("coredll.dll")]
public static extern int MoveWindow (IntPtr hwnd, int X, int Y, int
nWidth, int nHeight, bool bRepaint);
}

My code for show is -
static public void showPIE ()
{
int h = FindWindow ("IEFrame", "");
// int h = FindWindow ("iexplore", "");
// int h = FindWindow ("Internet Explorer", "");
ShowWindow (h, SW_SHOW);
}

However, PIE is not brought to the foreground.

As the commented lines in "showPIE" hint, I tried various names for
PIE -
"Internet Explorer" appears in the list of "Running Programs",
"iexplore.exe" is the name of the executable in the PocketPC
Windows
directory,
and I saw a web posting that hinted that "IEFrame" might work.

In any of the three cases, the integer h in "showPIE" is bound to
"0".

What do I need to change?

Also - No offence intended, but I have a mild preference *not* to
have
to
use a 3rd-party library such as opennetcf.org
 
G

Guest

Peter,
Ah, yes. Many thanks. I just finished trying it out, and it did the trick.

BTW - Your help is especially valuble to someone like me who does not have
previous deep experience with COM/MFC/C++ programming, but is using ASP.NET,
C#, and Windows Mobile. Thanks again.
-Rich

Peter Foot said:
SetForegroundWindow is an API function which takes a hWnd - you pass in the
handle returned from FindWindow. This should then bring PIE to the front.

Peter

--
Peter Foot
Windows Embedded MVP
www.inthehand.com | www.opennetcf.org

Rich said:
Peter,
I was out for most of the day, and am just reading your reply.
I am not sure I understand.
If I call "SetForegroundWindow", which takes no arguments, from my
PocketPC
application, how will it effect the PIE window? Is it assumed that the
mouse
has captured the background PIE window with the call to "ShowWindow"?
Sorry
for being a bit dense...
-Rich

Peter Foot said:
Have you tried calling SetForegroundWindow with this handle:-
http://blog.opennetcf.org/pfoot/PermaLink.aspx?guid=a4bca0e4-439b-411a-87cd-0950e9d16b10

Peter

--
Peter Foot
Windows Embedded MVP
www.inthehand.com | www.opennetcf.org

Peter,
Thanks for the swift reply! (I should pay closer attention to the
method
signature ;)

When I tried
int h = FindWindow (null, "Internet Explorer");
h is now bound to the integer 941872, which is hopeful.
Unfortunately, the PIE window did not come to the foreground on the
ASUS
MyPal PocketPC.

Any other hints?

-Rich

:

Since the first argument of FindWindow is the classname and the second
is
the window title try

int h = FindWindow(null, "Internet Explorer");

Peter

--
Peter Foot
Windows Embedded MVP
www.inthehand.com | www.opennetcf.org

Hopefully a trivial question -
I have a C# PocketPC 2003 Windows Forms application running under
ARMv4.
I want to have the application put itself in the background and
bring
PIE
to
the foreground. PIE is already loading, and can be seen in "Running
Programs".

I tried the famous code example where I substituted out "HHTaskBar"
for
PIE

static public void showTaskBar ()
{
int h = FindWindow ("HHTaskBar", "");
ShowWindow (h, SW_SHOW);
}


[DllImport("coredll.dll")]
public static extern int FindWindow (string lpClassName, string
lpWindowName);
private const int SW_HIDE = 0x0000;
private const int SW_SHOW = 0x0001;

[DllImport("coredll.dll")]
public static extern int ShowWindow (int hwnd, int nTaskShow);

[DllImport("coredll.dll")]
public static extern int MoveWindow (IntPtr hwnd, int X, int Y, int
nWidth, int nHeight, bool bRepaint);
}

My code for show is -
static public void showPIE ()
{
int h = FindWindow ("IEFrame", "");
// int h = FindWindow ("iexplore", "");
// int h = FindWindow ("Internet Explorer", "");
ShowWindow (h, SW_SHOW);
}

However, PIE is not brought to the foreground.

As the commented lines in "showPIE" hint, I tried various names for
PIE -
"Internet Explorer" appears in the list of "Running Programs",
"iexplore.exe" is the name of the executable in the PocketPC
Windows
directory,
and I saw a web posting that hinted that "IEFrame" might work.

In any of the three cases, the integer h in "showPIE" is bound to
"0".

What do I need to change?

Also - No offence intended, but I have a mild preference *not* to
have
to
use a 3rd-party library such as opennetcf.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top