WinForm 窗口前端显示问题

using System.Runtime.InteropServices;

在类中导入以下两个库函数

[DllImport("user32.dll", EntryPoint = "SetWindowPos")]
        public static extern int SetWindowPos(int hwnd, int hWndInsertAfter, int x, int y, int cx, int cy, int wFlags);

        //[DllImport("user32.dll", EntryPoint = "FindWindow")]
        //public static extern int FindWindow(string lpClassName, string lpWindowName);

 

// 前端显示notepad记事本

int hwnd = FindWindow("notepad",null);

SetWindowPos(hwnd, -1, 0, 0, 0, 0, 0x001 | 0x002 | 0x040);

posted on 2010-01-17 13:59  jef  阅读(870)  评论(0编辑  收藏  举报

导航