satocchiaブログ
2026
2025
2024
2023
2022
2021
2020
2019
2018
2017
2016
2015
2014
2013
1月
2月
3月
4月
5月
6月
7月
8月
9月
10月
11月
12月
全1件 (1件中 1-1件目)
1
powershellでGUI(Windows.Forms)を使うためのおまじない。先頭で呼ぶと貼り付けると吉。やってること黒画面消しSTAモード強制System.Windows.Forms、System.Drawingアッセンブリー読み込みGuiTemplate.ps1#########################GUI起動のためのおまじない#########################まず、タスクスケジューラから呼んだときの黒画面を消すpowershell -WindowStyle Hidden -command "exit"#########################STAモードでなければSTAに設定して再起動if ( [threading.thread]::CurrentThread.GetApartmentState() -ne "STA" ){ $myself =$myInvocation.MyCommand.Path powershell -sta . "$myself" exit}#[threading.thread]::CurrentThread.GetApartmentState()#########################Windows.FormsとSystem.Drawingの呼び込みtry{ [void][System.Windows.Forms.DialogResult]}catch{ [void][reflection.assembly]::loadwithpartialname( "System.Windows.Forms" )}try{ [void][System.Drawing.Color]}catch{ [void][reflection.assembly]::loadwithpartialname( "System.Drawing" )}################おまじない終了##
2018.03.15
コメント(0)