本文整理自网络,侵删。
SendMessage这个函数有很多奇妙的用途
举例:
1,获得MEMO中的光标位置.
Lops:=SendMessage(memol.Handle,EM_LINEFROMCHAR,Memol.SelStart,0);//光标所在的行号
Cpos:=SendMessage(meno1.Handle,EM_LINEINDEX,Lpos,0);//光标所在的字符位置
LineLength:=SendMessage(memol.handle,EM_LINELENGTH,Cpos,0);//这行的字符数.
2,开关显示器.
SendMessage(Handle, WM_SYSCOMMAND, SC_MONITORPOWER,2);//关闭显示器.
SendMessage(Handle, WM_SYSCOMMAND, SC_MONITORPOWER, -1);//打开显示器.
3,有人问我如何让Memo翻页,我试了一下,
Next:
sendmessage(memo1.handle,wm_keydown,VK_NEXT,-1);
sendmessage(memo1.handle,wm_keyup,VK_NEXT,-1);
Prev:
sendmessage(memo1.handle,wm_keydown,VK_PRIOR,-1);
sendmessage(memo1.handle,wm_keyup,VK_PRIOR,-1);
相关阅读 >>
winapi 字符及字符串函数(10): lstrcpy - 复制字符串
Delphi 正则表达式tperlregex 类的属性与方法
更多相关阅读请进入《Delphi》频道 >>