文字文件開啟最大化 - Windows

By Sarah
at 2012-01-05T14:18
at 2012-01-05T14:18
Table of Contents
※ 引述《pkokqk (流風)》之銘言:
: 就是txt檔
: 希望每次開啟時就是最大化
: 不要那種還要建立捷徑去設定最大化
我的作法是寫一支程式幫忙,步驟很簡單,如下:
1. 在記事本貼入下列程式,存檔時,請注意:
1) 副檔名請用 .vbs,例如:「c:\temp\MaxNotepad.vbs」。
2) 編碼方式請選: ANSI。
' -- cut here --
strComputer = "."
strMaxProgram = UCase("notepad.exe")
strExitProgram = UCase("calc.exe")
Set objWMIService = GetObject("winmgmts:\\" _
& strComputer & "\root\cimv2")
Set colMonitoredProcesses = objWMIService. _
ExecNotificationQuery( _
"select * from __instancecreationevent " _
& " within 1 where TargetInstance isa 'Win32_Process'")
i = 0
Set Shell = WScript.CreateObject("WScript.Shell")
Do While i = 0
Set objLatestProcess = colMonitoredProcesses.NextEvent
If UCase(objLatestProcess.TargetInstance.Name) = strMaxProgram Then
Shell.SendKeys "% x"
End If
If UCase(objLatestProcess.TargetInstance.Name) = strExitProgram Then
Exit Do
End If
Loop
' -- cut here --
2. 點兩下上述步驟建立的 .vbs 程式檔案。
(這支程式會背景執行,工作管理員預設會多出一支 wscript.exe)。
3. 啟動記事本或者點兩下 .txt 文字檔,順利的話,記事本會自動極大化。
啟動「小算盤」可關閉這支程式。
《原理說明》
1. 副檔名 .vbs 的檔案會被 Windows 當作是「程式」,由 wscript.exe 或
cscript.exe 載入執行。
2. 我們的程式會跟 WMI 要求「程式啟動通知」,只要有程式啟動,我們的
程式都會收到通知。
3. 通知的程式名稱如果是 notepad.exe,就送出「Alt+空白」「x」來最大化視窗;
通知的程式名稱如果是 calc.exe,就脫離迴圈結束程式。
--
: 就是txt檔
: 希望每次開啟時就是最大化
: 不要那種還要建立捷徑去設定最大化
我的作法是寫一支程式幫忙,步驟很簡單,如下:
1. 在記事本貼入下列程式,存檔時,請注意:
1) 副檔名請用 .vbs,例如:「c:\temp\MaxNotepad.vbs」。
2) 編碼方式請選: ANSI。
' -- cut here --
strComputer = "."
strMaxProgram = UCase("notepad.exe")
strExitProgram = UCase("calc.exe")
Set objWMIService = GetObject("winmgmts:\\" _
& strComputer & "\root\cimv2")
Set colMonitoredProcesses = objWMIService. _
ExecNotificationQuery( _
"select * from __instancecreationevent " _
& " within 1 where TargetInstance isa 'Win32_Process'")
i = 0
Set Shell = WScript.CreateObject("WScript.Shell")
Do While i = 0
Set objLatestProcess = colMonitoredProcesses.NextEvent
If UCase(objLatestProcess.TargetInstance.Name) = strMaxProgram Then
Shell.SendKeys "% x"
End If
If UCase(objLatestProcess.TargetInstance.Name) = strExitProgram Then
Exit Do
End If
Loop
' -- cut here --
2. 點兩下上述步驟建立的 .vbs 程式檔案。
(這支程式會背景執行,工作管理員預設會多出一支 wscript.exe)。
3. 啟動記事本或者點兩下 .txt 文字檔,順利的話,記事本會自動極大化。
啟動「小算盤」可關閉這支程式。
《原理說明》
1. 副檔名 .vbs 的檔案會被 Windows 當作是「程式」,由 wscript.exe 或
cscript.exe 載入執行。
2. 我們的程式會跟 WMI 要求「程式啟動通知」,只要有程式啟動,我們的
程式都會收到通知。
3. 通知的程式名稱如果是 notepad.exe,就送出「Alt+空白」「x」來最大化視窗;
通知的程式名稱如果是 calc.exe,就脫離迴圈結束程式。
--
Tags:
Windows
All Comments

By Margaret
at 2012-01-06T17:23
at 2012-01-06T17:23

By Elvira
at 2012-01-11T17:07
at 2012-01-11T17:07

By Jake
at 2012-01-14T08:25
at 2012-01-14T08:25

By Rosalind
at 2012-01-15T08:02
at 2012-01-15T08:02

By Dora
at 2012-01-20T01:23
at 2012-01-20T01:23

By Zanna
at 2012-01-21T02:05
at 2012-01-21T02:05

By Tracy
at 2012-01-23T06:44
at 2012-01-23T06:44

By Emma
at 2012-01-24T16:01
at 2012-01-24T16:01

By Regina
at 2012-01-25T09:28
at 2012-01-25T09:28

By George
at 2012-01-29T06:58
at 2012-01-29T06:58

By Jack
at 2012-01-30T00:41
at 2012-01-30T00:41
Related Posts
Win 8的還原功能解說

By William
at 2012-01-05T13:56
at 2012-01-05T13:56
文字文件開啟最大化

By John
at 2012-01-05T12:03
at 2012-01-05T12:03
windows7關閉DirectDraw Acceleration

By Irma
at 2012-01-04T21:58
at 2012-01-04T21:58
win7 64 & 瑞昱

By Valerie
at 2012-01-04T21:30
at 2012-01-04T21:30
windows 7 thin pc有人用嗎?

By Brianna
at 2012-01-04T18:35
at 2012-01-04T18:35