Solved

hi, i need your favor

Posted on 2002-03-03
8
183 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
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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…
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…

828 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