Adele Posted January 27, 2015 Share Posted January 27, 2015 Hi. I do a project running with AutoIt and PHP, so I need binary type of AutoIt. There is a function on AutoIt for converting string to binary. But there are many binary type on php. Thank you in advance. a - NUL-padded string A - SPACE-padded string h - Hex string, low nibble first H - Hex string, high nibble first c - signed char C - unsigned char s - signed short (always 16 bit, machine byte order) S - unsigned short (always 16 bit, machine byte order) n - unsigned short (always 16 bit, big endian byte order) v - unsigned short (always 16 bit, little endian byte order) i - signed integer (machine dependent size and byte order) I - unsigned integer (machine dependent size and byte order) l - signed long (always 32 bit, machine byte order) L - unsigned long (always 32 bit, machine byte order) N - unsigned long (always 32 bit, big endian byte order) V - unsigned long (always 32 bit, little endian byte order) f - float (machine dependent size and representation) d - double (machine dependent size and representation) x - NUL byte X - Back up one byte Z - NUL-padded string @ - NUL-fill to absolute position Link to comment Share on other sites More sharing options...
nightwatcher Posted April 13, 2018 Share Posted April 13, 2018 (edited) On 2015/1/28 at 6:21 AM, Adele said: hey bro ,have you found the relationship between php and autoit ? I came across some problem , can you give me some hints . in autoit , how to define a signed byte or signed char? also , I am wondering why UINT64 seems to not work. Global $asTypes[] = ["byte","ubyte","short","USHORT", "INT", "UINT","long","ULONG", "INT64", "UINT64"] Global $avValues[] = [-1, 0,1] Global $g_tData For $i = 0 To UBound($asTypes) - 1 $g_tData = DllStructCreate($asTypes[$i]) ConsoleWrite($asTypes[$i] & ":" & @CRLF) For $j = 0 To UBound($avValues) - 1 ConsoleWrite("IN: " & $avValues[$j] & " OUT: " & DllStructSetData($g_tData, 1, $avValues[$j]) & @CRLF) Next Next I got the answer byte: IN: -1 OUT: 255 IN: 0 OUT: 0 IN: 1 OUT: 1 UINT64: IN: -1 OUT: -1 IN: 0 OUT: 0 IN: 1 OUT: 1 but i was to get answer like following byte: IN: -1 OUT: -1 IN: 0 OUT: 0 IN: 1 OUT: 1 UINT64: IN: -1 OUT: 9223372036854775807 IN: 0 OUT: 0 IN: 1 OUT: 1 Edited April 13, 2018 by nightwatcher Link to comment Share on other sites More sharing options...
jchd Posted April 13, 2018 Share Posted April 13, 2018 AutoIt DllStructs do not have a signed byte (let alone a signed char) nor an unsigned INT64. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
nightwatcher Posted April 14, 2018 Share Posted April 14, 2018 10 hours ago, jchd said: AutoIt DllStructs do not have a signed byte (let alone a signed char) nor an unsigned INT64. Tks for the answer. Another question, when I try to trans this winstruct into autoit. the third para,seem to not work when I declare it as uint. reference:https://msdn.microsoft.com/zh-cn/library/bb775514 typedef struct tagNMHDR { HWND hwndFrom; UINT_PTR idFrom; UINT code; }NMHDR; here is my code. #include <WindowsConstants.au3> $hForm = GUICreate("treeview", 200, 100) $hTree = GUICtrlCreateTreeView(0, 0, 200, 100) GUISetState() GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") While 1 $Msg = GUIGetMsg() Switch $Msg Case -3 Exit EndSwitch WEnd Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam) Local $hWndFrom, $iCode, $tNMHDR $tNMHDR = DllStructCreate('HWND hwndFrom;UINT_PTR idFrom;UINT code;', $lParam) ;最后一个参数修改为Uint则无效。 $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case GUICtrlGetHandle($hTree) Switch $iCode Case $NM_CLICK MsgBox(0, '$iCode=' & $iCode, '单击', 1, $hForm) EndSwitch EndSwitch EndFunc ;==>WM_NOTIFY but change 'UINT code' to INT code,this works well . can U point out the reason why the 'INT' work and the 'UINT' not work? Link to comment Share on other sites More sharing options...
jchd Posted April 14, 2018 Share Posted April 14, 2018 Probably because Switch..Case uses INT64 in one case and INT32 in the other. Run this and then re-run after changing uINT to INT to see the difference. I don't know if this is worth filing a ticket (if this hasn't been reported already in Trac). This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
jpm Posted April 14, 2018 Share Posted April 14, 2018 If you the standard $tagNMHDR you will not get this problem. I cannot remember why the uint has been change to INT but I think MSDN describe $NM_CLICK as an INT So AS we don't want to change the $NM_CLICK and others you have to use $tagNHMHDR Sorry for this "discrepancy" Link to comment Share on other sites More sharing options...
nightwatcher Posted April 14, 2018 Share Posted April 14, 2018 3 hours ago, jpm said: If you the standard $tagNMHDR you will not get this problem. I cannot remember why the uint has been change to INT but I think MSDN describe $NM_CLICK as an INT So AS we don't want to change the $NM_CLICK and others you have to use $tagNHMHDR Sorry for this "discrepancy" tks , I have seen the standard defination . In the doucument , this para is declared as INT, and $NM_CLICK as INT. I pretend to already get what I want,whatever. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now