Re: ShellExecuteEx and "runas" Dialog "Cancel"-Button pressed Issue,...
Hi Stefan,
yes, you where right, i made a mistake i was not aware of,
because i simply did not look at the function declaration, so
it was my fault. Here is what it has to look like:
[Flags]
public enum ShellExecuteExFlags : uint
{
SEE_MASK_CLASSKEY = 0x3,
SEE_MASK_CLASSNAME = 0x1,
SEE_MASK_CONNECTNETDRV = 0x80,
SEE_MASK_DOENVSUBST = 0x200,
SEE_MASK_FLAG_DDEWAIT = 0x100,
SEE_MASK_FLAG_NO_UI = 0x400,
SEE_MASK_HOTKEY = 0x20,
SEE_MASK_ICON = 0x10,
SEE_MASK_IDLIST = 0x4,
SEE_MASK_INVOKEIDLIST = 0xc,
SEE_MASK_NOCLOSEPROCESS = 0x40,
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SHELLEXECUTEINFO
{
public int cbSize;
public ShellExecuteExFlags fMask;
public IntPtr hwnd;
[MarshalAs(UnmanagedType.LPWStr)]
public string lpVerb;
[MarshalAs(UnmanagedType.LPWStr)]
public string lpFile;
[MarshalAs(UnmanagedType.LPWStr)]
public string lpParameters;
[MarshalAs(UnmanagedType.LPWStr)]
public string lpDirectory;
public int nShow;
public IntPtr hInstApp;
public IntPtr lpIDList;
[MarshalAs(UnmanagedType.LPWStr)]
public string lpClass;
public IntPtr hkeyClass;
public uint dwHotKey;
public IntPtr hIcon;
public IntPtr hProcess;
}
[DllImport("shell32.dll",CharSet=CharSet.Unicode, SetLastError =
true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool ShellExecuteEx(ref SHELLEXECUTEINFO
lpExecInfo);
More in detail i forget to set the SetLastError Attribute, that was the
problem!
Thanks,...
regards
Kerem
--
--
-----------------------
Beste Gr?sse / Best regards / Votre bien devoue
Kerem G?mr?kc?
Latest Project: http://www.pro-it-education.de/software/deviceremover
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."
"Stefan Kuhr" <kustt110@gmx.li> schrieb im Newsbeitrag
news:u$BuVlN6JHA.480@TK2MSFTNGP06.phx.gbl...
Hi Kerem,
Kerem G?mr?kc? wrote:
Hi Stefan,
did you test this on windows 2000?
regards
Kerem
Yes.
--
S