
 |
Ejemplos para Programadoras de Visual Basic::
Make one window float above another:
' Instructions:
' 1) Create a project with two forms and one module
' 2) Paste the code into each form or module as indicated
' 3) Run the project and click on Form1. Form 2 will
' float above.
' ------------- Paste this code into Module1 -------------
' This sample code is presented as is.
' Although every reasonable effort has been
' made to insure the correctness of the example
' below, Idianna Software Inc. makes no warranty
' of any kind with regard to this program sample
' either implicitly or explicitly.
' This program example may be freely distributed for the
' use of writing computer programs only. Any other use of
' this material requires written permission from Idianna Software inc.
' (c) 2000 Idianna Software inc. All rights reserved.
' Title: Make one window form above another
' Platform: Visual Basic 32 bit
' Author: Jon Vote
' Contact: jon@idioma-software.com
' Date: 02/2000
'
'
' FLOAT WINDOW - Make one form flow above another
'
' To make a form float:
'
' Assuming Form2 is the form that will float above
' Form1, add the following to Form2's Load and
' Unload events:
'
'Private Sub Form_Load()
'
' call LoadFloatWindow(me.hWnd, Form1.hWnd)
'
'end sub
'
'
'Private Sub Form_Unload(Cancel As Integer)
'
' call UnLoadFloatWindow(me.hWnd)
'
'end sub
Option Explicit
Const GWW_HWNDPARENT = (-8)
Declare Function SetWindowWord Lib "user32" _
(ByVal hwnd As Long, _
ByVal nIndex As Long, _
ByVal wNewWord As Long) As Long
Dim mOriginalParenthWnd As Long
Sub UnloadFloatWindow(ByVal hwndChild As Long)
Dim dummy As Long
dummy = SetWindowWord(hwndChild, GWW_HWNDPARENT,
mOriginalParenthWnd)
End Sub
Sub LoadFloatWindow(ByVal hwndChild As Long,
ByVal hwndParent As Long)
mOriginalParenthWnd = SetWindowWord(hwndChild,
GWW_HWNDPARENT, hwndParent)
End Sub
' ------------- End code for Module1 -------------
' ------------- Paste this code into Form1 -------------
Option Explicit
Private Sub Form_Click()
Form2.Show
End Sub
' ------------- End code for Form1 -------------
' ------------- Paste this code into Form1 -------------
Option Explicit
Private Sub Form_Load()
Call LoadFloatWindow(Me.hwnd, Form1.hwnd)
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call UnloadFloatWindow(Me.hwnd)
End Sub
' ------------- End code for Form2 -------------
|