Raik Posted May 14, 2015 Posted May 14, 2015 The Story:I write a Tool for Notepad++, witch comunicates with NPP and the Scintilla-Control via _WinAPI_ReadProcessMemory / _WinAPI_WriteProcessMemory, Works now, but while i designed the functions, i came across some Questions.If i succeed with it, i will release a UDF for complete Comunication with Notepad++ / Scintilla.the Questions:The Description of DllStructCreate sounds, like not only the elements of a struct can be named, but structs themselfs too. Is this right, and if so, how is it done? (will be usefull for my project, if possible)"Struct mystruct;int;char[10],EndStruct" or something alike? (if that is possible,it should be mentioned in the helpfile)And i came across an example, where someone used type "struct" instead of "ptr" in DllCall. Is that equivalent? AutoIt-Syntaxsheme for Proton & Phase5 * Firefox Addons by me (resizable Textarea 0.1d) (docked JS-Console 0.1.1)
FaridAgl Posted May 15, 2015 Posted May 15, 2015 No, you can't name structs like that (as far as I know), but you can do something like this:Global Const $tagMyStruct = 'int var1;byte var2;uint var3;char var4[128];' ;Global scope Global $tMyStruct1 = DllStructCreate($tagMyStruct) Global $tMyStruct2 = DllStructCreate($tagMyStruct) Func Foo() ;Local scope Local $tMyStruct = DllStructCreate($tagMyStruct) EndFunc Func Bar() ;Local scope Local $tAnotherMyStruct = DllStructCreate($tagMyStruct) EndFunc And about your last question, for calling some functions which take a pointer to a struct, you can do it like this:#include <StructureConstants.au3> Global $hWnd = 0 ;Your window handle Global $tRect = DllStructCreate($tagRect) DllCall('User32.dll', 'BOOL', 'GetWindowRect', _ 'HWND', $hWnd, _ 'PTR', DllStructGetPtr($tRect))Or as you said, like this:#include <StructureConstants.au3> Global $hWnd = 0 ;Your window handle Global $tRect = DllStructCreate($tagRect) DllCall('User32.dll', 'BOOL', 'GetWindowRect', _ 'HWND', $hWnd, _ 'STRUCT*', $tRect)Both of them do the same thing. http://faridaghili.ir
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now