Skip to content
조회 수 20423 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

Tips N Tricks



Using Registry Editor, browse to the following value in the registry: 
HKEY_CURRENT_USER\Software\Microsoft\Command Processor\CompletionChar 
and modify it to be 9Note: Chr(9) = TAB 

To Undo it modify the value to be 0

    The following code will toggle the Command Completion Feature between OFF & ON (Tab)

Code:
/*
UNIX Shell "Command Completion" feature for WINDOWS.
This scripts toggles the feature (affects CURRENT User) everytime run.
Change RootKey to "HKEY_LOCAL_MACHINE" for applying a Global change.
*/


Rootkey :="HKEY_CURRENT_USER"
SubKey  :="Software\Microsoft\Command Processor"

RegRead,cChar,%RootKey%,%SubKey%,CompletionChar
IfEqual,cChar,0,RegWrite,REG_DWORD,%RootKey%,%SubKey%,CompletionChar,9
IfEqual,cChar,9,RegWrite,REG_DWORD,%RootKey%,%SubKey%,CompletionChar,0
RegRead,cChar,%RootKey%,%SubKey%,CompletionChar

MsgBox,64,Command Completion feature, Completion Character = %cChar%


Process Listing - Using third party DLL! 





Quote:
Foreword: 

A much simpler & effective code ( 8 lines only) for retrieving 
the Process List (from the Task Manager) has been posted by Mr.Laszlo in this same topic: 

http://www.autohotkey.com/forum/viewtopic.php?p=81207#81207 

A pure AHK solution by calling Windows API functions has been posted by Titan in this same topic: 

http://www.autohotkey.com/forum/viewtopic.php?p=81564#81564
 

Note: If you are using Windows 2000 and no processes are returned, then add #NoEnv to be the first line in Titan's script. I faced this problem & it took me many hours before I found the truth. 




Code (Expand):
/*

Demonstration code for third party DLL : KJLPROC.DLL
This script creates a ListView of running processes.
Tested only in Windows 2000.

Title        : Easy Process Listing with Third Party DLL.
Author       : A.N.Suresh Kumar aka "Goyyah"
Created Date : 30-Sep-2006
Last Modfied : 30-Sep-2006

Download Information:

ZIP File : http://www.kjlsoftware.com/demos/kjlproc.zip [30K]
WebSite  : http://www.kjlsoftware.com/freeware.html
 Backup  : http://autohotkey.net/~goyyah/3PDLL/Process/KJL/kjlproc.zip 

Only DLL : http://autohotkey.net/~goyyah/3PDLL/Process/KJL/kjlproc.dll [52K]
License  : http://autohotkey.net/~goyyah/3PDLL/Process/KJL/SoftwareLicense.txt

SnapShot : http://autohotkey.net/~goyyah/3PDLL/Process/KJL/proclist.png

*/


#NoTrayIcon
Menu, Tray, Icon, User32.dll, 1
Gui, +AlwaysOnTop
Gui, Margin, 1, 1
Gui, Add, ListView, w640 h400, Process|PID|Win ID|Win Title|Priority

DataPointer := DllCall("kjlproc.dll\KJLPList", Int,1)

/*
The above DllCall returns a pointer to memory address of
the actual text data. The following lines extracts the data
from the pointer. 
*/


Slen := DllCall("lstrlen", UInt, DataPointer) 
VarSetCapacity(ProcessList, Slen) 
DllCall("lstrcpy", Str, ProcessList, UInt, DataPointer)

/*
My sincere thanks to Philippe Lhoste aka PhiLho for above code.
 See: http://www.autohotkey.com/forum/viewtopic.php?p=77558#77558
*/


Ctr=1
Loop, PARSE, ProcessList, |
   {
     StringSplit, Field, A_LoopField, ^
     IfEqual, Field1, _Total.exe, Continue
     Field5 := GetPriority(Field2)
     LV_Add("", Field1, Field2, Field3, Field4, Field5)
     Ctr++
   }
LV_ModifyCol()
Gui, Add, StatusBar, ,Total Process Running: %Ctr%
Gui, Show, , ListView of Processes [ KJLPROC.DLL ]
Return

/*
GetPriority() has been posted at the following URL:
http://www.autohotkey.com/forum/viewtopic.php?p=80548#80548
*/


GetPriority(PID=0) { 
 IfLessOrEqual, PID, 0, Return, "Error!" 
 hProcess := DllCall("OpenProcess", Int,1024, Int,0, Int,PID) 
 Priority := DllCall("GetPriorityClass", Int,hProcess) 
 DllCall("CloseHandle", Int,hProcess) 
 IfEqual, Priority, 64   , Return, "Low" 
 IfEqual, Priority, 16384, Return, "BelowNormal" 
 IfEqual, Priority, 32   , Return, "Normal" 
 IfEqual, Priority, 32768, Return, "AboveNormal" 
 IfEqual, Priority, 128  , Return, "High" 
 IfEqual, Priority, 256  , Return, "Realtime" 
Return "" 
}

