关于键盘钩子的问题,如何把tagEVENTMSG类型转换成 string类型?(50分)

  • 主题发起人 主题发起人 hui717
  • 开始时间 开始时间
H

hui717

Unregistered / Unconfirmed
GUEST, unregistred user!
声明<br>var<br> &nbsp;EventArr:array[0..1000] of EVENTMSG;<br><br>钩子函数<br>function HookProc(iCode:Integer;wParam:WPARAM;lParam:LPARAM):LRESULT;stdcall; &nbsp;//记录操作<br>begin<br> &nbsp;recOK:=1;<br> &nbsp;Result:=0;<br> &nbsp;if iCode &lt; 0 then<br> &nbsp; &nbsp;Result:=CallNextHookEx(hHook,iCode,wParam,lParam)<br> &nbsp;else if iCode = HC_SYSMODALON then<br> &nbsp; &nbsp;recOK:=0<br> &nbsp;else if iCode = HC_SYSMODALOFF then<br> &nbsp; &nbsp;recOK:=1<br> &nbsp;else if ((recOK&gt;0) and (iCode = HC_ACTION)) then<br> &nbsp; &nbsp;begin<br> &nbsp; &nbsp; &nbsp;EventArr[EventLog]:=PEventMSG(lParam)^;<br> &nbsp; &nbsp; &nbsp;EventLog:=EventLog+1;<br> &nbsp; &nbsp; &nbsp;if EventLog &gt;=1000 then<br> &nbsp; &nbsp; &nbsp; &nbsp;begin<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;UnhookWindowsHookEx(hHook)<br> &nbsp; &nbsp; &nbsp; &nbsp;end;<br> &nbsp; &nbsp;end;<br>end;<br><br>现在我想显示记录<br> for i:=0 to Low(EventArr) do<br> &nbsp; begin<br> &nbsp; &nbsp; str:=str+EventArr;<br> &nbsp; end;<br> &nbsp; MessageBox(self.Handle,PChar(str),'系统提示',MB_ICONINFORMATION);<br><br>但提示:<br>[Error] uServer.pas(196): Incompatible types: 'String' and 'tagEVENTMSG'错误<br>该如何转换呀<br><br>请高手帮帮忙
 
跪求高手指点<br><br>急用<br><br>在线等
 
记得这些值好像是int型的。
 
typedef struct tagEVENTMSG { &nbsp; &nbsp;// em &nbsp;<br> &nbsp; &nbsp;UINT &nbsp;message; <br> &nbsp; &nbsp;UINT &nbsp;paramL; <br> &nbsp; &nbsp;UINT &nbsp;paramH; <br> &nbsp; &nbsp;DWORD time; <br> &nbsp; &nbsp;HWND &nbsp;hwnd; <br>} EVENTMSG; <br> 应该取message域吧,转换一下类型,看看。
 

Similar threads

后退
顶部