Jump to content

Recommended Posts

Posted

A small update without changing version of the library.

Changes

  Reveal hidden contents
  • The following functions now working with KLID instead LCID.

    _WinAPI_GetKeyboardLayout

    _WinAPI_GetKeyboardLayoutList

    _WinAPI_LoadKeyboardLayout

    _WinAPI_SetKeyboardLayout

  • Added additional parameters to _WinAPI_SetKeyboardLayout() function.
  • Updated documentation.

Posted (edited)

_WinAPI_AssocGetPerceivedType

--------------------------------------------------------------------------------

Retrieves a file's perceived type based on its extension. ?????????

********************************************************************************************

********************************************************************************************

_WinAPI_ShellILCreateFromPath

--------------------------------------------------------------------------------

Retrieves a file's perceived type based on its extension. ????????

Edited by 131738
Posted (edited)

_WinAPI_ShellILCreateFromPath()

Creates a pointer to an item identifier list (PIDL) from a path.

This is a mistake in description, I will correct it later.

Thanks.

Edited by Yashied
  • 4 weeks later...
Posted (edited)

The library has been updated.

v2.8

Changes

  Reveal hidden contents
  • Renamed the following functions.

    _WinAPI_GetClassLong => _WinAPI_GetClassLongEx

    _WinAPI_SetClassLong => _WinAPI_SetClassLongEx

  • Added the following functions.

    _WinAPI_DeleteFile

    _WinAPI_ExtFloodFill

    _WinAPI_GetWindowLongEx

    _WinAPI_MoveToEx

    _WinAPI_OffsetPoints

    _WinAPI_PolyBezier

    _WinAPI_PolyBezierTo

    _WinAPI_PolyDraw

    _WinAPI_RegCopyTreeEx

    _WinAPI_RegDeleteKeyValue

    _WinAPI_RegDeleteTreeEx

    _WinAPI_RegDeleteValue

    _WinAPI_RegDuplicateHKey

    _WinAPI_RegLoadMUIString

    _WinAPI_ReOpenFile

    _WinAPI_RotatePoints

    _WinAPI_SetWindowLongEx

    _WinAPI_Wow64EnableWow64FsRedirection

  • Added examples for the functions above.
  • Updated Help file.

Edited by Yashied
  • 2 weeks later...
Posted (edited)

Would you like to give a _winapi_DeviceIoControl example? I've tried several times. Sadly, not success! ;)

Edited by netegg
Posted
Posted (edited)

The library has been updated.

v2.9

Changes

  Reveal hidden contents
  • Added the following functions.

    _WinAPI_CoInitialize

    _WinAPI_CoUninitialize

    _WinAPI_GetErrorMode

    _WinAPI_GetFileAttributes

    _WinAPI_IOCTL

    _WinAPI_SetErrorMode

    _WinAPI_SetFileAttributes

    _WinAPI_SetLocaleInfo

    _WinAPI_ShellGetSetFolderCustomSettings

    _WinAPI_ShellOpenFolderAndSelectItems

    _WinAPI_ShellQueryUserNotificationState

  • Added examples for the functions above.
  • Updated Help file.

Edited by Yashied
Posted

2.9

_WinAPI_HideCaret

--------------------------------------------------------------------------------

Creates a new shape for the system caret and assigns ownership of the caret to the specified window.

_WinAPI_CreateCaret

--------------------------------------------------------------------------------

Creates a new shape for the system caret and assigns ownership of the caret to the specified window.

Posted (edited)

  On 8/25/2010 at 7:36 AM, '131738 said:

2.9

_WinAPI_HideCaret

--------------------------------------------------------------------------------

Creates a new shape for the system caret and assigns ownership of the caret to the specified window.

_WinAPI_CreateCaret

--------------------------------------------------------------------------------

Creates a new shape for the system caret and assigns ownership of the caret to the specified window.

Thanks. Fixed. Edited by Yashied
Posted (edited)

  On 8/22/2010 at 4:29 AM, 'netegg said:

just like the type of CDROM(r,rw...)?

Something like that.

#Include <WinAPIEx.au3>

#cs

0x0000 - No media                             -
0x0001 - Obsolete                             Rewritable disk capable with unchanging behavior
0x0002 - Removable disk                       Writable disk capable with removable media
0x0008 - CD-ROM                               Read only Compact Disc capable
0x0009 - CD-R                                 Write once Compact Disc capable
0x000A - CD-RW                                ReWritable Compact Disc capable
0x0010 - DVD-ROM                              Read only DVD
0x0011 - DVD-R Sequential recording           Write once DVD using Sequential recording
0x0012 - DVD-RAM                              Rewritable DVD
0x0013 - DVD-RW Restricted Overwrite          Re-recordable DVD using Restricted Overwrite
0x0014 - DVD-RW Sequential recording          Re-recordable DVD using Sequential recording
0x0015 - DVD-R Dual Layer                     Sequential recording Write once DVD using Sequential recording
0x0016 - DVD-R Dual Layer Jump recording      Write once DVD using Layer Jump recording
0x0017 - DVD-RW Dual Layer                    Re-recordable DVD for Dual Layer
0x0018 - DVD-Download disc recording          Write once DVD for CSS managed recording
0x001A - DVD+RW                               -
0x001B - DVD+R                                -
0x0040 - BD-ROM                               -
0x0041 - BD-R Sequential Recording Mode (SRM) -
0x0042 - BD-R Random Recording Mode (RRM)     -
0x0043 - BD-RE                                -
0x0050 - HD DVD-ROM                           Read only HD DVD
0x0051 - HD DVD-R                             Write once HD DVD
0x0052 - HD DVD-RAM                           Rewritable HD DVD
0x0053 - HD DVD-RW                            Re-recordable HD DVD
0x0058 - HD DVD-R Dual Layer                  Write once HD DVD Dual Layer
0x005A - HD DVD-RW Dual Layer                 Re-recordable HD DVD Dual Layer
0xFFFF - Not Conforming                       The logical unit does not conform to any Profile