GuiClose:
GuiEscape:
 ExitApp
Return

Remarks: 

  • Disclaimer: Not tested/experimented enough! . 
  • Standalone download : kjlproc.dll 
  • kjlproc.dll contains only one function : KJLPList() and is fast enough! 
  • kjlproc.dll is sized at 52 Kb .. That is big for a single function, but it saves me many lines of confusion! 
  • The DLL is freeware but I find the license confusing: Software License.txt 
  • The retrieval of the "Process list" as a single string involves only 4 lines: 

      Copy / Paste / Try example :

    Code:
    DataPointer := DllCall("kjlproc.dll\KJLPList", Int,1) 
    Slen := DllCall("lstrlen", UInt, DataPointer) 
    VarSetCapacity(ProcessList, Slen) 
    DllCall("lstrcpy", Str, ProcessList, UInt, DataPointer) 

    FileAppend, %ProcessList%, proc.txt
    MsgBox, 64,List of Process, %ProcessList%

  • Here is a copy of proc.txt 


    Edit: 11-Nov-2006

Quote:

To ascertain which processes are GUI based one may use the IsGUI() 
Code:
A := IsGui("System")
MsgBox, % A
Return

IsGUI(process="") { 
 Process, Exist, %process% 
 PID := ErrorLevel 
 IfLessOrEqual, PID, 0, Return, "Process:%process% does not exist!" 

 hProcess   := DllCall("OpenProcess", Int,1024, Int,0, Int,PID) 
 GuiObjects := DllCall("GetGuiResources", Int,hProcess, Int,1)
 DllCall("CloseHandle", Int,hProcess) 
Return 1-!GuiObjects ; Return 1 if process has GUI, else 0
}


GetGuiResources maybe used with Titan's Process Listing solution ( also available in AHK Documentation) to determine whether a process is GUI based. However, you cannot use it to verify an AHK process, because even a non-GUI AHK script has a GUI which can be viewed by double-clicking the tray icon. 

See MSDN : GetGuiResources 







로그인 후 댓글쓰기가 가능합니다.

?

List of Articles
번호 분류 제목 날짜 조회 수
26 AutoHotKey #ifwinactive & #ifwinexist 윈도우창 마다 핫키의 용도를 다르게 사용하는 방법 2011.02.14 16518
25 AutoHotKey AutoHotkey_L: Arrays, Debugger, x64, COM, #If expression 3 2011.02.14 21591
24 AutoHotKey [ahk] 레지스터리 등록여부 확인 후 없으면 추가시키기 2 1 2011.02.14 14972
23 AutoHotKey [COM] 자바스크립트 / DOM / HTML 웹페이지 컨트롤 3 2011.02.12 27281
22 AutoHotKey AHK에서 가능한 COM 인터넷 익스플로러 및 GUI 브라우저 1 2011.02.11 19502
21 AutoHotKey [ahk_l] 구글의 Gmail 자동로그인 소스 3 2011.02.11 22492
20 AutoHotKey ahk와 ahk_l 의 웹페이지 로딩완료 체크 비교 3 2011.02.11 20324
19 AutoHotKey autohotkey와 autohotkey_l 의 인터넷 창 띄우기 비교예제 2 2011.02.11 17772
18 AutoHotKey Internet Explorer Control 2011.02.11 19663
17 AutoHotKey IE.ahk COM 환상강의 1 file 2011.02.10 21252
16 AutoHotKey AutoHotkey COM Standard Library 2 2011.02.10 18022
15 AutoHotKey AHK_L 예제소스 1 2011.02.10 16991
14 AutoHotKey PostMessage로 한글 사용하기 1 2 2011.02.09 16810
13 AutoHotKey com.ahk 1 2011.02.09 18260
12 AutoHotKey UrlDownloadToVar() 1 2011.02.09 15464
11 AutoHotKey 부팅 완료 체크 2011.02.09 17864
10 AutoHotKey OnMessage() 3 2011.02.05 20438
9 AutoHotKey [autohotkey] FTP-업로드 예제분석 2 file 2011.02.05 18619
8 AutoHotKey [AUTOHOTKEY] FTP 제어 file 2011.02.04 25246
7 컴퓨터잡담 DllCall() 3 2010.12.22 15314
Board Pagination Prev 1 2 3 4 5 Next
/ 5

http://urin79.com

우린친구블로그

sketchbook5, 스케치북5

sketchbook5, 스케치북5

나눔글꼴 설치 안내


이 PC에는 나눔글꼴이 설치되어 있지 않습니다.

이 사이트를 나눔글꼴로 보기 위해서는
나눔글꼴을 설치해야 합니다.

설치 취소