Jump to content



Photo

Help for float byte


  • Please log in to reply
8 replies to this topic

#1 cordand

cordand

    Seeker

  • New Members
  • 4 posts

Posted 12 June 2009 - 10:19 PM

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







#2 Zisly

Zisly

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 252 posts

Posted 12 June 2009 - 10:26 PM

Checkout Hex in the helpfile.

#3 cordand

cordand

    Seeker

  • New Members
  • 4 posts

Posted 12 June 2009 - 10:40 PM

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

#4 Skruge

Skruge

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 618 posts

Posted 12 June 2009 - 10:52 PM

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?
"Tougher than the toughies and smarter than the smarties"

#5 trancexx

trancexx

    Hm, I really shouldn't.

  • Active Members
  • PipPipPipPipPipPip
  • 5,194 posts

Posted 12 June 2009 - 10:53 PM

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


#6 martin

martin

    ~~\o/~~~/0\=¬''~~~

  • MVPs
  • 7,199 posts

Posted 12 June 2009 - 10:57 PM

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, 13 June 2009 - 10:42 AM.

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.

#7 cordand

cordand

    Seeker

  • New Members
  • 4 posts

Posted 13 June 2009 - 10:12 AM

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, 13 June 2009 - 10:18 AM.


#8 martin

martin

    ~~\o/~~~/0\=¬''~~~

  • MVPs
  • 7,199 posts

Posted 13 June 2009 - 10:38 AM

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.

#9 cordand

cordand

    Seeker

  • New Members
  • 4 posts

Posted 13 June 2009 - 12:00 PM

this is perfetct!!! thank you!!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users