Modify

Opened 10 years ago

Closed 10 years ago

Last modified 10 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 10 years ago.

Download all attachments as: .zip

Change History (4)

Changed 10 years ago by mLipok

comment:2 Changed 10 years ago by guinness

  • Resolution set to Rejected
  • Status changed from new to closed

comment:3 Changed 10 years ago by mLipok

May I know why ?

comment:4 Changed 10 years ago by guinness

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

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.