C#

C#,常用到的Win32 API,方法举例子

最近需要模拟人员去按步骤自动操作某些程序,其中需要用到Win32 API,需要用到辅助工具Microsoft Spy++(WM_COMMAND)去获取程序操作过程的句柄或命令.

//–寻找某个窗体
IntPtr frmHandle = WIN32Util.FindWindow(“{类名}”, “{标题}”);
if (frmHandle == IntPtr.Zero)
throw new Exception(“Frame is not running.”);

//–执行某个命令
int result1 = WIN32Util.PostMessage(frmHandle, 0x0111, 0x000F, 0);

//–寻找弹出对话框
IntPtr Confirm = WIN32Util.FindWindow(“#32770”, “Confirm”);
if (Confirm == IntPtr.Zero)
throw new Exception(“Not Confirm Confirm Frame);

//–寻找子窗体
IntPtr Edit = WIN32Util.FindWindowEx(Confirm, IntPtr.Zero, “Edit”, null);

//–给子窗体的Edit自动输入字符串
string sKill = “KILLALL”;
InputStr(Edit, sKill);

—–以下是会经常用到的方法或类—————————-

 

 

Pls call me CPP.
Posts created 150

12 thoughts on “C#,常用到的Win32 API,方法举例子

  1. I got what you intend, appreciate it for posting .Woh I am lucky to find this website through google. I was walking down the street wearing glasses when the prescription ran out. by Steven Wright. gbedabedeega

  2. Thanks for the sensible critique. Me &amp my neighbor were just preparing to do a little research about this. We got a grab a book from our area library but I think I learned more clear from this post. I am very glad to see such wonderful info being shared freely out there. ccfgkdadbbgf

  3. if making snowfall leaps Hermes purses And totes operating 3ounce throwaway duplicate Hermes cups of coffee or even a conforms icle, pour the juices a mixture on the road to these kind of people until it is they have been perfect possessions wall plug ecommerce better than nearly full. edebgedcabdf

发表评论

Related Posts

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top