Link to home
Start Free TrialLog in
Avatar of cc_2000_sg
cc_2000_sg

asked on

hi, i need your favor

hi,

i need suggestion.

i have one maximized form and one small form, what i want is when i do something one the bigger form, the smaller one will still be on the bigger one.

something like isolated the toolbar in the MS Word.


thanks

cc

Avatar of surajdeo
surajdeo
Flag of Mexico image

hi,

  u can use win api for that purpose, u have to write following code in small form.



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_TOPMOST = -1
Private Const SWP_NOSIZE = &H1
Private Const HWND_TOP = 0


'Private Sub Command1_Click()
'Form2.Show
'End Sub

Private Sub Form_Load()

    SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE

End Sub
Avatar of Z_Beeblebrox
Z_Beeblebrox

Hi,

The code given by surajdeo will make the window go on top of all windows. If you just want the window to always be on top of your big window, use this:

Private Declare Function SetWindowLong& Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long)
Private Const GWL_HWNDPARENT = (-8)

Private Sub Form_Load()
SetWindowLong(SmallForm.Hwnd, GWL_HWNDPARENT, BigForm.Hwnd)
End Sub
Avatar of Richie_Simonetti
hearing...
ASKER CERTIFIED SOLUTION
Avatar of daffyduck14mil
daffyduck14mil

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Not at all, if you do that, you cannot access underlying form until modal is closed.
If it is a toolbar, you have to get access to both forms.
Richie, have you tried it?

This works (hint: vbModeless).
Avatar of cc_2000_sg

ASKER

hi,

i have try daffyduck14mil one,

it can work.


so i decide to accept his as my answer, since it is so simple.


thanks all, you teach me a lot

cc
I apologize. I didn't read your post .carefully.