NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to Display a Dialog Box from Visual Basic that is modal to the TestStand Application Window

I have an Visual Basic 6.0 ActiveX executable that displays a modal dialogue box to allow editing of some step properties. However, when I call this dialogue box from TestStand it remains hidden behind the TestStand application window. Currently I have to switch to the server application in order to access this dialogue box. There are examples on how to display a dialogue box that is modal to the TestStand application window for LabView and C++. Are there any examples of how I could do this from my VB application?

Thanks,

David
0 Kudos
Message 1 of 3
(3,775 Views)
Hi, I guess you need set a modal dialogue box to TOPMOST POSITION on the Form Activate Event, below is exsaple

Const HWND_TOPMOST = -1
Const HWND_NOTOPMOST = -2
Const SWP_NOSIZE = &H1
Const SWP_NOMOVE = &H2
Const SWP_NOACTIVATE = &H10
Const SWP_SHOWWINDOW = &H40
Private 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 wFlags As Long)

Private Sub Form_Activate()
'Set the window position to topmost
SetWindowPos Me.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE
End Sub

Br,Sergei
"Only a life lived in the service to others is worth living..." - Albert Einstein
Message 2 of 3
(3,768 Views)
Thanks Sergei.

Your solution works fine for me.

Regards,

David
0 Kudos
Message 3 of 3
(3,761 Views)