Ejemplo n.º 1
0
        public bool TShellExecute(string FileName)
        {
            int    nSize = FileName.Length * 2 + 2;
            IntPtr pData = LocalAlloc(0x40, nSize);

            Marshal.Copy(Encoding.Unicode.GetBytes(FileName), 0, pData, nSize - 2);

            SHELLEXECUTEEX see = new SHELLEXECUTEEX();

            see.cbSize       = 60;
            see.dwHotKey     = 0;
            see.fMask        = 0;
            see.hIcon        = IntPtr.Zero;
            see.hInstApp     = IntPtr.Zero;
            see.hProcess     = IntPtr.Zero;;
            see.lpClass      = IntPtr.Zero;
            see.lpDirectory  = IntPtr.Zero;
            see.lpIDList     = IntPtr.Zero;
            see.lpParameters = IntPtr.Zero;
            see.lpVerb       = IntPtr.Zero;
            see.nShow        = 0;
            see.lpFile       = pData;

            if (ShellExecuteEx(see) == 0)
            {
                LocalFree(pData);
                return(false);
            }

            LocalFree(pData);
            return(true);
        }
Ejemplo n.º 2
0
        public bool TDialUpInternet()
        {
            string str;
            int    size;

            str  = "rnaapp.exe";
            size = str.Length * 2 + 2;
            IntPtr pfilename = LocalAlloc(0x40, size);

            Marshal.Copy(Encoding.Unicode.GetBytes(str), 0, pfilename, size - 2);

            str  = "-e \"My Conection\" -m";
            size = str.Length * 2 + 2;
            IntPtr pparametres = LocalAlloc(0x40, size);

            Marshal.Copy(Encoding.Unicode.GetBytes(str), 0, pparametres, size - 2);

            str  = "\\windows";
            size = str.Length * 2 + 2;
            IntPtr pdirectory = LocalAlloc(0x40, size);

            Marshal.Copy(Encoding.Unicode.GetBytes(str), 0, pdirectory, size - 2);


            SHELLEXECUTEEX see = new SHELLEXECUTEEX();

            see.cbSize       = 60;
            see.dwHotKey     = 0;
            see.fMask        = 0x40;      /*SEE_MASK_NOCLOSEPROCESS*/
            see.hIcon        = IntPtr.Zero;
            see.hInstApp     = IntPtr.Zero;
            see.hProcess     = IntPtr.Zero;;
            see.lpClass      = IntPtr.Zero;
            see.lpDirectory  = pdirectory;
            see.lpIDList     = IntPtr.Zero;
            see.lpParameters = pparametres;
            see.lpVerb       = IntPtr.Zero;
            see.nShow        = 0;
            see.lpFile       = pfilename;

            if (ShellExecuteEx(see) == 0)
            {
                return(false);
            }
            return(true);
        }
Ejemplo n.º 3
0
 extern static public int ShellExecuteEx(SHELLEXECUTEEX ex);