1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- using System;
- using System.Runtime.InteropServices;
- using System.Threading;
- using System.Windows.Forms;
- using Client.Start;
- namespace Client
- {
- public class MainClass
- {
- public static void Main()
- {
- try
- {
- //Client后台运行
- //new MainClass();
- ServiceMBIClientHandler.Start();
- }
- catch (Exception ex)
- {
- Console.WriteLine(ex.Message);
- }
- while (true)
- Console.ReadKey();
- }
- [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, string lParam);
- [DllImport("User32.dll", EntryPoint = "ShowWindow")] //
- private static extern bool ShowWindow(IntPtr hWnd, int type);
- public MainClass()
- {
- Console.Title = "MyConsoleApp";
- IntPtr ParenthWnd = new IntPtr(0);
- IntPtr et = new IntPtr(0);
- ParenthWnd = FindWindow(null, "MyConsoleApp");
- ShowWindow(ParenthWnd, 1);//隐藏本dos窗体, 0: 后台执行;1:正常启动;2:最小化到任务栏;3:最大化
- }
- }
- }
|