Real Software Forums
http://forums.realsoftware.com/

Window - Bring To Front
http://forums.realsoftware.com/viewtopic.php?f=21&t=45290
Page 1 of 1

Author:  sinner [ Sat Sep 08, 2012 7:42 am ]
Post subject:  Window - Bring To Front

hello
Here is lil code from WFS to make your window stay on top of other windows centered !

hope this helps

1. I your App make a method Called BringToCenter

Sub BringToCenter( w as Window, assigns set as Boolean )
#if TargetWin32
Const SWP_NOSIZE = &H1
Const SWP_NOMOVE = &H2
Const HWND_TOPMOST = -1
Const HWND_NOTOPMOST = -2

Declare Function SetWindowPos Lib "user32" (hwnd as Integer, hWndInstertAfter as Integer, _
x as Integer, y as Integer, cx as Integer, cy as Integer, flags as Integer) as Integer

dim after as Integer
if set then
after = HWND_TOPMOST
else
after = HWND_NOTOPMOST
end
Call SetWindowPos( w.handle, after, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE )

w.Left=(Screen(0).AvailableWidth -w.Width)/2
w.Top=(Screen(0).AvailableHeight -w.Height)/2
#endif


2. Call it like this in windows open event

App.BringTOCenter( Self ) = True

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/