Hi.
I'm trying to find the listitem of a listview control(mscomctl.ocx) from Visual FoxPro. The problem is, you can't declare types in VFP, hence i can't use the SendMessage API directly from VFP..
I've tried to create a c++ dll, but can't make it work..
I know it has something to do with WPARAM, as you can see, i send the address of the pointer to the struct, but i don't think that's correct..?
It only returns -1.
Dll code:
Code:
#define DLLEXPORT __declspec(dllexport)
#define LVW_FINDITEM 4153
typedef struct lvwInfo{
long lX;
long lY;
long lFlags;
long lItm;
long lSubItm;
} LVWINFO;
int DLLEXPORT CALLBACK getItem(HWND hWnd, int x, int y){
LVWINFO lvMsg;
// Send request to listview for listindex
lvMsg.lX = x;
lvMsg.lY = x;
SendMessage(hWnd, LVW_FINDITEM, 0, (WPARAM)&lvMsg);
return((lvMsg.lItm)?lvMsg.lItm: -1);
}
VFP Code, this returns -1:
Code:
iItem = getItem(List1.hWnd, x, y)