last API question....

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • iwdu15

    #1

    last API question....

    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(Hand leHere, 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(Hand leHere, SW_SHOW)

    but that didnt work, neither did

    ShowWindow(Hand leHere, SW_SHOWMAXIMIZE D)

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

    --
    -iwdu15
  • Herfried K. Wagner [MVP]

    #2
    Re: last API question....

    "iwdu15" <jmmgoalsteraty ahoodotcomschri eb:
    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(Hand leHere, 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/>

    Comment

    • iwdu15

      #3
      Re: last API question....

      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_SHOWMINIMIZE D As Integer = 2
      Const SW_SHOWMAXIMIZE D As Integer = 3
      Const SW_MAXIMIZE As Integer = 3
      Const SW_SHOWNOACTIVA TE As Integer = 4
      Const SW_SHOW As Integer = 5
      Const SW_MINIMIZE As Integer = 6
      Const SW_SHOWMINNOACT IVE As Integer = 7
      Const SW_SHOWNA As Integer = 8
      Const SW_RESTORE As Integer = 9
      Const SW_SHOWDEFAULT As Integer = 10
      Const SW_FORCEMINIMIZ E As Integer = 11
      Const SW_MAX As Integer = 11


      then i tried this too

      Dim x As New IntPtr(CInt(tra y.Text))

      ShowWindow(x.To Int32, SW_SHOW)


      thanks a ton for your help

      --
      -iwdu15

      Comment

      • Herfried K. Wagner [MVP]

        #4
        Re: last API question....

        "iwdu15" <jmmgoalsteraty ahoodotcomschri eb:
        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/>

        Comment

        • iwdu15

          #5
          Re: last API question....

          awsome, that works.....thank s a ton for all your help
          --
          -iwdu15

          Comment

          Working...