Beispiel #1
0
        public static void OfferCreateLnk(Q q)
        {
            SaveFileDialog sfd = new SaveFileDialog();

            sfd.FileName        = q.Name;
            sfd.Filter          = MUI.GetText("Common.FileType_LNK") + "|*.lnk";
            sfd.OverwritePrompt = true;
            if (sfd.ShowDialog() == DialogResult.OK)
            {
                string args = "/ShowWait ";
                args += (q.UseTItoken ? "/TI " : "");
                args += (q.WorkingDir != "") ?
                        "/Dir:\"" + q.WorkingDir + "\" " : "";
                args += "/Run:\"" + q.ExeToRun + "\" " + q.Arguments;
                ShellLink lnk = new ShellLink(sfd.FileName);
                lnk.Path      = Application.ExecutablePath;
                lnk.Arguments = args;
                lnk.IconPath  = q.ExeToRun;
                int err = lnk.Save();
                if (err == 0)
                {
                    MessageBox.Show(MUI.GetText("Common.CreateLnkOK"),
                                    MUI.GetText("Common.OK_title"),
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show(MUI.GetText("Common.CreateLnkFailed") +
                                    "\n\n" + Win32.WinAPILastErrMsg(err),
                                    MUI.GetText("Common.Error_title"),
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Beispiel #2
0
 public static void OfferCreateLnk(Q q)
 {
     SaveFileDialog sfd = new SaveFileDialog();
     sfd.FileName = q.Name;
     sfd.Filter = MUI.GetText("Common.FileType_LNK") + "|*.lnk";
     sfd.OverwritePrompt = true;
     if (sfd.ShowDialog() == DialogResult.OK)
     {
         string args = "/ShowWait ";
         args += (q.UseTItoken ? "/TI " : "");
         args += (q.WorkingDir != "") ?
             "/Dir:\"" + q.WorkingDir + "\" " : "";
         args += "/Run:\"" + q.ExeToRun + "\" " + q.Arguments;
         ShellLink lnk = new ShellLink(sfd.FileName);
         lnk.Path = Application.ExecutablePath;
         lnk.Arguments = args;
         lnk.IconPath = q.ExeToRun;
         int err = lnk.Save();
         if (err == 0)
         {
             MessageBox.Show(MUI.GetText("Common.CreateLnkOK"),
                 MUI.GetText("Common.OK_title"),
                 MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             MessageBox.Show(MUI.GetText("Common.CreateLnkFailed") +
                 "\n\n" + Win32.WinAPILastErrMsg(err),
                 MUI.GetText("Common.Error_title"),
                 MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }