想切换到C#程序根本没响应。
只有关掉那个利用api点开的子窗口才恢复正常。??为什么?有什么办法可以解决??namespace WindowsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
[DllImport("User32.dll", EntryPoint = "FindWindow")]
private static extern IntPtr FindWindow(string lpClassName,
string lpWindowName); [DllImport("user32.dll", EntryPoint = "FindWindowEx")]
private static extern IntPtr FindWindowEx(IntPtr hwndParent,
IntPtr hwndChildAfter, string lpszClass, string lpszWindow); [DllImport("User32.dll", EntryPoint = "SendMessage")]
private static extern int SendMessage(IntPtr hWnd,
int Msg, IntPtr wParam, int lParam); [DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool SetForegroundWindow(IntPtr hWnd); [DllImport("User32.dll", EntryPoint = "ShowWindow")]
private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); const int WM_GETTEXT = 0x000D;
const int WM_SETTEXT = 0x000C;
const int WM_CLICK = 0x00F5;
const int SW_MAXIMIZE = 3; //9为最小化 private void SearchWindow()
{
//下面的这些参数都可以用到Spy++查到
string lpszParentClass = "WindowsForms10.Window.8.app.0.378734a"; //整个窗口的类名
string lpszParentWindow = "编辑发布设置"; //窗口标题
string lpclass1="WindowsForms10.Window.8.app.0.378734a";
string lpname1="登录操作"; string lpclass2 = "WindowsForms10.BUTTON.app.0.378734a";
string lpname2 = "内置浏览器中登录"; IntPtr ParentWnd = new IntPtr(0);
IntPtr EdithWnd = new IntPtr(0);
IntPtr P1 = new IntPtr(0);
IntPtr p2 = new IntPtr(0);
IntPtr p3 = new IntPtr(0); //查到窗体,得到整个窗体
ParentWnd = FindWindow(lpszParentClass, lpszParentWindow);
P1 = FindWindowEx(ParentWnd, P1, lpclass1, lpname1);
p2 = FindWindowEx(P1, p2, lpclass2, lpname2);
p3 = FindWindow(null, "内置微型浏览器");/////////问题就在这里!!!可以运行下一步点开窗口,后C#程序就没反映了,只有关掉用SendMessage点开的窗口才会恢复正常,后门的两句根本不能执行最大化,和前置///////////////////////////////
SendMessage(p2, WM_CLICK, (IntPtr)0, 0);
ShowWindow(p3, SW_MAXIMIZE);
SetForegroundWindow(p3);
} private void button1_Click(object sender, EventArgs e)
{
SearchWindow();
}
}
}
只有关掉那个利用api点开的子窗口才恢复正常。??为什么?有什么办法可以解决??namespace WindowsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
[DllImport("User32.dll", EntryPoint = "FindWindow")]
private static extern IntPtr FindWindow(string lpClassName,
string lpWindowName); [DllImport("user32.dll", EntryPoint = "FindWindowEx")]
private static extern IntPtr FindWindowEx(IntPtr hwndParent,
IntPtr hwndChildAfter, string lpszClass, string lpszWindow); [DllImport("User32.dll", EntryPoint = "SendMessage")]
private static extern int SendMessage(IntPtr hWnd,
int Msg, IntPtr wParam, int lParam); [DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool SetForegroundWindow(IntPtr hWnd); [DllImport("User32.dll", EntryPoint = "ShowWindow")]
private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); const int WM_GETTEXT = 0x000D;
const int WM_SETTEXT = 0x000C;
const int WM_CLICK = 0x00F5;
const int SW_MAXIMIZE = 3; //9为最小化 private void SearchWindow()
{
//下面的这些参数都可以用到Spy++查到
string lpszParentClass = "WindowsForms10.Window.8.app.0.378734a"; //整个窗口的类名
string lpszParentWindow = "编辑发布设置"; //窗口标题
string lpclass1="WindowsForms10.Window.8.app.0.378734a";
string lpname1="登录操作"; string lpclass2 = "WindowsForms10.BUTTON.app.0.378734a";
string lpname2 = "内置浏览器中登录"; IntPtr ParentWnd = new IntPtr(0);
IntPtr EdithWnd = new IntPtr(0);
IntPtr P1 = new IntPtr(0);
IntPtr p2 = new IntPtr(0);
IntPtr p3 = new IntPtr(0); //查到窗体,得到整个窗体
ParentWnd = FindWindow(lpszParentClass, lpszParentWindow);
P1 = FindWindowEx(ParentWnd, P1, lpclass1, lpname1);
p2 = FindWindowEx(P1, p2, lpclass2, lpname2);
p3 = FindWindow(null, "内置微型浏览器");/////////问题就在这里!!!可以运行下一步点开窗口,后C#程序就没反映了,只有关掉用SendMessage点开的窗口才会恢复正常,后门的两句根本不能执行最大化,和前置///////////////////////////////
SendMessage(p2, WM_CLICK, (IntPtr)0, 0);
ShowWindow(p3, SW_MAXIMIZE);
SetForegroundWindow(p3);
} private void button1_Click(object sender, EventArgs e)
{
SearchWindow();
}
}
}
该成以下可以直接打开该窗口并最大化,你得代码没问题
private void SearchWindow()
{
//下面的这些参数都可以用到Spy++查到
string lpszParentClass = null; //整个窗口的类名
string lpszParentWindow = "窗口得标题"; //窗口标题 string lpclass1 = "WindowsForms10.Window.8.app.0.378734a";
string lpname1 = "登录操作"; string lpclass2 = "WindowsForms10.BUTTON.app.0.378734a";
string lpname2 = "内置浏览器中登录"; IntPtr ParentWnd = new IntPtr(0);
IntPtr EdithWnd = new IntPtr(0);
IntPtr P1 = new IntPtr(0);
IntPtr p2 = new IntPtr(0);
IntPtr p3 = new IntPtr(0); //查到窗体,得到整个窗体
ParentWnd = FindWindow(lpszParentClass, lpszParentWindow);
//P1 = FindWindowEx(ParentWnd, P1, lpclass1, lpname1);
//p2 = FindWindowEx(P1, p2, lpclass2, lpname2);
//p3 = FindWindow(null, "内置微型浏览器"); /////////问题就在这里!!!可以运行下一步点开窗口,后C#程序就没反映了,只有关掉用SendMessage点开的窗口才会恢复正常,后门的两句根本不能执行最大化,和前置///////////////////////////////
// SendMessage(p2, WM_CLICK, (IntPtr)0, 0);
ShowWindow(ParentWnd, SW_MAXIMIZE);
SetForegroundWindow(ParentWnd);
}