QQ video window Maximization

Source: Internet
Author: User

Bored and bored. I used C # To maximize the QQ video window.

The principle is that WinApi is called.

/// <Summary> /// query the form /// </summary> /// <param name = "lpClassName"> </param> /// <param name = "lpWindowName"> </param> // <returns> </returns> [DllImport ("User32.dll ", entryPoint = "FindWindow")] public extern static IntPtr FindWindow (string lpClassName, string lpWindowName ); /// <summary> /// obtain the Form title /// </summary> /// <param name = "hwnd"> </param> /// <param name = "text"> </param> // <param name = "maxLength"> </param> // <returns> </returns> [DllImport ("user32.dll" )] private static extern int GetWindowText (IntPtr hwnd, StringBuilder text, int maxLength ); /// <summary> /// set the form display /// </summary> /// <param name = "hwnd"> </param> /// <param name = "nCmdShow"> 1-regular 2-minimized 3-maximized </param> // <returns> </returns> [DllImport ("user32.dll ", entryPoint = "ShowWindow", CharSet = CharSet. auto)] public static extern int ShowWindow (IntPtr hwnd, int nCmdShow ); /// <summary> /// set whether the form is set to the top. /// </summary> /// <param name = "hWnd"> </param> // <param name = "hWndInsertAfter"> </param> // <param name = "x"> </param> // <param name = "y"> </param> /// <param name = "Width"> </param> /// <param name = "Height"> </param> /// <param name = "flags"> </param> /// <returns> </returns> [DllImport ("user32.dll ", charSet = CharSet. auto)] private static extern int SetWindowPos (IntPtr hWnd, int hWndInsertAfter, int x, int y, int Width, int Height, int flags );

  

IntPtr maindHwnd = FindWindow ("TXGuiFoundation", null); // obtain the QQ form handle if (maindHwnd! = IntPtr. zero) {// StringBuilder sb = new StringBuilder (255); // GetWindowText (maindHwnd, sb, 255); // MessageBox. show (sb. toString (); ShowWindow (maindHwnd, 3); SetWindowPos (maindHwnd,-2, 0, 0, 0, 0, 0x001 | 0x002 | 0x040);} else {MessageBox. show ("no window found ");}

Double-click the video window to run the code.

Source code

Http://files.cnblogs.com/mohc/QQVideoShowWindow.rar

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.