working with window?

Byak@

Active Member
Licensed User
i'm need some methods for working with window:
1)SetWindowLong and GetWindowLong
2)SetWindowPos

as i know it is a winAPI methods, but it is work fine on c# and VisualBasic. what about as?

and yes,i want it for desctop =)
 

agraham

Expert
Licensed User
Longtime User

Byak@

Active Member
Licensed User
GetWindowLong and SetWindowLong i'm need for hide my (and not only my) window from alt+tab.yes,i can use a borderstyle=5 and recreate a window rectangle but i can't get a size of window's border(this value return a null) and using SetWindowLong is more comfortable =)
SetWindowPose i'm need for placing my app on a desctop (it will be visible only on desctop)
 

agraham

Expert
Licensed User
Longtime User
You can only use SetWindowLong to change the wndproc of windows belonging to the main thread of your application - not other windows so I would have thought whatever you would do with SetWindowLong you could do with my messages library.

You can get and set the position of a form on the screen using the undocumented Left and Top properties or use the Door library and the Form Left and Top properties.

You can get the actual size of a form using the Door library and the Form Width and Height properties. The Basic4ppc similarly named properties return the size of the client area, subtraction gives you the border width if you need it.
 

Byak@

Active Member
Licensed User
Andrew you don't understand me))
1) witj SetWindowLong a can do
B4X:
[COLOR=#0000FF]private const int[/COLOR] GWL_EXSTYLE = -20;
[COLOR=#0000FF]private const int[/COLOR] WS_EX_TOOLWINDOW = 0x00000080;

[COLOR=#0000FF]public static void[/COLOR] HideFromAltTab([COLOR=#5F9EA0]IntPtr[/COLOR] Handle)
{
    SetWindowLong(Handle,
                  GWL_EXSTYLE,
                  GetWindowLong(Handle, GWL_EXSTYLE) | WS_EX_TOOLWINDOW);
}

2) i want change parent of window in Z-order
B4X:
[COLOR=#0000FF]public static extern bool[/COLOR] SetWindowPos([COLOR=#0000FF]int[/COLOR] hWnd, [COLOR=#0000FF]int[/COLOR] hWndInsertAfter, [COLOR=#0000FF]int[/COLOR] X, [COLOR=#0000FF]int[/COLOR] Y,
    [COLOR=#0000FF]int[/COLOR] cx, [COLOR=#0000FF]int[/COLOR] cy, [COLOR=#0000FF]uint[/COLOR] uFlags);

[COLOR=#0000FF]public const int[/COLOR] HWND_BOTTOM = 0x1;
[COLOR=#0000FF]public const uint[/COLOR] SWP_NOSIZE = 0x1;
[COLOR=#0000FF]public const uint[/COLOR] SWP_NOMOVE = 0x2;
[COLOR=#0000FF]public const uint[/COLOR] SWP_SHOWWINDOW = 0x40;

[COLOR=#0000FF]private void[/COLOR] ShoveToBackground()
{
    SetWindowPos(([COLOR=#0000FF]int[/COLOR])[COLOR=#0000FF]this[/COLOR].Handle, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE |
        SWP_NOSIZE | SWP_SHOWWINDOW);
}
 

agraham

Expert
Licensed User
Longtime User
Sorry, I did misunderstand. As you are working on the desktop why don't you install the free Visual C# 2010 Express and write your own libraries. You can build .NET 2.0 libraries with it that will work fine on the desktop with Basic4ppc though you can't build device ibraries.
 
Top