
Originally Posted by
Bonnie West
Because when you activate any of the Forms in your app, VB automatically brings to the foreground all the other visible Forms as well.
There is a workaround for that, but IIRC it involves setting the windows GWL_HWNDPARENT , something like...
Code:
Private Declare Function SetWindowLong Lib "user32.dll" Alias "SetWindowLongA" ( ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Const GWL_HWNDPARENT As Long = -8
Dim oFrm As Form2
Set oFrm = New Form2
oFrm.Show
SetWindowLong oFrm.hWnd, GWL_HWNDPARENT, 0&
Though its been years since I used that so may be incorrect,
I got a couple tricks like that from this old thread here.
EDIT some code I was using in my app...
Code:
Public Sub SetWinSelf(f As Form)
' this makes a form not activate other forms open on desktop when it gets the focus.
' FOR COMPILED EXE.
f.Show
SetWindowLong f.hwnd, GWL_HWNDPARENT, CreateWindowEx( _
&H80, "ThunderRT6Main", vbNullString, &H94000000, _
0&, 0&, 0&, 0&, 0&, 0&, GetWindowLong(f.hwnd, GWL_HINSTANCE), 0&)
For testing in IDE, .
Code:
' **** CODE TO TEST IN IDE ONLY *******
'SetWindowLong Chld.hWnd, _
GWL_HWNDPARENT, _
CreateWindowEx( _
&H80, "ThunderMain", _
vbNullString, &H94000000, _
0&, 0&, 0&, 0&, 0&, 0&, _
GetWindowLong(Chld.hWnd, GWL_HINSTANCE), _
0&)
I don't have VB6 installed on any PCs anymore so can't test, but I believe the above hides the form from taskbar also, don't really remember
, see URL above.
HTH.