Autoit en español
Aplicaciones con Autoit - Juan Antonio Villalpando
-- Tutorial de iniciación a Autoit --
Volver al índice del tutorial
____________________________
53.- Funciones DLL.
__________________________________________
- Funciones propias de AutoIt. DLL.
- En este enlace observamos una serie de funciones de trabajo con DLL
(Dynamically Linked Library)
de Windows.
- https://www.autoitscript.com/autoit3/docs/functions.htm
- DLL son archivos que en su interior contienen trozos de códigos (funciones). También pueden contener imágenes, especialmente iconos.
- Podemos llamar a un función que se encuentre en el interior de un DLL y actuar con esa función.
______________________________________________
1.- Llamada.
- Este código llama al archivo user32.dll que se encuentra:
%windir%\SysWOW64\user32.dll en los Windows de 32 bits
%windir%\System32\user32.dll en los Windows de 64 bits.
- Dentro de ese archivo se encuentra la función "MessageBox" que crea la Caja de mensajes. Ponemos algunos parámetros necesarios y realiza exactamente la aparición del MsgBox.
DLL |
; Calling the MessageBox API directly.
DllCall("user32.dll", "int", "MessageBox", _
"hwnd", 0, _ ; Handle to the parent window
"str", "Some text", _ ; The text of the message box
"str", "Some title", _ ; The title of the message box
"int", 0) ; Flags for the message box.
|
- Para ver los iconos y algunas cosas más de un DLL podemos utilizar Resource Hack.
______________________________________________
2.- Iconos en el shell32.dll.
- Observamos que el archivo shell32.dll contiene muchos iconos, si un programa de Windows necesita uno de esos iconos, tendría que llamar a ese shell32.ll y decirle el número de icono que quiere.
Abre el archivo shell32.dll |
#include <MsgBoxConstants.au3>
; Show the Windows PickIconDlg.
Local $sFileName = @SystemDir & '\shell32.dll'
; Create a structure to store the icon index
Local $tIconIndex = DllStructCreate("int")
Local $tString = DllStructCreate("wchar[260]")
Local $iStructsize = DllStructGetSize($tString) / 2
DllStructSetData($tString, 1, $sFileName)
; Run the PickIconDlg - '62' is the ordinal value for this function
DllCall("shell32.dll", "none", 62, _
"hwnd", 0, _
"struct*", $tString, _
"int", $iStructsize, _
"struct*", $tIconIndex)
$sFileName = DllStructGetData($tString, 1)
Local $iIconIndex = DllStructGetData($tIconIndex, 1)
; Show the new filename and icon index
MsgBox($MB_SYSTEMMODAL, "Info", "Last selected file: " & $sFileName & @CRLF & "Icon-Index: " & $iIconIndex)
|
_________________
|