C
cenright
I have code to create a shortcut directly in the start
menu folder. This works fine in PPC 2002. However, in
PPC 2003 (both on dell axiom) the shortcut gets created
correctly (I can see it through explorer from the
attached pc) but as soon as I touch the start menu, the
os moves the shortcut from the '\windows\start menu'
folder into the '\windows\start menu\programs' folder.
Anybody else experiencing this / any workaround to
getting the link in the start menu folder?
Thanks...chuck
using System;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
using System.Data;
using System.Runtime.InteropServices;
using System.IO;
namespace CreateShortcut
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.MainMenu
mainMenu1;
[ DllImport("coredll.dll",
EntryPoint="SHCreateShortcut") ]
private static extern bool
SHCreateShortcut(string shortcut, string target);
public Form1()
{
//
// Required for Windows Form
Designer support
//
InitializeComponent();
//get the fully qualified app name
string App =
System.Reflection.Assembly.GetExecutingAssembly
().GetModules()[0].FullyQualifiedName;
//create link file name
string Link = "\\windows\\start
menu\\" + Path.GetFileNameWithoutExtension(App) + ".lnk";
//go ahead and add link to the
start menu if not there...
if(!File.Exists(Link))
{
SHCreateShortcut
(Link, '"' + App + '"');
}
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool
disposing )
{
base.Dispose( disposing );
}
#region Windows Form Designer generated
code
/// <summary>
/// Required method for Designer support -
do not modify
/// the contents of this method with the
code editor.
/// </summary>
private void InitializeComponent()
{
this.mainMenu1 = new
System.Windows.Forms.MainMenu();
//
// Form1
//
this.ClientSize = new
System.Drawing.Size(250, 280);
this.MaximizeBox = false;
this.Menu = this.mainMenu1;
this.MinimizeBox = false;
this.Text = "Form1";
}
#endregion
/// <summary>
/// The main entry point for the
application.
/// </summary>
static void Main()
{
Application.Run(new Form1());
}
}
}
menu folder. This works fine in PPC 2002. However, in
PPC 2003 (both on dell axiom) the shortcut gets created
correctly (I can see it through explorer from the
attached pc) but as soon as I touch the start menu, the
os moves the shortcut from the '\windows\start menu'
folder into the '\windows\start menu\programs' folder.
Anybody else experiencing this / any workaround to
getting the link in the start menu folder?
Thanks...chuck
using System;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
using System.Data;
using System.Runtime.InteropServices;
using System.IO;
namespace CreateShortcut
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.MainMenu
mainMenu1;
[ DllImport("coredll.dll",
EntryPoint="SHCreateShortcut") ]
private static extern bool
SHCreateShortcut(string shortcut, string target);
public Form1()
{
//
// Required for Windows Form
Designer support
//
InitializeComponent();
//get the fully qualified app name
string App =
System.Reflection.Assembly.GetExecutingAssembly
().GetModules()[0].FullyQualifiedName;
//create link file name
string Link = "\\windows\\start
menu\\" + Path.GetFileNameWithoutExtension(App) + ".lnk";
//go ahead and add link to the
start menu if not there...
if(!File.Exists(Link))
{
SHCreateShortcut
(Link, '"' + App + '"');
}
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool
disposing )
{
base.Dispose( disposing );
}
#region Windows Form Designer generated
code
/// <summary>
/// Required method for Designer support -
do not modify
/// the contents of this method with the
code editor.
/// </summary>
private void InitializeComponent()
{
this.mainMenu1 = new
System.Windows.Forms.MainMenu();
//
// Form1
//
this.ClientSize = new
System.Drawing.Size(250, 280);
this.MaximizeBox = false;
this.Menu = this.mainMenu1;
this.MinimizeBox = false;
this.Text = "Form1";
}
#endregion
/// <summary>
/// The main entry point for the
application.
/// </summary>
static void Main()
{
Application.Run(new Form1());
}
}
}