JavaScript code:
function InserColumn(hWnd,iCol,Header)
{
//Message constants
var LVM_INSERTCOLUMN = 0x101B;
var LVCF_TEXT = 0x4;
var LVCF_WIDTH = 0x2;
var cx= Interop.Allocate(4)//How do I know how much bytes I need?
cx.WriteWord(0, 50)
var pszText=Interop.Allocate((Header.length+2)*2)
pszText.WriteString(0, Header,true)
//Create an LVCOLUMN structure
var LVCOLUMN = Interop.Allocate(32);
LVCOLUMN.WriteDWord(0, LVCF_WIDTH); //How do I know the offset?
LVCOLUMN.WriteDWord(6, cx.DataPtr); //How do I know the offset?
LVCOLUMN.WriteDWord(16, LVCF_TEXT); //How do I know the offset?
LVCOLUMN.WriteDWord(22, pszText.DataPtr); //How do I know the offset?
var Result = Interop.Call("user32", "SendMessageW", hWnd, LVM_INSERTCOLUMN, iCol, LVCOLUMN);
//Clear the DataBlocs
cx.Size = 0;
pszText.size=0;
LVCOLUMN.Size = 0
//Return the result
return Result;
}
as said in the comments how do I know the cx bytes and offset when I create the structure?