Forum Discussion

tandreys's avatar
tandreys
Occasional Contributor
14 years ago

pb passing numeric variable by reference to a DLL function

when I pass numeric variable by reference to a function in an external DLL, the modified value are not visible in TC.

In the example below, after the call to the function, the value of nrow and ncol is still 0.

Passing a structure, a string (via dll.new("lpstr")) is working fine.



any idea?

thanks



LONG WINAPI GridGetSelectedCell(HWND hWndGrid, unsigned long* row, unsigned long* col)

{

 *row=2;

 *col=3;

 return 1;

}



in TC (7.52)

[jscript]

MY_DLL.DefineProc("GridGetSelectedCell",vt_i4,vt_byref | vt_ui4,vt_byref | vt_ui4,vt_hresult );

mydll = DLL.Load("D:\\auto\\current\\Tools\\Syb_qa\\Debug\\syb_qa.dll","MY_DLL")

...

var nrow=0;

var ncol=0;

mydll.GridGetSelectedCell(SGridWnd.Handle,nrow,ncol);

//I'm expecting nrow=3, ncol=2