如下代码错在哪?出现乱码,大家伙帮忙看看
procedure TForm1.btn1Click(Sender: TObject);var PID,t:LongWord; hwnd,hProcess:Thandle; iItem:Integer; lvitem:TLVITEM; plvitem:^tLVITEM; p_MyItemText,str_MyItemText:PChar;begin str_MyItemText:='北京欢迎你'; hwnd:=FindWindow('#32770','Windows 任务管理器'); hwnd:=FindWindowEx(hwnd,0,'#32770',0); hwnd:=FindWindowEx(hwnd,0,'SysListView32',0); if hwnd=0 then ShowMessage('[Windows 任务管理器] 尚未启动!') else begin GetWindowThreadProcessId(hwnd, @PID); hProcess:=OpenProcess(PROCESS_ALL_ACCESS,false,PID); if hProcess=0 then ShowMessage('获取进程句柄操作失败') else begin plvitem:=VirtualAllocEx(hProcess, nil, sizeof(LVITEM), MEM_COMMIT, PAGE_READWRITE); p_MyItemText:=PChar(VirtualAllocEx(hProcess, nil, 12, MEM_COMMIT, PAGE_READWRITE)); if (plvitem=nil) or (p_MyItemText='') then ShowMessage('无法分配内存') else begin ShowMessage('本演示程序将更改TaskManager中第6个项目中第1列的内容。'); iItem:=5; lvitem.iSubItem:=0; lvitem.pszText:=p_MyItemText; WriteProcessMemory(hProcess, p_MyItemText, @str_MyItemText, 12, t); WriteProcessMemory(hProcess, plvitem, @lvitem, sizeof(LVITEM), t); SendMessage(hwnd, LVM_SETITEMTEXT, iItem, Integer(plvitem)); //出来的不是“北京欢迎你” 是“h“E ”问题在哪?谢谢 end; end; end;end;