ByteOperations

GetXYFromDWord, HIBYTE, HIWORD, LOBYTE, LOWORD

GetXYFromDWord

Description 

 GetXYFromDWord(
    LParam,
   int *pPosX,
   int *pPosY
);

Creates pX and pY from the lParam parameter. It is the same as LOWORD(lParam), HIWORD(lParam), but in addition it handles +/- signs correctly.

Parameters

LParam

x = LOWORD(LParam), y = HIWORD(LParam)

int *pPosX

Pointer to the X coordinate.

int *pPosY

Pointer to the Y coordinate.

Examples:
// LINE_PARALLEL example
// This macro fetches offset of user drawn parallel line
// Coordinates of reference line
dword xStart = 100;
dword yStart = 100;
dword xEnd = 200;
dword yEnd = 200;
// Offset of drawn line
dword result = 0;
int distX = 0;
int distY = 0;
result = Int_DrawLine(LINE_PARALLEL, 255, 100, 100, 0, &xStart, &yStart, &xEnd, &yEnd, 1);
// Get offset coordinates
GetXYFromDWord(result, &distX, &distY);
HIBYTE

Description 

 HIBYTE(
   word  wParam
);

This function extracts and returns the high-order byte from the 16-bit integer value specified by the wParam parameter.

Parameters

word wParam

16-bit integer

See Also 
LOBYTE, HIWORD, LOWORD

HIWORD

Description 

 HIWORD(
   dword  IParam
);

This function retrieves the high-order word from the 32-bit integer value specified by the lParam parameter.

Parameters

dword IParam

32-bit integer

See Also 
LOWORD, HIBYTE, LOBYTE

LOBYTE

Description 

 LOBYTE(
   dword  wParam
);

This function extracts and returns the low-order byte from the 16-bit integer value specified by the wParam parameter.

Parameters

dword wParam

16-bit integer

See Also 
LOWORD, HIBYTE, HIWORD

LOWORD

Description 

 LOWORD(
   dword  IParam
);

This function extracts and returns the low-order word from the 32-bit integer value specified by the lParam parameter.

Parameters

dword IParam

32-bit integer

// LOBYTE,HIBYTE,LOWORD,HIWORD example - shows how to use these functions.
dword    carry[100],i;
word     p1,p2,p3,p4;       
char     buf[256]; 
Int_CreateTextWindow("API Example - LOBYTE,HIBYTE,LOWORD,HIWORD functions.",0,RGB(0,0,128),RGB_WHITE,100);
SetCommandText("Working...");
for(i=0;i<100;i=i+1)
   carry[i] = (i/4)+((i/5)*256)+((i/6)*65536)+((i/7)*16777216);
Int_CreateWindow(1,"API Example",7,100,100,180,400,"",1,1,0.00000,0,1,0,"Arial,B,8");
for(i=0;i<100;i=i+1)
   {
   p1 = LOBYTE(LOWORD(carry[i]));
   p2 = HIBYTE(LOWORD(carry[i]));
   p3 = LOBYTE(HIWORD(carry[i]));
   p4 = HIBYTE(HIWORD(carry[i]));
   sprintf(buf,"    %i\t  %i\t  %i\t  %i\n","p1,p2,p3,p4");
   Int_SetWindowText(1,buf,1);
   }
Int_CloseTextWindow();

See Also 
LOBYTE, HIBYTE, HIWORD