If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Hybrid View

AppBar - What the diddly?

I have a weird issue with my very first appbar that I have been fighting for days with.

Below is Sub Show() that either creates an appbar and puts it just above the taskbar scooching
the desktop apps up by the size of the appbar, or deletes the appbar and hides the form.

The Flag WasHidden is a 1 if the form and appbar space is not there or a 0 if they (the appbar space and the docked form within) are shown. This Sub is called in response to a hotkey to toggle on and off the docked form and the desktop space it occupies.

At program startup, WasHidden is initialized to a 1 so the appbar is created and the form docks there. This works all the time. If I use the hotkey then the sub turns off the form and deletes the appbar from windows list. This also works every time.

However, if I use the hotkey once again to turn on the form the appbar is created where it should be but the form is displayed over the bottom of the main desktop app and cannot be dragged into the appbar below as if windows does not think it belongs there. - this is the case ever time.

I found however that if I set a break point at the SetWindowPos line then let it rip with an F5 (run) then the form will always load in the docking space like it should. Now matter how quickly I press f5 to run after the breakpoint, it always behaves as it should as if there is a race condition somewhere.

''***************** If I break at the line below, then let 'er rip it works **************
''****************** If I let it run through without the breakpoint it will mis-position the ''*******************form - every time