怎么发消息给其他程序syslistview32控件让其选中某一行
1个回答
展开全部
procedure ListViewOperator.SetItemSelected(nItemIndex: Integer ); //选中某一个ITEM
var
lvitem: LVITEM; // 静态结构
nRet: Integer;
hRet: HRESULT;
begin
lvitem.mask := LVIF_STATE;
lvitem.iSubItem := 0;
lvitem.state := LVIS_SELECTED or LVIS_FOCUSED;
lvitem.stateMask := LVIS_SELECTED or LVIS_FOCUSED;
nRet := WriteProcessMemory( m_hProcess, m_pLVItem, @lvitem, sizeof(LVITEM), Nil); // 将本地进程中的结构写入到目标进程
Assert( (nRet == 0), 'Write Process memory failed' );
hRet := SendMessage( m_hwnd, LVM_SETITEMSTATE, WPARAM(nItemIndex), LPARAM(m_pLVItem) );//发送消息
Assert( FAILED(hRet), 'Send message failed' );
end;
var
lvitem: LVITEM; // 静态结构
nRet: Integer;
hRet: HRESULT;
begin
lvitem.mask := LVIF_STATE;
lvitem.iSubItem := 0;
lvitem.state := LVIS_SELECTED or LVIS_FOCUSED;
lvitem.stateMask := LVIS_SELECTED or LVIS_FOCUSED;
nRet := WriteProcessMemory( m_hProcess, m_pLVItem, @lvitem, sizeof(LVITEM), Nil); // 将本地进程中的结构写入到目标进程
Assert( (nRet == 0), 'Write Process memory failed' );
hRet := SendMessage( m_hwnd, LVM_SETITEMSTATE, WPARAM(nItemIndex), LPARAM(m_pLVItem) );//发送消息
Assert( FAILED(hRet), 'Send message failed' );
end;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询