Floating tool windows

From HashVB
Revision as of 23:35, 27 April 2006 by Spammer-1146181331 (Talk)

Jump to: navigation, search
float
 This article is based on Visual Basic 6. Find other Visual Basic 6 articles.

There are several occasions where you may want a tool window to float above your app but not other apps without being a modal dialog. It is possible to go insane trying to come up with a workaround for this unless you know the proper way to do it. The way to do it is by setting the floating window's owner. What this means in real terms is that you just have to call SetWindowLong with the GWL_HWNDPARENT constant to change its owner (note: HWNDPARENT is a misnomer, as you are actually setting the window's owner, not its parent). The code is very simple and is as follows.

Declarations

The following API declarations are required:

 Private Const GWL_HWNDPARENT = (-8)
 Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

Setting the window's owner

This is just one line of code:

 SetWindowLong myForm.hwnd, GWL_HWNDPARENT, Me.hwnd

Unsetting the window's owner

In order that your app doesn't crash, you have to unset the window's owner on exit, which is pretty much the same as setting the owner:

 SetWindowLong myForm.hwnd, GWL_HWNDPARENT, 0

(Where myForm is the form that you wish to float above your app)

Simple as that











[We are delicate. We do not delete your content.] [l_sp2006] http://top20man.in.ua/black-eyed-peas-mp3 black eyed peas mp3] madonna mp3 eminem mp3 ringtone maker godsmack awake godsmack voodoo sean paul temperature sean paul we be burnin bad day daniel powter system of a down mp3 sean paul mp3 metallica mp3 shakira mp3 rascal flatts what hurts the most rascal flatts bless the broken road red hot chili peppers under the bridge james blunt wisemen bad day daniel powter godsmack mp3 Godsmack Awake godsmack voodoo sean paul temperature Sean Paul We Be Burnin natasha bedingfield unwritten 50 cent mp3 Bad Day Daniel Powter Daniel Powter mp3 Goodbye My Lover James Blunt System Of A Down mp3 Sean Paul mp3 Metallica mp3 Shakira mp3 Black Eyed Peas mp3 Madonna mp3 eminem mp3 Fall Out Boy Grand Theft Autumn Jack Johnson mp3 oscar dresses mother of the bride dresses cocktail dresses Flower Girl Dresses Formal prom Dresses Plus Size Prom Dresses Free Verizon Ringtone godsmack i stand alone goodbye my lover james blunt [fall out boy grand theft autumn jack johnson mp3 natasha bedingfield unwritten 50 cent mp3 nextel ringtone bad day daniel powter daniel powter mp3 verizon ringtone US Cellular Ringtone free sprint ringtone verizon ringtone verizon ringtone bcbg shoes free sprint ringtones cheap prom dresses sexy prom dresses waterford crystal swarovski crystal bead mesothelioma lawsuits mesothelioma symptoms mesothelioma diagnosis Cingular Ringtone free kyocera ringtones Free Nextel Ringtone informal wedding dresses bridal gowns Discount Bridal Gowns Plus Size Swimwear no fax payday loans countrywide home loans fast cash loan guaranteed