问题一:
[DllImport("shell32.dll", EntryPoint="ShellExecute")]
public static extern int ShellExecute (
int hwnd,
string lpOperation,
string lpFile,
string lpParameters,
string lpDirectory,
int nShowCmd
);
那个hwnd参数如何赋值呢?    有时候有的应用程序启动前会有个消息对话框,我赋值为0时,只显示对话框,主程序不显示!
问题二:
[DllImport("shell32.dll", EntryPoint="ExtractIcon")]
public static extern int ExtractIcon (
int hInst,
string lpszExeFileName,
int nIconIndex
);那个hInst参数如何赋值呢?  我赋值为this.handle  但是不知道对不对。还有这个函数返回值是图标的句柄,如何得到句柄所指向的图标呢?    困惑中!谢谢各位高手了
再次感谢...

解决方案 »

  1.   

    1 指定父窗口句柄  C#可以使用 Control.Handle 或则Form.Handle获取
    如果0 就是桌面2   Icon a =Icon.FromHandle(hInst);
      

  2.   

    Icon的FromHandle函数的参数是HICON吧
    这里的hInst指的是载入的映像的HINSTANCE.函数通过
    它在内存映像中检索图标资源.一般是用LoadLibrary载
    入dll/exe得到的.这俩不是同一个东西
      

  3.   

    http://zhidao.baidu.com/question/121189379.htmlhttp://www.csharpwin.com/csharpspace/2887.shtmlhttp://www.csharpwin.com/csharpspace/3834r8316.shtmlhttp://zealotds.javaeye.com/blog/484159
      

  4.   

    [DllImport("shell32")] 
            private static extern int ExtractIcon(int hinst, string lpszExeFileName, int nIconIndex); 
    IntPtr hIcon=(IntPtr)ExtractIcon(this.Handle, FileName, nIconIndex); 
    int icons = ExtractIcon(0, Application.ExecutablePath, 0); 
      

  5.   

    ShellExecute 
      

  6.   

    给你个例子把 IntPtr icons = ExtractIcon(this.Handle, @"C:\WINDOWS\dialer.exe", 0);            Icon _Icon = Icon.FromHandle(icons);            this.Icon = _Icon;