[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

VRuby/Win32 Question

Steve Tuckner

9/25/2003 3:26:00 PM

I am trying to bring a VRuby app to be the front most window. I try the
following but it doesn't work. Any ideas of what to try next would be
appreciated:

bringWindowToTop = Win32API.new("user32", "BringWindowToTop", ["L"],
"L")
bringWindowToTop.Call(self.hWnd)

I have also tried ["P"] for the argument with no effect. When I inspect
self.hWnd it is a Fixnum with a large number in it. I used Spy++ to
check the window handle and it matched. I also thought of trying hParent
but that didn't work as hParent is zero.

Thanks in advance,

Steve Tuckner


1 Answer

Eric Landuyt

9/25/2003 4:59:00 PM

0

> I am trying to bring a VRuby app to be the front most window. I try the
following but it doesn''t work. Any ideas of what to try next would be
appreciated:
>
> bringWindowToTop = Win32API.new("user32", "BringWindowToTop", ["L"], "L")
> bringWindowToTop.Call(self.hWnd)
>
> I have also tried ["P"] for the argument with no effect. When I inspect
self.hWnd it is a Fixnum with a large number in it. I used Spy++ to check
the window handle and it > matched. I also thought of trying hParent but
that didn''t work as hParent is zero.

I suppose you want to code something similar to the "window always on top"
setting
available in various applications.

For this, use SetWindowPos() in place of BringWindowToTop().
Try to convert the following C code to Ruby (using Win32API):

SetWindowPosl(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE)

To disable the "always on top" feature:

SetWindowPosl(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE)

(see
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/Windowing/Windows/WindowReference/WindowFunctions/SetWin...
for more details about this function)

Eric Landuyt