DllStruct Dev
#41
Posted 02 May 2005 - 06:42 PM
#42
Posted 02 May 2005 - 06:43 PM
SciTE for AutoItDirections for Submitting Standard UDFs
Don't argue with an idiot; people watching may not be able to tell the difference.
#43
Posted 02 May 2005 - 08:37 PM
Looks pretty nice.Already fixed up for udfs and sent to jdeb
All i need now to be able to replace the 2 programs i wrote for SciTEconfig is that the default font and the default color to be used as default for the Dialog shown....
For Color its the "COLORREF rgbResult" that contains the default info and for Font its "TCHAR lfFaceName[LF_FACESIZE]" ...
What do you think ?
Visit the SciTE4AutoIt3 Download page for the latest versions Forum Rules
Live for the present,
Dream of the future,
Learn from the past.
#44
Posted 02 May 2005 - 09:00 PM
ChooseColorLooks pretty nice.
All i need now to be able to replace the 2 programs i wrote for SciTEconfig is that the default font and the default color to be used as default for the Dialog shown....
For Color its the "COLORREF rgbResult" that contains the default info and for Font its "TCHAR lfFaceName[LF_FACESIZE]" ...
What do you think ?
params
$i_ReturnType - Optional: determines return type
$i_colorref - Optional: COLORREF rgbColors
if $i_ReturnType == 0 then COLORREF is returned
if $i_ReturnType == 1 then Hex BGR Color is returned
if $i_ReturnType == 2 Hex RGB Color is returned
added optional colorref rgbcolor param
ChooseFont
params
$s_FontName - Optional: Default font name
$i_size - Optional: pointsize of font
$i_colorref - Optional: COLORREF rgbColors
returns an array
$array[0] - contains the number of elements
$array[1] - attributes = BitOr of italic:2, undeline:4, strikeout:8
$array[2] - fontname
$array[3] - font size = point size
$array[4] - font weight = = 0-1000
$array[5] - COLORREF rgbColors
$array[6] - Hex BGR Color
$array[7] - Hex RGB Color
Edited by gafrost, 03 May 2005 - 12:43 AM.
SciTE for AutoItDirections for Submitting Standard UDFs
Don't argue with an idiot; people watching may not be able to tell the difference.
#45
Posted 03 May 2005 - 12:26 AM
SciTE for AutoItDirections for Submitting Standard UDFs
Don't argue with an idiot; people watching may not be able to tell the difference.
#46
Posted 03 May 2005 - 07:21 PM
Works great ... implemented it in SciTeConfig scrip to be able to get rid of the 2 extra programs...ChooseColor
params
$i_ReturnType - Optional: determines return type
$i_colorref - Optional: COLORREF rgbColors
if $i_ReturnType == 0 then COLORREF is returned
if $i_ReturnType == 1 then Hex BGR Color is returned
if $i_ReturnType == 2 Hex RGB Color is returned
added optional colorref rgbcolor param
ChooseFont
params
$s_FontName - Optional: Default font name
$i_size - Optional: pointsize of font
$i_colorref - Optional: COLORREF rgbColors
returns an array
$array[0] - contains the number of elements
$array[1] - attributes = BitOr of italic:2, undeline:4, strikeout:8
$array[2] - fontname
$array[3] - font size = point size
$array[4] - font weight = = 0-1000
$array[5] - COLORREF rgbColors
$array[6] - Hex BGR Color
$array[7] - Hex RGB Color
I will add these to the Misc.au3 UDF library....
Thanks !!
Visit the SciTE4AutoIt3 Download page for the latest versions Forum Rules
Live for the present,
Dream of the future,
Learn from the past.
#47
Posted 03 May 2005 - 07:25 PM
Very well! Thanks: Ejoc, gafrost and JdeB.Works great ... implemented it in SciTeConfig scrip to be able to get rid of the 2 extra programs...
I will add these to the Misc.au3 UDF library....
Thanks !!
#48
Posted 04 May 2005 - 07:52 PM
Ok I see what you are asking, as I found I needed it for writing to the System Event Log. I added it to my UDF, I may add it to the AutoIt source, but I dont want it to get too bloated.Also... Is there a way to get a piece of a struct pointer? DLLStructGetMem?
Lar.
*Edit
Moved this to post #1
Edited by Ejoc, 11 May 2005 - 06:54 PM.
#49
Posted 04 May 2005 - 10:00 PM
#comments-start BOOL DrawEdge( HDC hdc, // handle to device context LPRECT qrc, // rectangle coordinates UINT edge, // type of edge UINT grfFlags // type of border ); #comments-end $DC = DllCall("gdi32.dll", "int", "GetDC", "hWnd", "") $coords = DllStructCreate("int;int;int;int") DllStructSet($coords, 1, 100); x DllStructSet($coords, 2, 200); y DllStructSet($coords, 3, 200); width DllStructSet($coords, 4, 200); height DllCall("gdi32.dll", "int", "DrawEdge", "int", $DC, "ptr", DllStructPtr($coords), "int", 8, "int", 0x4000) DllStructFree($coords)
And heres the MSDN site for it:
http://msdn.microsoft.com/library/default....ntdraw_6aat.asp
Thanks
#50
Posted 04 May 2005 - 10:03 PM
also
edge
[in] Specifies the type of inner and outer edges to draw. This parameter must be a combination of one inner-border flag and one outer-border flag. The inner-border flags are as follows.
Global Const $BDR_RAISEDINNER = 0x4 Global Const $BDR_SUNKENINNER = 0x8
The outer-border flags are as follows.
Global Const $BDR_RAISEDOUTER = 0x1 Global Const $BDR_SUNKENOUTER = 0x2
Alternatively, the edge parameter can specify one of the following flags.
Global Const $EDGE_BUMP = (BitOR($BDR_RAISEDOUTER,$BDR_SUNKENINNER)) Global Const $EDGE_ETCHED = (BitOR($BDR_SUNKENOUTER,$BDR_RAISEDINNER)) Global Const $EDGE_RAISED = (BitOR($BDR_RAISEDOUTER, $BDR_RAISEDINNER)) Global Const $EDGE_SUNKEN = (BitOR($BDR_SUNKENOUTER,$BDR_SUNKENINNER))
Edited by gafrost, 04 May 2005 - 10:17 PM.
SciTE for AutoItDirections for Submitting Standard UDFs
Don't argue with an idiot; people watching may not be able to tell the difference.
#51
Posted 04 May 2005 - 10:34 PM
Not: TOP,LEFT,WIDTH,HEIGHT
DllStructSet($coords, 1, 100); left DllStructSet($coords, 2, 200); top DllStructSet($coords, 3, 300); right DllStructSet($coords, 4, 400); bottom
Edited by Ejoc, 04 May 2005 - 10:36 PM.
#52
Posted 04 May 2005 - 10:34 PM
grfFlags
[in] Specifies the type of border. This parameter can be a combination of the following values.
Global Const $BF_ADJUST = 0X2000 Global Const $BF_BOTTOM = 0X8 Global Const $BF_BOTTOMLEFT = (BitOR($BF_BOTTOM,$BF_LEFT)) Global Const $BF_BOTTOMRIGHT = (BitOR($BF_BOTTOM,$BF_RIGHT)) Global Const $BF_DIAGONAL = 0X10 Global Const $BF_DIAGONAL_ENDBOTTOMLEFT = (BitOR($BF_DIAGONAL,$BF_BOTTOM,$BF_LEFT)) Global Const $BF_DIAGONAL_ENDBOTTOMRIGHT = (BitOR($BF_DIAGONAL,$BF_BOTTOM,$BF_RIGHT)) Global Const $BF_DIAGONAL_ENDTOPLEFT = (BitOR($BF_DIAGONAL,$BF_TOP,$BF_LEFT)) Global Const $BF_DIAGONAL_ENDTOPRIGHT = (BitOR($BF_DIAGONAL,$BF_TOP,$BF_RIGHT)) Global Const $BF_FLAT = 0X4000 Global Const $BF_LEFT = 0X1 Global Const $BF_MIDDLE = 0X800 Global Const $BF_MONO = 0X8000 Global Const $BF_RECT = (BitOR($BF_LEFT,$BF_TOP,$BF_RIGHT,$BF_BOTTOM)) Global Const $BF_RIGHT = 0X4 Global Const $BF_SOFT = 0X1000 Global Const $BF_TOP = 0X2 Global Const $BF_TOPLEFT = (BitOR($BF_TOP,$BF_LEFT)) Global Const $BF_TOPRIGHT = (BitOR($BF_TOP,$BF_RIGHT))
SciTE for AutoItDirections for Submitting Standard UDFs
Don't argue with an idiot; people watching may not be able to tell the difference.
#53
Posted 04 May 2005 - 11:15 PM
SciTE for AutoItDirections for Submitting Standard UDFs
Don't argue with an idiot; people watching may not be able to tell the difference.
#54
Posted 05 May 2005 - 10:01 PM
DllStructElementPtr()
Modified DllStructCreate()
DllStructElementPtr($struct,$iElement); returns the ptr to that element in the struct
DllStructCreate("str"[,$iPtr]); you can give it a ptr to use instead of allocating memory, Handy for typecasting. And now when you allocate the memory, the memory is zero'd out on creation, so you should have to worry about zeroing out data when you create it.
$a = DllStructCreate("int") if @error Then MsgBox(0,"","Error in DllStructCreate " & @error); exit endif $b = DllStructCreate("uint",DllStructElementPtr($a,1)) if @error Then MsgBox(0,"","Error in DllStructCreate " & @error); exit endif $c = DllStructCreate("float",DllStructElementPtr($a,1)) if @error Then MsgBox(0,"","Error in DllStructCreate " & @error); exit endif ;set the data DllStructSet($a,1,-1) ;========================================================= ; Display the different data types of the same data ;========================================================= MsgBox(0,"DllStruct",_ "int: " & DllStructGet($a,1) & @CRLF & _ "uint: " & DllStructGet($b,1) & @CRLF & _ "float: " & DllStructGet($c,1) & @CRLF & _ "") DllStructFree($a)
Edited by Ejoc, 05 May 2005 - 10:20 PM.
#55
Posted 07 May 2005 - 09:06 PM
I wrote wrappers so when they hit a beta, you can use the wrappers as a temporary crutch until you get your functions updated.DllStructCreate ( "Struct" [,Pointer]) ------------------> DllStructCreate
Creates a C/C++ style structure for using in DllCall.
Question:
I am not sure to understand how a DllStructCreate( "Struct", Pointer) can be used.
Where does the pointer can come from? add remarks in the doc about it
DllStructElementPtr ( Struct, Element ) -----------------> DllStructGetPtr
Returns the pointer to the element in the struct.
Merge it with DllStructPtr as DllStructGetPtr( Struct [,Element])
DllStructFree ( Struct ) --------------------------------> DllStructDelete
Free the memory allocated during DllStructCreate.
It is better to have Delete which is more commonly use when the initial function is "Create"
Free has Allocate as the correpondance function.
DllStructGet ( Struct, Element [, index ] ) -------------> DllStructGetData
Returns the data in an element of the struct.
I prefer to add what we get to differentiate data and ptr
DllStructPtr ( Struct ) ---------------------------------> DllStructGetPtr
Returns the pointer to the struct that will be used in DllCall.
Add the verb to show what the function is doing.
DllStructSet ( Struct, Element, value [, index ] ) ------> DllStructSetData
Sets the data in an element of the struct.
I prefer to add what we get to differentiate data and ptr
DllStructSize ( Struct ) --------------------------------> DllStructGetSize
Returns the size of the struct in bytes.
Add the verb to show what the function is doing.
#cs vi:ts=4 sw=4: DllStructWrapper Maps old functions to the new functions #ce #include-once Func DllStructElementPtr($a,$i) Return DllStructGetPtr($a,$i) EndFunc Func DllStructGet($a,$i,$n="NOPARAM") if $n = "NOPARAM" Then Return DllStructGetData($a,$i) Return DllStructGetData($a,$i,$n) EndFunc Func DllStructSet($a,$i,$value,$n="NOPARAM") if $n = "NOPARAM" Then Return DllStructSetData($a,$i,$value) Return DllStructSetData($a,$i,$value,$n) EndFunc Func DllStructFree($a) Return DllStructDelete($a) EndFunc Func DllStructSize($a) Return DllStructGetSize($a) EndFunc Func DllStructPtr($a) Return DllStructGetPtr($a) EndFunc
#56
Posted 07 May 2005 - 11:20 PM
Attached Files
#57
Posted 08 May 2005 - 07:45 AM
Very good Ejoc, That's a great support I was afarid how many will ask for that.Ok I made a script converter to update the Old DllStruct function names to the new names introduced in beta 3.1.1.24:
You did it
#58
Posted 11 May 2005 - 06:58 PM
New DllStruct UDF _DllStructGetSizeFromStr($string)
http://www.autoitscript.com/forum/index.ph...indpost&p=75472
#59
Posted 12 May 2005 - 04:59 PM
DllStructReadFromFile($p,"file.bin")
DllStructWriteToFile($p,"file.bin")
Mostly I would see this as a way to read and write binary files.
Could do something like:
$file = "AutoIt.exe" $p = DllStructCreate("byte[" & FileGetSize($file) & "]") DllStructReadFromFile($p,$file) ;do stuff via DllStructSetData & DllStructGetData DllStructWriteToFile($p,$file) DllStructDelete($p)
#60
Posted 12 May 2005 - 05:16 PM
I am not sure it is a good idea to include in DllStruct functions such other way to read/write file.I had a thought, would it be worth it to add:
DllStructReadFromFile($p,"file.bin")
DllStructWriteToFile($p,"file.bin")
Mostly I would see this as a way to read and write binary files.
Could do something like:
$file = "AutoIt.exe" $p = DllStructCreate("byte[" & FileGetSize($file) & "]") DllStructReadFromFile($p,$file) ;do stuff via DllStructSetData & DllStructGetData DllStructWriteToFile($p,$file) DllStructDelete($p)
I will prefer to have an _UDF using FileRead and FileWrite
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users






