
RECT type ? - Printable Version
-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: RECT type ? (/showthread.php?tid=69951)
RECT type ? by felipEx on 12-27-2006 at 06:26 AM
hi guys..
how can i use the RECT type (like Visual Basic) in mp!live scripting ?
code: Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
thanks
RE: RECT type ? by -dt- on 12-27-2006 at 06:32 AM
to write to it (the second param of WriteDWORD is the value)
code: var RECT = Interop.Allocate(16); //long = 4 so size = 4 * 4
RECT.WriteDWORD(0, 0); //left
RECT.WriteDWORD(4, 0); //Top
RECT.WriteDWORD(8, 0); //Right
RECT.WriteDWORD(12, 0); //Bottom
to read it
code:
var RECT = Interop.Allocate(16); //long = 4 so size = 4 * 4
//pass to some api function where it changes it
var left = RECT.ReadDWORD(0); //left
var top = RECT.ReadDWORD(4); //Top
var right = RECT.ReadDWORD(8); //Right
var bottom = RECT.ReadDWORD(12); //Bottom
RE: RECT type ? by felipEx on 12-27-2006 at 06:57 AM
thanks. so, i have some problems to repaint a window
RE: RECT type ? by felipEx on 12-27-2006 at 09:26 PM
please, see my code 
code: var RECT = Interop.Allocate(16);
RECT.WriteDWORD(0, 0);
RECT.WriteDWORD(4, 0);
RECT.WriteDWORD(8, 0);
RECT.WriteDWORD(12, 0);
Interop.Call("user32.dll", "RedrawWindow", ChatWnd.Handle, RECT, 1, 1);
can you help me?, i need redraw a window
RE: RECT type ? by matty on 12-27-2006 at 09:32 PM
code: Interop.Call('user32', 'RedrawWindow', ChatWnd.Handle, 0, 0, 0x001 /* RDW_INVALIDATE */);
This would be better to use. Just send the window the WM_PAINT message to have it paint itself.
code: Interop.Call('user32', 'SendMessageW', ChatWnd.Handle, 0x000F /* WM_PAINT */, 0, 0);
RE: RECT type ? by felipEx on 12-27-2006 at 09:41 PM
this doesn't work for me (doesn't redraw the window)
i was playing with “animatewindow api”, so the redrawwindow api doesn't work 
anyway, thank you
RE: RECT type ? by Ash_ on 12-28-2006 at 11:25 AM
if you havent solved the problem yet look into the InvalidateRect API that's how i made the windows repaint. i don't have any code on here anymore to show you though.
edit:
code: Interop.Call('user32', 'InvalidateRect', WindowHandle, 0, False);
should be what your looking for.
RE: RECT type ? by felipEx on 12-28-2006 at 11:35 AM
vb code (it work):
code: Private Declare Function RedrawWindow Lib "user32" (ByVal hwnd As Long, lprcUpdate As RECT, ByVal hrgnUpdate As Long, ByVal fuRedraw As Long) As Long
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Sub Command1_Click()
Print "test.."
Dim theRECT As RECT
theRECT.Left = 0
theRECT.Top = 0
theRECT.Right = 0
theRECT.Bottom = 0
Call RedrawWindow(Me.hwnd, theRECT, 1, 1)
End Sub
how I can use this code (correctly) in scripting ?
RE: RE: RECT type ? by Ash_ on 12-28-2006 at 11:39 AM
code: Var Wnd = MsgPlus.CreateWnd(... ) (im assuming you've created the window and stuff? if you have Var Wnd will hold the Handle (Me.hwnd in VB))
var theRECT = Interop.Allocate(16); //long = 4 so size = 4 * 4
theRECT .WriteDWORD(0, 0); //left
theRECT .WriteDWORD(4, 0); //Top
theRECT .WriteDWORD(8, 0); //Right
theRECT .WriteDWORD(12, 0); //Bottom
Interop.Call('user32', 'RedrawWindow', Wnd, theRECT, 1, 1);
RE: RECT type ? by felipEx on 12-28-2006 at 11:42 AM
THANKS
|