帮忙C#一小段代码转化为delphi,谢谢哦
{intx=100;//Xcoordinateoftheclickinty=80;//YcoordinateoftheclickIntPtrhandle=webBrows...
{
int x = 100; // X coordinate of the click
int y = 80; // Y coordinate of the click
IntPtr handle = webBrowser1.Handle;
StringBuilder className = new StringBuilder(100);
while (className.ToString() != "Internet Explorer_Server")
{
handle = GetWindow(handle, 5);
GetClassName(handle, className, className.Capacity);
}
IntPtr lParam = (IntPtr)((y << 16) | x);
IntPtr wParam = IntPtr.Zero;
const uint downCode = 0x201;
const uint upCode = 0x202;
SendMessage(handle, downCode, wParam, lParam);
SendMessage(handle, upCode, wParam, lParam);
}
}
网上的一段C#代码看不懂,请大侠们帮忙翻译一下,帮忙解析为delphi代码,谢谢哦 展开
int x = 100; // X coordinate of the click
int y = 80; // Y coordinate of the click
IntPtr handle = webBrowser1.Handle;
StringBuilder className = new StringBuilder(100);
while (className.ToString() != "Internet Explorer_Server")
{
handle = GetWindow(handle, 5);
GetClassName(handle, className, className.Capacity);
}
IntPtr lParam = (IntPtr)((y << 16) | x);
IntPtr wParam = IntPtr.Zero;
const uint downCode = 0x201;
const uint upCode = 0x202;
SendMessage(handle, downCode, wParam, lParam);
SendMessage(handle, upCode, wParam, lParam);
}
}
网上的一段C#代码看不懂,请大侠们帮忙翻译一下,帮忙解析为delphi代码,谢谢哦 展开
若以下回答无法解决问题,邀请你更新回答
展开全部
function xxxxx;
var
x, y, m : integer;
lpWnd : THandle;
lpName : pchar;
begin
x := 100; y := 80;
getMem(lpName, 100);
fillchar(lpName[0], 100, 0);
lpWnd := webBrowser1.Handle;
while s <> 'Internet Explorer_Server' do begin
lpWnd := GetWindow(lpWnd, 5);
fillchar(lpName[0], 100, 0);
GetClassName(lpWnd, lpName,100);
end;
freeMem(lpName, 100);
m := (y shl 16) or x;
SendMessage(lpWnd, WM_LBUTTONDOWN, 0, m);
SendMessage(lpWnd, WM_LBUTTONUP, 0, m);
end;
这个代码功能其实还比较简单,
一是通过WebBrower控件的类名称查询,找到IE控件的对应句柄,,
二是通过上面的句柄,向该IE发送一个点击消息(即模拟鼠标,一个鼠标按下,一个鼠标弹起,并给出位置),
var
x, y, m : integer;
lpWnd : THandle;
lpName : pchar;
begin
x := 100; y := 80;
getMem(lpName, 100);
fillchar(lpName[0], 100, 0);
lpWnd := webBrowser1.Handle;
while s <> 'Internet Explorer_Server' do begin
lpWnd := GetWindow(lpWnd, 5);
fillchar(lpName[0], 100, 0);
GetClassName(lpWnd, lpName,100);
end;
freeMem(lpName, 100);
m := (y shl 16) or x;
SendMessage(lpWnd, WM_LBUTTONDOWN, 0, m);
SendMessage(lpWnd, WM_LBUTTONUP, 0, m);
end;
这个代码功能其实还比较简单,
一是通过WebBrower控件的类名称查询,找到IE控件的对应句柄,,
二是通过上面的句柄,向该IE发送一个点击消息(即模拟鼠标,一个鼠标按下,一个鼠标弹起,并给出位置),
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询