问题一:
[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 但是不知道对不对。还有这个函数返回值是图标的句柄,如何得到句柄所指向的图标呢? 困惑中!谢谢各位高手了
再次感谢...
[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 但是不知道对不对。还有这个函数返回值是图标的句柄,如何得到句柄所指向的图标呢? 困惑中!谢谢各位高手了
再次感谢...
如果0 就是桌面2 Icon a =Icon.FromHandle(hInst);
这里的hInst指的是载入的映像的HINSTANCE.函数通过
它在内存映像中检索图标资源.一般是用LoadLibrary载
入dll/exe得到的.这俩不是同一个东西
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);