Modify

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#2765 closed Feature Request (Rejected)

Example proposal - _WinAPI_GetPriorityClass.au3

Reported by: mLipok Owned by:
Milestone: Component: Documentation
Version: Severity: None
Keywords: Cc:

Description

Based on:
http://www.autoitscript.com/forum/topic/162237-the-bumper-thread-of-missing-winapi-examples/#entry1178992

#include <MsgBoxConstants.au3>
#include <WinAPIProc.au3>
#include <APIProcConstants.au3>


Example()

Func Example()

	; run notepad
	Run("notepad.exe")
	Local $iPID = ProcessWait("notepad.exe")

	; get Priority Description
	Local $sPriorityDesc = Example_WinAPI_GetPriorityClass($iPID)

	; show the message
	If Not @error Then
		MsgBox($MB_SYSTEMMODAL, Hex(@extended), $sPriorityDesc)
	Else
		MsgBox(0, "Failure", "_WinAPI_GetPriorityClass")
	EndIf

	; CleanUp
	ProcessClose($iPID)

EndFunc   ;==>Example

Func Example_WinAPI_GetPriorityClass($iPID)

	; Check Priorrity
	Local $Class = _WinAPI_GetPriorityClass($iPID)
	If Not $Class Then
		Return SetError(1)
	EndIf

	; setting return value
	Switch $Class
		Case $ABOVE_NORMAL_PRIORITY_CLASS
			Return SetError(0, $ABOVE_NORMAL_PRIORITY_CLASS, "ABOVE_NORMAL_PRIORITY_CLASS")
		Case $BELOW_NORMAL_PRIORITY_CLASS
			Return SetError(0, $BELOW_NORMAL_PRIORITY_CLASS, "BELOW_NORMAL_PRIORITY_CLASS")
		Case $HIGH_PRIORITY_CLASS
			Return SetError(0, $HIGH_PRIORITY_CLASS, "HIGH_PRIORITY_CLASS")
		Case $IDLE_PRIORITY_CLASS
			Return SetError(0, $IDLE_PRIORITY_CLASS, "IDLE_PRIORITY_CLASS")
		Case $NORMAL_PRIORITY_CLASS
			Return SetError(0, $NORMAL_PRIORITY_CLASS, "NORMAL_PRIORITY_CLASS")
		Case $REALTIME_PRIORITY_CLASS
			Return SetError(0, $REALTIME_PRIORITY_CLASS, "REALTIME_PRIORITY_CLASS")
	EndSwitch
EndFunc   ;==>Example_WinAPI_GetPriorityClass

Attachments (1)

_WinAPI_GetPriorityClass.au3 (1.4 KB ) - added by mLipok 12 years ago.

Download all attachments as: .zip

Change History (4)

by mLipok, 12 years ago

comment:2 by guinness, 12 years ago

Resolution: Rejected
Status: newclosed

comment:3 by mLipok, 12 years ago

May I know why ?

comment:4 by guinness, 12 years ago

Please review what has been said in the past for submitting examples to the help file. Thanks.

Modify Ticket

Action
as closed The ticket will remain with no owner.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.