Has anybody got this plugin to work with V3?
Are the french guys still around?
my window just puts itself in the upper left corner no matter what I do? Must be the .net 3.x stuff.
//Lasse
kris wrote:I just did the same test and you're right it doesn't work.
I tested some of the plugin sdk properties that are used by xmovewindows and it seems that the getX and getY properties of getButton are not working in V3. getHeight and getWidth however do work... I've already emailed this to Steven.
i guess this will not be to hard to fix...
kris
badubo wrote:XMovewindow is quite old, the button class was not yet implemented, I use "buttonsize:" in a sendcommand.
/// <summary>
/// A few win32 api calls
/// </summary>
public class xDllImports
{
[DllImport("user32.dll")]
public static extern bool LockWindowUpdate(IntPtr hWndLock);
[DllImport("user32.dll")]
public static extern IntPtr SetCursor(IntPtr cursorHandle);
[DllImport("User32.dll")]
public static extern IntPtr FindWindow(String lpClassName, String lpWindowName);
[DllImport("user32.dll")]
public static extern int SendMessage(IntPtr hWnd, uint Msg, int wParam, int lParam);
[DllImport("user32.dll")]
public static extern int PostMessage(IntPtr hWnd, uint Msg, int wParam, int lParam);
[DllImport("user32.dll")]
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
[DllImport("user32.dll")]
public static extern IntPtr MoveWindow(IntPtr hWnd, int X, int Y, int cx, int cy);
[DllImport("user32.dll")]
public static extern bool SetForegroundWindow(IntPtr hWnd);
[DllImport("user32", CharSet = CharSet.Auto, SetLastError = true)]
public static extern int GetWindowLong(IntPtr Handle, int nIndex);
[DllImport("user32", CharSet = CharSet.Auto, SetLastError = true)]
public static extern int SetWindowLong(IntPtr Handle, int nIndex, int NewLong);
[DllImport("user32.dll")]
public static extern IntPtr GetLastActivePopup(IntPtr hWnd);
[DllImport("user32.dll")]
public static extern bool IsWindowEnabled(IntPtr hWnd);
[DllImport("user32")]
public static extern bool IsWindowVisible(IntPtr hWnd);
[DllImport("user32.dll")]
public static extern bool IsIconic(IntPtr hWnd);
[DllImport("user32.dll")]
public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
public const int WM_SETREDRAW = 0x000B;
public const int WM_USER = 0x400;
public const int EM_GETEVENTMASK = (WM_USER + 59);
public const int EM_SETEVENTMASK = (WM_USER + 69);
public const int GWL_WNDPROC = (-4);
public const int GWL_HINSTANCE = (-6);
public const int GWL_HWNDPARENT = (-8);
public const int GWL_STYLE = (-16);
public const int GWL_EXSTYLE = (-20);
public const int GWL_USERDATA = (-21);
public const int GWL_ID = (-12);
[DllImport("user32.dll", EntryPoint = "SetWindowPos")]
public static extern bool SetWindowPos(
IntPtr hWnd, // window handle
int hWndInsertAfter, // placement-order handle
int X, // horizontal position
int Y, // vertical position
int cx, // width
int cy, // height
uint uFlags); // window positioning flags
public const int HWND_TOP = 0x0;
public const int HWND_BOTTOM = 0x1;
public const int HWND_TOPMOST = -1;
public const int HWND_NOTOPMOST = -2;
public const int SW_RESTORE = 9;
public const int SWP_NOACTIVATE =0x10;
public const uint SWP_NOSIZE = 0x1;
public const uint SWP_NOMOVE = 0x2;
public const uint SWP_SHOWWINDOW = 0x40;
public const uint SWP_HIDEWINDOW = 0x80;
public const uint SWP_NOZORDER= 0x4;
public const uint SWP_DRAWFRAME= 0x0020;
public const uint SWP_FRAMECHANGED = 0x0020;
public const uint SWP_ASYNCWINDOWPOS = 0x4000;
public const int WS_CAPTION = 0xC00000;
public const int WS_BORDER = 0x800000;
public const int WS_DLGFRAME = 0x400000;
public const int WS_THICKFRAME = 0x40000;
public static void RemoveFrame(IntPtr Handle, bool TopMost, bool BottomMost )
{
if (Handle != IntPtr.Zero)
{
int nOldStyle = GetWindowLong(Handle, GWL_STYLE);
int nNewStyle = nOldStyle & ~(WS_CAPTION | WS_BORDER | WS_DLGFRAME | WS_THICKFRAME);
SetWindowLong(Handle, GWL_STYLE, nNewStyle);
if ( TopMost )
SetWindowPos(Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_ASYNCWINDOWPOS | SWP_NOACTIVATE | SWP_FRAMECHANGED);
else if (BottomMost)
SetWindowPos(Handle, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_ASYNCWINDOWPOS | SWP_NOACTIVATE | SWP_FRAMECHANGED);
else
SetWindowPos(Handle, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_ASYNCWINDOWPOS | SWP_NOACTIVATE | SWP_FRAMECHANGED);
}
}
public static void RemoveFrame(IntPtr Handle, bool TopMost, bool BottomMost, int X, int Y, int Cx, int Cy)
{
if (Handle != IntPtr.Zero)
{
int nOldStyle = GetWindowLong(Handle, GWL_STYLE);
int nNewStyle = nOldStyle & ~(WS_CAPTION | WS_BORDER | WS_DLGFRAME | WS_THICKFRAME);
SetWindowLong(Handle, GWL_STYLE, nNewStyle);
if (TopMost)
SetWindowPos(Handle, HWND_TOPMOST, X, Y, Cx, Cy, SWP_ASYNCWINDOWPOS | SWP_NOACTIVATE | SWP_FRAMECHANGED);
else if (BottomMost)
SetWindowPos(Handle, HWND_BOTTOM, X, Y, Cx, Cy, SWP_ASYNCWINDOWPOS | SWP_NOACTIVATE | SWP_FRAMECHANGED);
else
SetWindowPos(Handle, 0, X, Y, Cx, Cy, SWP_NOZORDER | SWP_ASYNCWINDOWPOS | SWP_NOACTIVATE | SWP_FRAMECHANGED);
}
}
/// <summary>
///
/// </summary>
public static void SendFocus(string WindowTitle)
{
// Look for previous instance of this program.
IntPtr hWnd = FindWindow(null, WindowTitle);
// If a previous instance of this program was found...
if (hWnd != null)
{
//If program is minimized, restore it.
ShowWindow(hWnd, SW_RESTORE);
//Bring to the front
SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW | SWP_FRAMECHANGED);
//Set the focus
SetForegroundWindow(hWnd);
}
}//SendFocus
}//xDllImports
badubo wrote:Don"t know if you speak about me or Pittaway, but you can of course upload your work
I do not want to upset you.
badubo wrote:
- Code: Select all
I do not want to upset you.
no problem you can release