Home All Groups Group Topic Archive Search About

last API question....

Author
25 Jul 2006 7:55 PM
iwdu15
ok, thanks for all you who have put up with all my API questions
today....last one (besides my one about adding a Menu Item to the system menu
for all processes....)

I have the handle of a window, i get the icon, hide the window by using

ShowWindow(HandleHere, SW_HIDE)

and it hides the window, then i add its icon to the system tray. now (i
already added a handler for the notifyicon double click event) i want to
restore the window when its double-clicked. ive attempted

ShowWindow(HandleHere, SW_SHOW)

but that didnt work, neither did

ShowWindow(HandleHere, SW_SHOWMAXIMIZED)

nothing ive tried has worked....OpenIcon() hasnt worked either.....how can i
restore the window? thanks

--
-iwdu15

Author
25 Jul 2006 7:57 PM
Herfried K. Wagner [MVP]
"iwdu15" <jmmgoalsteratyahoodotcom> schrieb:
> ok, thanks for all you who have put up with all my API questions
> today....last one (besides my one about adding a Menu Item to the system
> menu
> for all processes....)
>
> I have the handle of a window, i get the icon, hide the window by using
>
> ShowWindow(HandleHere, SW_HIDE)

I suggest to post the function declarations you are using.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
25 Jul 2006 8:06 PM
iwdu15
sure, sorry, forgot to do that....


Private Declare Function ShowWindow Lib "user32" Alias "ShowWindow" (ByVal
hWnd As IntPtr, ByVal nCmdShow As Long) As Long

    Const SW_HIDE As Integer = 0
    Const SW_SHOWNORMAL As Integer = 1
    Const SW_NORMAL As Integer = 1
    Const SW_SHOWMINIMIZED As Integer = 2
    Const SW_SHOWMAXIMIZED As Integer = 3
    Const SW_MAXIMIZE As Integer = 3
    Const SW_SHOWNOACTIVATE As Integer = 4
    Const SW_SHOW As Integer = 5
    Const SW_MINIMIZE As Integer = 6
    Const SW_SHOWMINNOACTIVE As Integer = 7
    Const SW_SHOWNA As Integer = 8
    Const SW_RESTORE As Integer = 9
    Const SW_SHOWDEFAULT As Integer = 10
    Const SW_FORCEMINIMIZE As Integer = 11
    Const SW_MAX As Integer = 11


then i tried this too

        Dim x As New IntPtr(CInt(tray.Text))

        ShowWindow(x.ToInt32, SW_SHOW)


thanks a ton for your help

--
-iwdu15
Author
25 Jul 2006 8:11 PM
Herfried K. Wagner [MVP]
"iwdu15" <jmmgoalsteratyahoodotcom> schrieb:
> Private Declare Function ShowWindow Lib "user32" Alias "ShowWindow" (ByVal
> hWnd As IntPtr, ByVal nCmdShow As Long) As Long

Your declaration was wrong.  Here's the corrected version:

\\\
Private Declare Function ShowWindow Lib "user32.dll" ( _
    ByVal hWnd As IntPtr, _
    ByVal nCmdShow As Int32 _
) As Boolean
///

When asking questions about p/invoke, always inclide the declarations you
are using because often declarations are incorrect and lead to problems.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
25 Jul 2006 8:17 PM
iwdu15
awsome, that works.....thanks a ton for all your help
--
-iwdu15