Results 1 to 3 of 3

Thread: VB Shell Command: Position Window?

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2001
    Posts
    39

    VB Shell Command: Position Window?

    I am firing up a small exe file from within my VB application.

    The Shell command works just fine.

    However, it does not allow me to *position* the exe on my screen. I would like to pass it parameters, like an x/y position, etc..

    Anyone have any ideas on how to do this?

    Thanks
    diver

  2. #2
    Frenzied Member moinkhan's Avatar
    Join Date
    Jun 2000
    Location
    Karachi, Pakistan
    Posts
    2,011
    Willing to use some API?????
    Try the following...

    Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long

    Private Const HWND_DESKTOP = 0

    Private Const SWP_NOSIZE = &H1
    Private Declare Function GetForegroundWindow Lib "user32" () As Long

    'Right After Shell command write the following..
    Dim tHwnd As Long
    tHwnd = GetForegroundWindow
    SetWindowPos tHwnd, HWND_DESKTOP, 200, 200, 0, 0, SWP_NOSIZE

    Tell me if it does...

  3. #3

    Thread Starter
    Member
    Join Date
    Sep 2001
    Posts
    39

    Thumbs up

    moinkahn!

    Works like a charm .
    Thanks a million.
    The only thing I changed was the x,y coordinates,
    and I made my windows HWND_TOPMOST, because I did not want the user clicking on my form and making the newly fired executable "disappear" if you know what I mean.

    YOU THE MAN (API Man, that is)

    Thanks
    diver

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width