Core Function PTRToDLLStruct
From Sputnik Wiki
(Difference between revisions)
(Created page with "<pre> PTRToDLLStruct( <def string>, <ptr> ) </pre> === Description === Reads a DLLStruct from a memory pointer === Parameters === ==== def string ==== A string representing...") |
(→Remarks) |
||
Line 25: | Line 25: | ||
=== Remarks === | === Remarks === | ||
− | + | DLLStructToPTR function does not exist by name but it does exist in function instead use DLLStructGetPtr to get the pointer of a DLLStruct (The reverse of this PTRToDLLStruct) | |
=== Example === | === Example === |
Revision as of 11:43, 28 March 2012
PTRToDLLStruct( <def string>, <ptr> )
Contents |
Description
Reads a DLLStruct from a memory pointer
Parameters
def string
A string representing the structure to create (See DLLStructCreate).
ptr
A pointer to allocated memory to use as the Structs data.
Return Value
Success - Returns the DLLStruct.
Failure - Returns 0 and most likely throws exception.
Remarks
DLLStructToPTR function does not exist by name but it does exist in function instead use DLLStructGetPtr to get the pointer of a DLLStruct (The reverse of this PTRToDLLStruct)
Example
DLLStructCreateDef("WindowPos", @" ptr hwnd; ptr hwndInsertAfter; int x; int y; int cx; int cy; uint flags "); // Create the MDI GUI $GUI = GUICreate("MDIWindow", "GUI", 800, 600); // Show the MDI GUI GUILoad( $GUI ); // Create the Design Window $Window = GUICreate("Window", "GUI", 640, 482, 0, 0); GUIMDIParent($Window, $GUI); // Show the Design Window GUILoad( $Window ); // Add a MsgFilter to Design Window GUIWndProc($Window, "DesignWndProc();"); // Keep the GUI running as long as long as the window is open While ( GUIStatus( $GUI ) ) DoEvents( ); Function DesignWndProc() { if ($MSG == 0x0046) # WM_WINDOWPOSCHANGING { $Struct = PTRToDLLStruct("WindowPos", $LParam); DLLStructSetData($Struct, "x", 0); DLLStructSetData($Struct, "y", 0); } return 0; }