Solved

hi, i need your favor

Posted on 2002-03-03
8
190 Views
Last Modified: 2010-05-02
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

0
Comment
Question by:cc_2000_sg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 1

Expert Comment

by:surajdeo
ID: 6838551
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
0
 
LVL 7

Expert Comment

by:Z_Beeblebrox
ID: 6839040
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
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6839211
hearing...
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Accepted Solution

by:
daffyduck14mil earned 50 total points
ID: 6839373
Private Sub Form_load()
  SmallForm.Show vbModeless, Me
End sub

Does the job also...
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6839723
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.
0
 
LVL 3

Expert Comment

by:daffyduck14mil
ID: 6841141
Richie, have you tried it?

This works (hint: vbModeless).
0
 

Author Comment

by:cc_2000_sg
ID: 6843662
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
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6844113
I apologize. I didn't read your post .carefully.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question