RECT type ? |
Author: |
Message: |
felipEx
Scripting Contest Winner
Posts: 378 Reputation: 24
35 / /
Joined: Jun 2006
|
O.P. RECT type ?
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
|
|
12-27-2006 06:26 AM |
|
|
-dt-
Scripting Contest Winner
;o
Posts: 1819 Reputation: 74
36 / /
Joined: Mar 2004
|
RE: RECT type ?
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
This post was edited on 12-27-2006 at 06:39 AM by -dt-.
Happy Birthday, WDZ
|
|
12-27-2006 06:32 AM |
|
|
felipEx
Scripting Contest Winner
Posts: 378 Reputation: 24
35 / /
Joined: Jun 2006
|
O.P. RE: RECT type ?
thanks. so, i have some problems to repaint a window
|
|
12-27-2006 06:57 AM |
|
|
felipEx
Scripting Contest Winner
Posts: 378 Reputation: 24
35 / /
Joined: Jun 2006
|
O.P. RE: RECT type ?
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
|
|
12-27-2006 09:26 PM |
|
|
matty
Scripting Guru
Posts: 8336 Reputation: 109
39 / /
Joined: Dec 2002
Status: Away
|
RE: RECT type ?
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);
This post was edited on 12-27-2006 at 09:35 PM by matty.
|
|
12-27-2006 09:32 PM |
|
|
felipEx
Scripting Contest Winner
Posts: 378 Reputation: 24
35 / /
Joined: Jun 2006
|
O.P. RE: RECT type ?
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
|
|
12-27-2006 09:41 PM |
|
|
Ash_
Senior Member
Posts: 638 Reputation: 31
35 / / –
Joined: Aug 2004
|
RE: RECT type ?
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.
This post was edited on 12-28-2006 at 11:28 AM by Ash_.
|
|
12-28-2006 11:25 AM |
|
|
felipEx
Scripting Contest Winner
Posts: 378 Reputation: 24
35 / /
Joined: Jun 2006
|
O.P. RE: RECT type ?
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 ?
|
|
12-28-2006 11:35 AM |
|
|
Ash_
Senior Member
Posts: 638 Reputation: 31
35 / / –
Joined: Aug 2004
|
RE: RE: RECT type ?
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);
|
|
12-28-2006 11:39 AM |
|
|
felipEx
Scripting Contest Winner
Posts: 378 Reputation: 24
35 / /
Joined: Jun 2006
|
O.P. RE: RECT type ?
THANKS
|
|
12-28-2006 11:42 AM |
|
|
|