Some Windows messages have a pointer to a structure as the lParam. How do I "follow" this pointer and get the data it points to? I need to be able to read the contents of the structure. I have no idea what to do with the pointer (it's a number).
//Open the dialog box
var result = Interop.Call('comdlg32.dll', 'ChooseColorA', CHOOSECOLOR);
//If the user pressed ok convert it to hex
if(result == 1){
//Get decimal values
var r = CHOOSECOLOR.ReadDWORD(12) & 0xFF;
var g = (CHOOSECOLOR.ReadDWORD(12) / 0x100) & 0xFF;
var b = (CHOOSECOLOR.ReadDWORD(12) / 0x10000) & 0xFF;
Debug.Trace('RGB: ' + r + ',' + g + ',' + b)
//Get hex values
var hexchars="0123456789ABCDEF";
var r = hexchars.charAt((r >> 4) & 0xf) + hexchars.charAt(r & 0xF);
var g = hexchars.charAt((g >> 4) & 0xf) + hexchars.charAt(g & 0xF);
var b = hexchars.charAt((b >> 4) & 0xf) + hexchars.charAt(b & 0xF);
Debug.Trace('HEX: ' + r + g + b);
}
You need to use Interop.Allocate and ReadDWORD and so on