[DllImport("user32.dll", EntryPoint="EnableWindow")]
public static extern int EnableWindow (
int hwnd,
int fEnable
);
[DllImport("advapi32.dll", EntryPoint="AccessCheck")]
public static extern int AccessCheck (
ref SECURITY_DESCRIPTOR pSecurityDescriptor,
int ClientToken,
int DesiredAccess,
ref GENERIC_MAPPING GenericMapping,
ref PRIVILEGE_SET PrivilegeSet,
ref int PrivilegeSetLength,
ref int GrantedAccess,
int Status也是刚用这个东东,给你贴两个C#中API的用法,我有个C#中API用法库,想要吗?给我联系了!
[email protected]

解决方案 »

  1.   

    CWnd* GetDlgItem ( 
    int nID ) 
    const; BOOL ShowWindow( int nCmdShow );
    SW_HIDE   Hides this window and passes activation to another window.
    SW_MINIMIZE   Minimizes the window and activates the top-level window in the system’s list.
    SW_RESTORE   Activates and displays the window. If the window is minimized or maximized, Windows restores it to its original size and position.
    SW_SHOW   Activates the window and displays it in its current size and position.
    SW_SHOWMAXIMIZED   Activates the window and displays it as a maximized window.
    SW_SHOWMINIMIZED   Activates the window and displays it as an icon.
    SW_SHOWMINNOACTIVE   Displays the window as an icon. The window that is currently active remains active.
    SW_SHOWNA   Displays the window in its current state. The window that is currently active remains active.
    SW_SHOWNOACTIVATE   Displays the window in its most recent size and position. The window that is currently active remains active.
    SW_SHOWNORMAL   Activates and displays the window. If the window  is minimized or maximized, Windows restores it to its original size and position. 
      

  2.   

    3、//The ShowWindow function sets the specified window's show state.
       [DllImport("user32.dll")]
       private static extern int ShowWindow (int hwnd, int nCmdShow);
       
     //The ShowWindowAsync function sets the show state of a window created by a different  thread. 
       [DllImport("user32.dll")]
       private static extern int ShowWindowAsync (int hWnd, int nCmdShow);4、The SetWindowPos function changes the size, position, and Z order of a child, pop-up, or top-level window. Child, pop-up, and top-level windows are ordered according to their appearance on the screen. The topmost window receives the highest rank and is the first window in the Z order. [DllImport("user32.dll")]
    private static extern int SetWindowPos (int hwnd, int hWndInsertAfter, int x, int y, int cx, int cy, int wFlags);
      

  3.   

    第2个问题(刚刚写的,测试通过)
    ------------------------------------
    [DllImport("user32.dll", EntryPoint="FindWindowA")]
    private static extern int FindWindow (string lpClassName, string lpWindowName);
    [DllImport("user32.dll", EntryPoint="SetWindowLongA")]
    private static extern int SetWindowLong (int hwnd, int nIndex, int dwNewLong);
    [DllImport("user32.dll", EntryPoint="GetWindowLongA")]
    private static extern int GetWindowLong (int hwnd, int nIndex);
    private const int GWL_STYLE = -16;
    private const int WS_CAPTION = 0xC00000;
    private void button1_Click(object sender, System.EventArgs e)
    {       //得到记事本的句柄
            int iHnd=FindWindow(null,"无标题 - 记事本");
            if(iHnd!=0)  //找到句柄
    {
                //得到记事本的原来窗口样式
        int iOldSytle=GetWindowLong(iHnd,GWL_STYLE);
               //新窗口样式(去掉记事本的标题拦)
               int iNewStyle=iOldSytle & ~WS_CAPTION;
               //设置窗口样式
       SetWindowLong(iHnd,GWL_STYLE,iNewStyle);
            }
    }
      

  4.   

    第一个问题偶就不知道了,偶也只用过SetParent,不过也只是在同一程序中调用,不同的程序间没试过,不过楼主已经试过了,哈哈!!!