` Printed Icetips Article

Icetips Article



Par2: Minimize window in another app
2006-02-02 -- Ville Vahtera
 
Program
  Map
  Module('WinApi')
    FindWindowA(Ulong,Ulong),Long,Pascal,Raw
    SendMessageA(Unsigned,Unsigned,Long,Long),Long,Raw,Pascal
    ShowWindow(Unsigned,Signed),Signed,Pascal,Proc
  End
  End

WM_SYSCOMMAND  Equate(0112h)
SC_MINIMIZE    Equate(0F020h)
HWND           Unsigned
WindowTitle    Cstring('Click-N-Type')

Window WINDOW('test'),AT(,,151,33),CENTER,SYSTEM,GRAY
       BUTTON('MINIMIZE'),AT(5,11,45,14),USE(?minimize_it)
       BUTTON('HIDE'),AT(53,11,45,14),USE(?hide_it)
       BUTTON('RESTORE'),AT(101,11,45,14),USE(?show_it)
     END

  Code
  Open(Window)
  HWND = FindWindowA(0,Address(WindowTitle))
  If HWND
    0{prop:text} = 'handle is: ' & HWND
  End

  Accept
    Case Event()
    Of Event:Accepted
        Case Field()
          Of ?minimize_it
            ! Minimize the window
            x# = SendMessageA(HWND, WM_SYSCOMMAND, SC_MINIMIZE, 0)
          Of ?hide_it
            ! Hide the window
            ShowWindow(HWND,0)
            ! Hide the window
          Of ?show_it
            ShowWindow(HWND,1)
        End
    End
  End



Printed November 21, 2024, 6:37 am
This article has been viewed/printed 35258 times.