Jump to content

SpD2X: Difference between revisions

From EDM2
Created page with "This function performs a decimal to hexadecimal conversation. In contrast to D2X, spD2X can deal with ULONG values. '''Syntax:''' hexVal = spD2X ( decVal [ , [ type ] ] ) ''..."
 
Ak120 (talk | contribs)
mNo edit summary
 
(5 intermediate revisions by 2 users not shown)
Line 6: Line 6:


type – type of value. If specified, leading zeros are returned. To get uppercase letters, you have to specify the type in uppercase.
type – type of value. If specified, leading zeros are returned. To get uppercase letters, you have to specify the type in uppercase.
 
{| class="wikitable"
type description decimal value range hexadecimal value range
!type||description||decimal value range||hexadecimal value range
'n' unsigned nibble (4 bit value) 0-15 0-F
|-
'b' unsigned byte (8 bit value) 0-255 00-FF
| 'n'|| unsigned nibble (4 bit value) ||0-15 ||0-F
's' unsigned short (2 byte value) 0-65536 0000-FFFF
|-
'l' unsigned long (4 byte value) 0-4294967295 00000000-FFFFFFFF
| 'b'|| unsigned byte (8 bit value) ||0-255 ||00-FF
|-
| 's'|| unsigned short (2 byte value)|| 0-65536|| 0000-FFFF
|-
| 'l'|| unsigned long (4 byte value)|| 0-4294967295|| 00000000-FFFFFFFF
|-
|}
''Table 1 spD2X value types''
''Table 1 spD2X value types''


Line 21: Line 27:
  SAY sp||'handle: '||ARG(2)||' (0x'||spD2X(ARG(2),'l')||')'
  SAY sp||'handle: '||ARG(2)||' (0x'||spD2X(ARG(2),'l')||')'
  [...]
  [...]
[[Category:SpUtils]]

Latest revision as of 15:59, 12 October 2022

This function performs a decimal to hexadecimal conversation. In contrast to D2X, spD2X can deal with ULONG values.

Syntax: hexVal = spD2X ( decVal [ , [ type ] ] )

Parameters: decVal – the value to be converted

type – type of value. If specified, leading zeros are returned. To get uppercase letters, you have to specify the type in uppercase.

type description decimal value range hexadecimal value range
'n' unsigned nibble (4 bit value) 0-15 0-F
'b' unsigned byte (8 bit value) 0-255 00-FF
's' unsigned short (2 byte value) 0-65536 0000-FFFF
'l' unsigned long (4 byte value) 0-4294967295 00000000-FFFFFFFF

Table 1 spD2X value types

Returns: hexadecimal value

Example Code: (part of spSetAutoSleep example code)

/* wininfo.cmd (spUtils Example Code) */
[...]
SAY sp||'handle: '||ARG(2)||' (0x'||spD2X(ARG(2),'l')||')'
[...]