#ce

$sDrive = 'E:'

If  DriveGetType($sDrive) <> 'CDROM' Then
    ConsoleWrite($sDrive & ' is not a CD-ROM drive.' & @CR)
    Exit
EndIf

$hDrive = _WinAPI_CreateFileEx('\\.\' & $sDrive, $OPEN_EXISTING, BitOR($GENERIC_READ, $GENERIC_WRITE), BitOR($FILE_SHARE_READ, $FILE_SHARE_WRITE))
If @error Then
    ConsoleWrite(_WinAPI_GetLastErrorMessage() & @CR)
    Exit
EndIf

$tSPT = DllStructCreate('ushort Length;byte ScsiStatus;byte PathId;byte TargetId;byte Lun;byte CdbLength;byte SenseInfoLength;byte DataIn;byte Alignment[3];ulong DataTransferLength;ulong TimeOutValue;ulong_ptr DataBufferOffset;ulong SenseInfoOffset;byte Cdb[16];byte Hdr[8]')
$tCDB = DllStructCreate('byte;byte;byte[2];byte[3];byte[2];byte;byte[2];byte[4]', DllStructGetPtr($tSPT, 'Cdb'))
$tHDR = DllStructCreate('byte[4];byte;byte;byte[2]', DllStructGetPtr($tSPT, 'Hdr'))
$Size = DllStructGetSize($tSPT) - 8

DllStructSetData($tSPT, 'Length', $Size)
DllStructSetData($tSPT, 'ScsiStatus', 0)
DllStructSetData($tSPT, 'PathId', 0)
DllStructSetData($tSPT, 'TargetId', 0)
DllStructSetData($tSPT, 'Lun', 0)
DllStructSetData($tSPT, 'CdbLength', 12)
DllStructSetData($tSPT, 'SenseInfoLength', 0)
DllStructSetData($tSPT, 'DataIn', 1)
DllStructSetData($tSPT, 'DataTransferLength', 8)
DllStructSetData($tSPT, 'TimeOutValue', 30)
DllStructSetData($tSPT, 'DataBufferOffset', $Size)
DllStructSetData($tSPT, 'SenseInfoOffset', 0)

DllStructSetData($tCDB, 1, 0x46) ; GET CONFIGURATION
DllStructSetData($tCDB, 2, 0)
DllStructSetData($tCDB, 3, 0, 1)
DllStructSetData($tCDB, 3, 0, 2)
DllStructSetData($tCDB, 5, 0, 1)
DllStructSetData($tCDB, 5, 8, 2)
DllStructSetData($tCDB, 6, 0)
DllStructSetData($tCDB, 7, 0, 1)
DllStructSetData($tCDB, 7, 0, 2)

If Not _WinAPI_DeviceIoControl($hDrive, $IOCTL_SCSI_PASS_THROUGH, DllStructGetPtr($tSPT), $Size, DllStructGetPtr($tSPT), DllStructGetSize($tSPT)) Then
    ConsoleWrite(_WinAPI_GetLastErrorMessage() & @CR)
    Exit
EndIf

_WinAPI_CloseHandle($hDrive)

$Profile = BitOR(BitShift(DllStructGetData($tHDR, 4, 1), -8), DllStructGetData($tHDR, 4, 2))

ConsoleWrite('Profile for drive ' & $sDrive & ' - 0x' & Hex($Profile, 4) & @CR)
Edited by Yashied
Posted (edited)

A small update without changing UDF version.

Changes

  Reveal hidden contents
  • Added the following functions.

    _WinAPI_GetCDType

    _WinAPI_GetFileSizeOnDisk

    _WinAPI_GetLogicalDrives

    _WinAPI_HiByte

    _WinAPI_IOCTL

    _WinAPI_LoByte

    _WinAPI_LongMid

  • Added constants (Control Codes) for the _WinAPI_DeviceIoControl() function.
  • Added examples for the functions above.
  • Updated documentation.

Edited by Yashied
Posted

E:\AUTOIT3\WinAPIEx_2.9\Examples\WinAPIEx\_WinAPI_GetEnhMetaFileDescription.au3(7,63) : ERROR: _WinAPI_GetEnhMetaFile(): undefined function.

$hEmf = _WinAPI_GetEnhMetaFile(@ScriptDir & '\Extras\Flag.emf')

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

E:\autoit3\AUTOIT3文档\WinAPIEx_2.9\Examples\WinAPIEx\_WinAPI_GetEnhMetaFileDescription.au3(8,48) : ERROR: _WinAPI_GetEnhMetaFileDescription(): undefined function.

$Data = _WinAPI_GetEnhMetaFileDescription($hEmf)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

E:\autoit3\AUTOIT3文档\WinAPIEx_2.9\Examples\WinAPIEx\_WinAPI_GetEnhMetaFileDescription.au3(9,32) : ERROR: _WinAPI_DeleteEnhMetaFile(): undefined function.

_WinAPI_DeleteEnhMetaFile($hEmf)

Posted

  On 8/29/2010 at 6:53 AM, '131738 said:

E:\AUTOIT3\WinAPIEx_2.9\Examples\WinAPIEx\_WinAPI_GetEnhMetaFileDescription.au3(7,63) : ERROR: _WinAPI_GetEnhMetaFile(): undefined function.

$hEmf = _WinAPI_GetEnhMetaFile(@ScriptDir & '\Extras\Flag.emf')

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

E:\autoit3\AUTOIT3文档\WinAPIEx_2.9\Examples\WinAPIEx\_WinAPI_GetEnhMetaFileDescription.au3(8,48) : ERROR: _WinAPI_GetEnhMetaFileDescription(): undefined function.

$Data = _WinAPI_GetEnhMetaFileDescription($hEmf)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

E:\autoit3\AUTOIT3文档\WinAPIEx_2.9\Examples\WinAPIEx\_WinAPI_GetEnhMetaFileDescription.au3(9,32) : ERROR: _WinAPI_DeleteEnhMetaFile(): undefined function.

_WinAPI_DeleteEnhMetaFile($hEmf)

You forgot to write #Include <WinAPIEx.au3>. In my example are no errors.

#Include <WinAPIEx.au3>

Opt('MustDeclareVars', 1)

Global $hEmf, $Data

$hEmf = _WinAPI_GetEnhMetaFile(@ScriptDir & '\Extras\Flag.emf')
$Data = _WinAPI_GetEnhMetaFileDescription($hEmf)
_WinAPI_DeleteEnhMetaFile($hEmf)

ConsoleWrite('Application: ' & $Data[0] & @CR)
ConsoleWrite('Picture:     ' & $Data[1] & @CR)
Posted

You seem to have most of the path functions... But not PathRelativePathTo, which is VERY useful ;)

