Jump to content

Help for float byte


Recommended Posts

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

Link to comment
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]

Link to comment
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

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.
Link to comment
Share on other sites

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
Link to comment
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.
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...