tagCANDY CGI VBレスキュー(花ちゃん) の Visual Basic 2010 用 掲示板(VB.NET 掲示板)
VBレスキュー(花ちゃん) の Visual Basic 2010 用 掲示板(VB.NET 掲示板)
[ツリー表示へ]  [ワード検索]  [Home]

タイトル Re^2: ショートカットをデスクトップに作成するとセキュリティ警告
投稿日: 2011/01/17(Mon) 12:03
投稿者sue
> > 何らかの対処方法はありますでしょうか?
>
> (案1) セキュリティソフトの設定を変える(除外登録しておく)。
> (案2) WScript.Shell を使わないようにする(Windows Installer を使うなど)。
>
> などといったところでしょうか。
>
> なお、CreateShortcut を使わないショートカット作成法が必要なのであれば
> 過去に何度か投稿されていたように思います。VB2005用では無いかも知れませんが。

ありがとうございます。
下記サンプルでできました。
            '作成するショートカットのパス
            Dim shortcutPath As String = System.IO.Path.Combine( _
                Environment.GetFolderPath(System.Environment.SpecialFolder.DesktopDirectory), _
                "App.lnk")
            'ショートカットのリンク先
            '        Dim targetPath As String = Application.ExecutablePath
            Dim targetPath As String = appPath
            'WshShellを作成
            Dim shell As New IWshRuntimeLibrary.WshShellClass()
            'ショートカットのパスを指定して、WshShortcutを作成
            Dim shortcut As IWshRuntimeLibrary.IWshShortcut = _
                DirectCast(shell.CreateShortcut(shortcutPath), _
                    IWshRuntimeLibrary.IWshShortcut)
            'リンク先
            shortcut.TargetPath = targetPath
            'コマンドパラメータ 「リンク先」の後ろに付く
            shortcut.Arguments = ""
            '作業フォルダ
            shortcut.WorkingDirectory = Application.StartupPath
            'ショートカットキー(ホットキー)
             shortcut.Hotkey = "Ctrl+Alt+Shift+F12"
            '実行時の大きさ 1が通常、3が最大化、7が最小化
            shortcut.WindowStyle = 1
            'コメント
            shortcut.Description = "説明"
            'アイコンのパス 自分のEXEファイルのインデックス0のアイコン
            shortcut.IconLocation = Application.ExecutablePath + ",0"

            'ショートカットを作成
            shortcut.Save()

            '後始末
            System.Runtime.InteropServices.Marshal.ReleaseComObject(shortcut)

   

- 関連一覧ツリー をクリックするとツリー全体を一括表示します)

古いスレッドにレスはつけられません。