; #FUNCTION# ====================================================================================================================
; Name...........: _WinApi_PathRelativePathTo
; Description ...: Creates a relative path from one file or folder to another.
; Syntax.........: _WinApi_PathRelativePathTo($sFrom, $sTo)
; Parameters ....: $sFrom        - The path that defines the start of the relative path. (can be a file or a directory)
;                  $sTo          - The path that defines the endpoint of the relative path. (can be a file or a directory)
; Return values .: Success       - The relative path.
;                  Failure       - A blank string with @error set to not zero
; Author ........: Mat
; Modified.......:
; Remarks .......: The paths do not have to be fully-qualified, but they must have a common prefix, or the function will fail.
;                  For example, let the starting point, $sFrom, be "c:\FolderA\FolderB\FolderC", and the ending point, $sTo, be
;                  "c:\FolderA\FolderD\FolderE". _WinAPi_PathRelativePathTo will return the relative path from $sFrom to $sTo as:
;                  "..\..\FolderD\FolderE". You will get the same result if you set $sFrom to "\FolderA\FolderB\FolderC" and $sTo
;                  to "\FolderA\FolderD\FolderE". On the other hand, "c:\FolderA\FolderB" and "a:\FolderA\FolderD do not share a
;                  common prefix, and the function will fail. Note that "\\" is not considered a prefix and is ignored. If you
;                  set $sFrom to "\\FolderA\FolderB", and $sTo to "\\FolderC\FolderD", the function will fail.
; Related .......: _WinApi_PathIsRelative
; Link ..........: http://msdn.microsoft.com/en-us/library/bb773740(VS.85).aspx
; Example .......: Yes
; ===============================================================================================================================
Func _WinApi_PathRelativePathTo($sFrom, $sTo)
    Local $iAttrFrom = 0, $iAttrTo = 0, $aRet

    If _WinAPI_PathIsDirectory($sFrom) Then $iAttrFrom = 16
    If _WinAPI_PathIsDirectory($sTo) Then $iAttrTo = 16

    $aRet = DllCall("shlwapi.dll", "int", "PathRelativePathToW", "wstr", 0, "wstr", $sFrom, "int", $iAttrFrom, "wstr", $sTo, "int", $iAttrTo)
    If @error Or Not $aRet[0] Then Return SetError(@error, @extended, "")

    Return $aRet[1]
EndFunc   ;==>_WinApi_PathRelativePathTo

I left the FILE_ATTRIBUTE_DIRECTORY constant out and used its value instead as it is defined in FileConstants.au3 and I don't know if you want to include constants like that.

Thanks for the amazing set of functions :)

Mat

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...