Sign in to follow this  
Followers 0
cordand

Help for float byte

9 posts in this topic

Hi guys i'm just registered in this forum ...:

i've a little problem in my program:

i would convert a decimal value (float) into hex value

could you help me please?

I'm sorry for my bad english but i'm italian

thanks

Share this post


Link to post
Share on other sites



Checkout Hex in the helpfile.

Share this post


Link to post
Share on other sites

Yes but my problem is that i'm working with float byte and i don't know to set that are float byte

Share this post


Link to post
Share on other sites

Yes but my problem is that i'm working with float byte and i don't know to set that are float byte

Does Binary give you the result you're looking for?

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites

Yes but my problem is that i'm working with float byte and i don't know to set that are float byte

Could you show what you are working with?

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Yes but my problem is that i'm working with float byte and i don't know to set that are float byte

You need to create a value for a variable which is of type float and then read it as type ptr I think

$sF = Dllstructcreate("float")
 $sB = DllStructCreate("ptr",DllStructGetPtr($sF))
 
 DllstructSetData($sF,1,$Floatval)
 msgbox(262144,"ANS",DllStructGetData($sB),1)

EDIT: Corrected by adding missing parameter for the struct element in DllSTructSetData and DllStructGetData.

Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

You need to create a value for a variable which is of type float and then read it as type ptr I think

$sF = Dllstructcreate("float")
$sB = DllStructCreate("ptr",DllStructGetPtr($sF))

DllstructSetData($sF,$Floatval)
msgbox(262144,"ANS",DllStructGetData($sB))
mm i don't understand.... can you explain me in pm or with msn?

Where put i the float value

i put the float value in the $floatvalue but there is a error the return value is only 0

Edited by cordand

Share this post


Link to post
Share on other sites

mm i don't understand.... can you explain me in pm or with msn?

Where put i the float value

i put the float value in the $floatvalue but there is a error the return value is only 0

Yes, I didn't check what I posted. I should have written

$sF = DllStructCreate("float")
$sB = DllStructCreate("ptr", DllStructGetPtr($sF))
While 1
    $floatval = InputBox("Next value", "Enter a number, eg 123.7")
    If $floatval = "" Then Exit
    DllStructSetData($sF, 1, $floatval)
    MsgBox(262144, "ANS", DllStructGetData($sB, 1))
WEnd

This and This might also be useful.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

this is perfetct!!! thank you!!

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0