Solved

hi, i need your favor

Posted on 2002-03-03
8
182 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Computer crashes, following error message in event manager 5 200
VB6 Compile Compatibility Issue 4 102
Using "ScreenUpdating" 6 65
VBA - If Bookmark = "XXBOOKMARKXX" then 15 28
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

777 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