Jump to content

Recommended Posts

Posted

#2762 for _WinAPI_GetDriveType()

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

#include <MsgBoxConstants.au3>
#include <WinAPIFiles.au3>

Example()

Func Example()
    ; Find the drive type of the home drive, generally this is the C:\ drive.
    Local $iTypeOfDrive = _WinAPI_GetDriveType(@HomeDrive) ; For example C:

    ; Create a variable to hold the display message.
    Local $sMessage = ""
    Switch $iTypeOfDrive
        Case $DRIVE_UNKNOWN
            $sMessage = "The drive type cannot be determined."
        Case $DRIVE_NO_ROOT_DIR
            $sMessage = "The root path is invalid."
        Case $DRIVE_REMOVABLE
            $sMessage = "The drive is removable media."
        Case $DRIVE_FIXED
            $sMessage = "The drive is a fixed drive."
        Case $DRIVE_REMOTE
            $sMessage = "The drive is a remote (network) drive."
        Case $DRIVE_CDROM
            $sMessage = "The drive is a CD-ROM drive."
        Case $DRIVE_RAMDISK
            $sMessage = "The drive is a RAM disk."
    EndSwitch

    ; Display the message about the drive type.
    MsgBox($MB_SYSTEMMODAL, "", $sMessage)
EndFunc   ;==>Example

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

Now I think you show us how to make a "correct" example for new HelpFile?
Thanks for pointing the right way, here and on the track.

mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

Just follow the 2nd post and don't use ConsoleWrite() when you wish to display an output to the user of some description. Also comments of some kind don't hurt either. Remember to think from the perspective of a new user discovering AutoIt for the first time. Good luck.

Edited by guinness

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

  On 6/22/2014 at 6:59 PM, guinness said:

Just to add (if these are designed for the help file) then they should pass Au3Check with the following parameters (see below) and use the correct variable naming convention as stated in the Readme.txt (located in the docs zip file).

 

###Parameters###
Parameters naming:
The first letter signifies the expected type of the variable. This should be as follows:
$a<letter> - Array (the following letter describes the data type taken from the rest of the data types below,
if it varies then v can be used.
$d - Binary data.
$h - Handle, usually to a file or window. NB: AutoIt handled controls return IDs, and so use $id instead.
$id - An AutoIt control Id.
$i - Integer.
$b - Boolean.
$f - Floating point number.
$n - general number with no preference for floating point or integer.
$s - String.
$v - Variant (unknown/variable type of data).
$o - COM object.
$p - Pointer. It is assumed that it points to a struct so no further letters are needed.
The type of struct being pointed to should be inferrable from the variable name e.g. $pWindowRect can be assumed to be a pointer to a $tagRECT structure.

 

there is inconsistency as to naming variables described here:

http://www.autoitscript.com/wiki/Best_coding_practices#Names_of_Variables

focus on:

  Quote

$b - Boolean.

$f - Floating point number.

 

additionally this wiki page do not describe:

$d

Can it be the occasion to explain and normalize.

mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

The wiki is the wiki, this is maintained by you guys not the Devs.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

I know.

I just search something and found this:

http://www.autoitscript.com/autoit3/udfs/UDF_Standards.htm

Variable Names described here are current applicable standard, that You just invoked in post #2.

If so Wiki should be changed ie. by me.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

  On 6/22/2014 at 11:30 PM, JohnOne said:

_WinAPI_GetPriorityClass

  Reveal hidden contents

 

 

 

#2765

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

_WinAPI_AdjustWindowRectEx

#include <WinAPISys.au3>

Local $iLeft = 100, $iTop = 100, $iRight = 300, $iBottom = 300

Local $dsRect = DllStructCreate($tagRECT)

DllStructSetData($dsRect, "Left", $iLeft)
DllStructSetData($dsRect, "Top", $iTop)
DllStructSetData($dsRect, "Right", $iRight)
DllStructSetData($dsRect, "Bottom", $iBottom)

ConsoleWrite("Rect before" & @LF)
For $i = 1 To 4
    ConsoleWrite(DllStructGetData($dsRect, $i) & @LF)
Next

If Not _WinAPI_AdjustWindowRectEx($dsRect, 0, 0, True) Then
    Exit MsgBox(0, "Failure", "_WinAPI_AdjustWindowRectEx")
EndIf

ConsoleWrite("Rect after" & @LF)
For $i = 1 To 4
    ConsoleWrite(DllStructGetData($dsRect, $i) & @LF)
Next

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Posted

_WinAPI_GetROP2

  Reveal hidden contents

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Posted (edited)

_WinAPI_GetDeviceCaps

  Reveal hidden contents

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Posted

_WinAPI_GetPolyFillMode

#include <WinAPIGdi.au3>

$FillMode = _WinAPI_GetPolyFillMode ( _WinAPI_GetDC(null) )

If Not $FillMode Then
    Exit MsgBox(0, "Failure", "_WinAPI_GetPolyFillMode")
EndIf

Switch $FillMode
    Case $ALTERNATE
        ConsoleWrite("ALTERNATE" & @LF)
    Case $WINDING
        ConsoleWrite("WINDING" & @LF)
EndSwitch

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Posted (edited)

_WinAPI_GetPEType

#include <WinAPIFiles.au3>

$PEType = _WinAPI_GetPEType(@ScriptDir & "\file.exe")

If Not $PEType Then
    Exit MsgBox(0, "Failure", "_WinAPI_GetPEType")
EndIf

Switch $PEType
    Case $IMAGE_FILE_MACHINE_I386
        ConsoleWrite("I386" & @LF)
    Case $IMAGE_FILE_MACHINE_IA64
        ConsoleWrite("IA64" & @LF)
    Case $IMAGE_FILE_MACHINE_AMD64
        ConsoleWrite("AMD64" & @LF)
    Case $IMAGE_FILE_MACHINE_ARM
        ConsoleWrite("ARM" & @LF)
EndSwitch

; There are more $IMAGE_FILE_MACHINE_* constants defined in APIFilesConstants.au3
Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Posted

_WinAPI_GetProcessHandleCount

#include <WinAPIProc.au3>

$PID = Run("notepad.exe")
ProcessWait("notepad.exe")

$HandleCount = _WinAPI_GetProcessHandleCount($PID)

If Not $HandleCount Then
    Exit MsgBox(0, "Failure", "_WinAPI_GetProcessHandleCount")
    ProcessClose($PID)
EndIf

ProcessClose($PID)
ConsoleWrite($HandleCount & @LF)

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Posted

_WinAPI_GetProcessIoCounters

#include <WinAPIProc.au3>
#include <Array.au3>

$PID = ProcessExists("scite.exe")
If Not $PID Then
    Exit MsgBox(0, "Error", "Process does not exist")
EndIf

$IoCounters = _WinAPI_GetProcessIoCounters($PID)
If @error Then
    Exit MsgBox(0, "Failure", "_WinAPI_GetProcessIoCounters")
EndIf

_ArrayDisplay($IoCounters)

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Posted

_WinAPI_GetSystemDEPPolicy

#include <WinAPISys.au3>

$DEPPolicy = _WinAPI_GetSystemDEPPolicy()

Switch $DEPPolicy
    Case 0
        ConsoleWrite("AlwaysOff" & @LF)
    Case 1
        ConsoleWrite("AlwaysOn" & @LF)
    Case 2
        ConsoleWrite("OptIn" & @LF)
    Case 3
        ConsoleWrite("OptOut" & @LF)
EndSwitch

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...