MoveWindow is a Win32 API function in user32.dll. You should use Interop.Call(DllName, FunctionName, Param1, ...) to call it!
Source: MoveWindow on MSDN
code:
var Result = Interop.Call(
"user32.dll", /* DLL name, you can find this on the MSDN page under Function Information */
"MoveWindow", /* Function name */
WndHandle, /* hWnd */
100, /* X-position */
100, /* Y-position */
100, /* Width */
100, /* Height */
true /* bRepaint, set this to false if you're going to repaint the window yourself (which you better don't) */
);
Debug.Trace("MoveWindow result: "+Result);
The result of MoveWindow is zero if it failed. So, if you want to check if it failed, use
if(Result == 0) ... and do whatever you want. (show error box, tell the debugger something, ...)
Of course, it's not needed that you place all these comments in your function call. It's just to let you know what each parameter stands for. Something like this can be used if you don't need all these comments:
code:
var Result = Interop.Call("user32.dll", "MoveWindow", WndHandle, 100, 100, 100, 100, true);
But I think you could've figured that out yourself too.
quote:
Originally posted by SpunkyLoveMuff
change FALSE to false or replace it with a 0 (zero)
Sorry, but that won't make any difference. FALSE is false. And false as parameter in an Interop.Call equals 0 too, the documentation explains:
quote:
Originally posted by Messenger Plus! Live Scripting Documentation
Here is how the data will be sent to the function depending on its type:
- If the parameter is a plain number (positive or negative), it is sent as is.
- If the parameter is a floating point number, it is rounded up and sent as a plain number.
- If the parameter is a boolean, a number is sent: 1 for true, 0 for false.
- If the parameter is null, 0 is sent.
- If the parameter is a string, a pointer to a Unicode string is sent.
- If the parameter is a DataBloc object, a pointer to its underlying data is sent.
- If the parameter is any other object, a pointer to its IDispatch interface is sent. The reference count of the object is not increased.