zoukankan      html  css  js  c++  java
  • PPC全屏(C#)(转)

    PPC全屏(C#)(转)

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Windows.Forms;
    using System.Runtime.InteropServices;
    using System.Text;
    namespace Hello_World
    {
         public partial class StartForm : Form
    {
    private Timer timer;
    public StartForm()
    {
    InitializeComponent();
    IntPtr hWnd = API.FindWindow(this.Text);
    if (hWnd != IntPtr.Zero)
    {
    System.Diagnostics.Debug.WriteLine("hWnd ist nicht null");
    this.MaximizeBox = false;
    this.MinimizeBox = false;
    this.Focus();
    SHAPI.SetForegroundWindow(hWnd);
    SHAPI.FullScreen(hWnd);
    }
    }
    }
    public class API
    {
    [DllImport("coredll.dll", EntryPoint = "FindWindow")]
    private extern static IntPtr FindWindow(string lpClassName, string lpWindowName);
    public static IntPtr FindWindow(string windowName)
    {
    return FindWindow(null, windowName);
    }
    }
    public class SHAPI
    {
    public const int SHFS_SHOWTASKBAR = 1;
    public const int SHFS_HIDETASKBAR = 2;
    public const int SHFS_SHOWSIPBUTTON = 4;
    public const int SHFS_HIDESIPBUTTON = 8;
    public const int SHFS_SHOWSTARTICON = 16;
    public const int SHFS_HIDESTARTICON = 32;
    [DllImport("aygshell.dll")]
    private extern static bool SHFullScreen(IntPtr hWnd, int dwState);
    public static bool FullScreen(IntPtr hWnd)
    {
    return SHFullScreen(hWnd, SHFS_HIDESTARTICON | SHFS_HIDETASKBAR);
    }
    [DllImport("coredll.dll")]
    internal static extern int SetForegroundWindow(IntPtr hWnd);
    }
    } 
     
    
    
    
    
    
    
    

    下面的代码仅仅隐藏开始菜单但程序退出后会重现:

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Windows.Forms;
    using System.Runtime.InteropServices;
    using System.Text;
    namespace Wm5ppc
    {
    public partial class Form1 : Form
    {
    public Form1 ()
    {
    InitializeComponent ();
    this.MinimizeBox = false;
    }
    private void Form1_Activated (object sender, EventArgs e)
    {
    IntPtr hWnd = this.Handle;
    SHAPI.FullScreen (hWnd);
    }
    }
    public class SHAPI
    {
    public const int SHFS_SHOWTASKBAR = 1;
    public const int SHFS_HIDETASKBAR = 2;
    public const int SHFS_SHOWSIPBUTTON = 4;
    public const int SHFS_HIDESIPBUTTON = 8;
    public const int SHFS_SHOWSTARTICON = 16;
    public const int SHFS_HIDESTARTICON = 32;
          [DllImport ("aygshell.dll")]
    private extern static bool SHFullScreen (IntPtr hWnd, int dwState);
    public static bool FullScreen (IntPtr hWnd)
    {
    return SHFullScreen (hWnd, SHFS_HIDESTARTICON);
    }
    }
    }
  • 相关阅读:
    IOptions、IOptionsMonitor、IOptionsSnapshot的区别
    基于 .NET 的 FluentValidation 验证教程
    挂载NFS网络文件系统教程
    gcc简要知识点
    二叉树遍历(前序、中序、后序、层次、广度优先、深度优先遍历)
    项目管理的一些知识总结
    Vue从零开发单页应用程序项目
    CRC校验原理
    Linux 文件搜索神器 find 实战详解
    Linux 三剑客之 grep、sed、awk 使用详解
  • 原文地址:https://www.cnblogs.com/chinatefl/p/1452769.html
Copyright © 2011-2022 走看看