Jump to content



Photo

DllStruct Dev


  • Please log in to reply
70 replies to this topic

#41 Ejoc

Ejoc

    What's DllStruct?

  • Active Members
  • PipPipPipPipPipPip
  • 509 posts

Posted 02 May 2005 - 06:42 PM

That's cool, will make customizing GUIs pretty easy.
Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs







#42 GaryFrost

GaryFrost

    I don't need your attitude. I have one of my own

  • Developers
  • 7,854 posts

Posted 02 May 2005 - 06:43 PM

Already fixed up for udfs and sent to jdeb

SciTE for AutoItDirections for Submitting Standard UDFs

Don't argue with an idiot; people watching may not be able to tell the difference.


#43 Jos

Jos

    oh joy ...

  • Developers
  • 21,071 posts

Posted 02 May 2005 - 08:37 PM

Already fixed up for udfs and sent to jdeb

<{POST_SNAPBACK}>

Looks 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 ?

:(

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)


#44 GaryFrost

GaryFrost

    I don't need your attitude. I have one of my own

  • Developers
  • 7,854 posts

Posted 02 May 2005 - 09:00 PM

Looks 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 ?

:(

<{POST_SNAPBACK}>

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

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 GaryFrost

GaryFrost

    I don't need your attitude. I have one of my own

  • Developers
  • 7,854 posts

Posted 03 May 2005 - 12:26 AM

Sent the updated udf with the previous post enhancements added into them to jdeB.

SciTE for AutoItDirections for Submitting Standard UDFs

Don't argue with an idiot; people watching may not be able to tell the difference.


#46 Jos

Jos

    oh joy ...

  • Developers
  • 21,071 posts

Posted 03 May 2005 - 07:21 PM

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

<{POST_SNAPBACK}>

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 !!

:(

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)


#47 Josbe

Josbe

    Infrequent ghost ☺

  • Active Members
  • PipPipPipPipPipPip
  • 1,585 posts

Posted 03 May 2005 - 07:25 PM

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 !!

:(

<{POST_SNAPBACK}>

Very well! Thanks: Ejoc, gafrost and JdeB. :(

#48 Ejoc

Ejoc

    What's DllStruct?

  • Active Members
  • PipPipPipPipPipPip
  • 509 posts

Posted 04 May 2005 - 07:52 PM

Also... Is there a way to get a piece of a struct pointer? DLLStructGetMem?

Lar.

<{POST_SNAPBACK}>

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.

*Edit
Moved this to post #1

Edited by Ejoc, 11 May 2005 - 06:54 PM.

Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs

#49 layer

layer

    i love skateboarding

  • Active Members
  • PipPipPipPipPipPip
  • 2,470 posts

Posted 04 May 2005 - 10:00 PM

Figure I'd ask this in here... Am I doing this right? I see no edge on my screen, I must be doing it wrong :(
#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
:(
FootbaG

#50 GaryFrost

GaryFrost

    I don't need your attitude. I have one of my own

  • Developers
  • 7,854 posts

Posted 04 May 2005 - 10:03 PM

I believe your HDC be an "hwnd" instead of an "int"

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 Ejoc

Ejoc

    What's DllStruct?

  • Active Members
  • PipPipPipPipPipPip
  • 509 posts

Posted 04 May 2005 - 10:34 PM

RECT is : TOP,LEFT,RIGHT,BOTTOM
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.

Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs

#52 GaryFrost

GaryFrost

    I don't need your attitude. I have one of my own

  • Developers
  • 7,854 posts

Posted 04 May 2005 - 10:34 PM

Forgot the info about the last param

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 GaryFrost

GaryFrost

    I don't need your attitude. I have one of my own

  • Developers
  • 7,854 posts

Posted 04 May 2005 - 11:15 PM

:( I sure wasn't going to mess with, I believe you have to do beginpaint and endpaint, then you get into the paint structure also.

SciTE for AutoItDirections for Submitting Standard UDFs

Don't argue with an idiot; people watching may not be able to tell the difference.


#54 Ejoc

Ejoc

    What's DllStruct?

  • Active Members
  • PipPipPipPipPipPip
  • 509 posts

Posted 05 May 2005 - 10:01 PM

Next beta should have:
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.

Plain Text         
$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.

Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs

#55 Ejoc

Ejoc

    What's DllStruct?

  • Active Members
  • PipPipPipPipPipPip
  • 509 posts

Posted 07 May 2005 - 09:06 PM

This is a heads up! Function names will be changing to make them more standardized. I feel these are good changes.

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.

I wrote wrappers so when they hit a beta, you can use the wrappers as a temporary crutch until you get your functions updated.

Plain Text         
#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

Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs

#56 Ejoc

Ejoc

    What's DllStruct?

  • Active Members
  • PipPipPipPipPipPip
  • 509 posts

Posted 07 May 2005 - 11:20 PM

Ok I made a script converter to update the Old DllStruct function names to the new names introduced in beta 3.1.1.24:

Attached Files


Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs

#57 jpm

jpm

    a Real GUI/debug lover

  • Developers
  • 8,925 posts

Posted 08 May 2005 - 07:45 AM

Ok I made a script converter to update the Old DllStruct function names to the new names introduced in beta 3.1.1.24:

<{POST_SNAPBACK}>

Very good Ejoc, That's a great support I was afarid how many will ask for that.
You did it :(

#58 Ejoc

Ejoc

    What's DllStruct?

  • Active Members
  • PipPipPipPipPipPip
  • 509 posts

Posted 11 May 2005 - 06:58 PM

Made post #1 host my UDFs for DllStruct, I may try adding them to the beta as UDFs.

New DllStruct UDF _DllStructGetSizeFromStr($string)

http://www.autoitscript.com/forum/index.ph...indpost&p=75472
Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs

#59 Ejoc

Ejoc

    What's DllStruct?

  • Active Members
  • PipPipPipPipPipPip
  • 509 posts

Posted 12 May 2005 - 04:59 PM

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)

Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs

#60 jpm

jpm

    a Real GUI/debug lover

  • Developers
  • 8,925 posts

Posted 12 May 2005 - 05:16 PM

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)

<{POST_SNAPBACK}>

I am not sure it is a good idea to include in DllStruct functions such other way to read/write file.
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