• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 218
  • Last Modified:

Bring an unactive vb program to active

How do I bring a minimize vb program to active and put
it in 0, 0 position and on the top of others ?
1 Solution
What do you mean bring a minimize vb program to active?

This code will make your window stay on top of others:

Declare Sub 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 giFlags As Long)

Sub StayOnTop(hWindow As Long, TopMost As Boolean)
    wFlags = &H2 Or &H1 Or &H40 Or &H10
    If TopMost = True Then Placement = -1
    If TopMost = False Then Placement = -2
    SetWindowPos hWindow, Placement, 0, 0, 0, 0, wFlags
End Sub

call     StayOnTop Me.hwnd, True     to make that window stay on top of the others

If you're talking about moving it also, you could do me.move 0,0

If th program's minimized, you can make it normal window state by doing    Me.WindowState = vbNormal

I hope this helps.  Good luck!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now