Solved

hi, i need your favor

Posted on 2002-03-03
8
179 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
8 Comments
 
LVL 1

Expert Comment

by:surajdeo
Comment Utility
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
Comment Utility
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
Comment Utility
hearing...
0
 
LVL 3

Accepted Solution

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

Does the job also...
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 16

Expert Comment

by:Richie_Simonetti
Comment Utility
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
Comment Utility
Richie, have you tried it?

This works (hint: vbModeless).
0
 

Author Comment

by:cc_2000_sg
Comment Utility
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
Comment Utility
I apologize. I didn't read your post .carefully.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

771 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now