static class Program { [ STAThread ] static void Main ( ) { Application. EnableVisualStyles ( ) ; Application. SetCompatibleTextRenderingDefault ( false ) ; Form mainForm = new Form1 ( ) ; mainForm. Show ( ) ; SetApplicationIcon ( @"./vip.ico" ) ; string exeFilePath = Assembly. GetEntryAssembly ( ) . Location; CreateShortcut ( exeFilePath, @"C:\Users\Admin\Desktop\shortcut.lnk" ) ; Application. Run ( mainForm) ; } static void SetApplicationIcon ( string iconFilePath) { Icon icon = Icon. ExtractAssociatedIcon ( iconFilePath) ; IntPtr hIcon = icon. Handle; SendMessage ( hProcess, WM_SETICON, ICON_SMALL, hIcon) ; SendMessage ( hProcess, WM_SETICON, ICON_BIG, hIcon) ; } const int WM_SETICON = 0x80 ; const int ICON_SMALL = 0x0 ; const int ICON_BIG = 0x1 ; [ System. Runtime. InteropServices. DllImport ( "user32.dll" , CharSet = System. Runtime. InteropServices. CharSet. Auto) ] extern static IntPtr SendMessage ( IntPtr hWnd, int Msg, int wParam, IntPtr lParam) ; static IntPtr hProcess{ get { return Process. GetCurrentProcess ( ) . MainWindowHandle; } } static void CreateShortcut ( string targetPath, string shortcutPath) { WshShell shell = new WshShell ( ) ; IWshShortcut shortcut = ( IWshShortcut) shell. CreateShortcut ( shortcutPath) ; shortcut. TargetPath = targetPath; shortcut. WorkingDirectory = System. IO. Path. GetDirectoryName ( targetPath) ; shortcut. Description = "Shortcut Description" ; shortcut. Save ( ) ; string exeFilePath = Assembly. GetEntryAssembly ( ) . Location; string iconPath = Path. ChangeExtension ( exeFilePath, ".ico" ) ; SetShortcutIcon ( shortcutPath, iconPath) ; } static void SetShortcutIcon ( string shortcutPath, string iconPath) { WshShell shell = new WshShell ( ) ; IWshShortcut shortcut = ( IWshShortcut) shell. CreateShortcut ( shortcutPath) ; shortcut. IconLocation = iconPath; shortcut. Save ( ) ; } }