J
janhavib
Hi,
I'm trying to access listview control in a VB application from C#
application.
Follwoing is my code
StructLayoutAttribute(LayoutKind.Sequential)]
public struct LV_ITEM
{
public UInt32 mask;
public Int32 iItem;
public Int32 iSubItem;
public UInt32 state;
public UInt32 stateMask;
public String pszText;
public Int32 cchTextMax;
public Int32 iImage;
public IntPtr lParam;
}const int BUFFER_SIZE = 512;
LV.iItem = 3;
LV.mask = Win32API.LVIF_IMAGE;
LV.cchTextMax = 255;
LV.iSubItem = 0;
LV.pszText = new String('\0', 255);
Win32API.SendMessage(hWnd, Win32API.LVM_GETITEMTEXT, 3, ref LV);
string text = LV.pszText.ToString();
My definations are as given below.
const int LVM_FIRST = 0x1000;
const int LVM_GETITEMCOUNT = LVM_FIRST + 4;
const int LVM_GETITEM = LVM_FIRST + 5;
const int LVIF_TEXT = 0x0001;
LVM_GETITEMTEXT = (LVM_FIRST + 45);
[DllImport("user32.dll")]
static extern int SendMessage(IntPtr window, int message, int wparam,
ref LV_ITEM lparam);
My Problem is pszText always returns empty string.
Please help.
Thanks in advance.
J
I'm trying to access listview control in a VB application from C#
application.
Follwoing is my code
StructLayoutAttribute(LayoutKind.Sequential)]
public struct LV_ITEM
{
public UInt32 mask;
public Int32 iItem;
public Int32 iSubItem;
public UInt32 state;
public UInt32 stateMask;
public String pszText;
public Int32 cchTextMax;
public Int32 iImage;
public IntPtr lParam;
}const int BUFFER_SIZE = 512;
LV.iItem = 3;
LV.mask = Win32API.LVIF_IMAGE;
LV.cchTextMax = 255;
LV.iSubItem = 0;
LV.pszText = new String('\0', 255);
Win32API.SendMessage(hWnd, Win32API.LVM_GETITEMTEXT, 3, ref LV);
string text = LV.pszText.ToString();
My definations are as given below.
const int LVM_FIRST = 0x1000;
const int LVM_GETITEMCOUNT = LVM_FIRST + 4;
const int LVM_GETITEM = LVM_FIRST + 5;
const int LVIF_TEXT = 0x0001;
LVM_GETITEMTEXT = (LVM_FIRST + 45);
[DllImport("user32.dll")]
static extern int SendMessage(IntPtr window, int message, int wparam,
ref LV_ITEM lparam);
My Problem is pszText always returns empty string.
Please help.
Thanks in advance.
J