|     Inicio    |   |         |  |   FOROS      |  |      |      
   Elastix - VoIP B4A (Basic4Android) App inventor 2 PHP - MySQL
  Estación meteorológica B4J (Basic4Java) ADB Shell - Android Arduino
  Raspberry Pi Visual Basic Script (VBS) FireBase (BD autoactualizable) NodeMCU como Arduino
  AutoIt (Programación) Visual Basic Cosas de Windows Webs interesantes
Translate:
Búsqueda en este sitio:


.

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.

DllCall Dynamically calls a function in a DLL.
DllCallAddress Dynamically calls a function at a specific memory address.
DllCallbackFree Frees a previously created handle created with DllCallbackRegister.
DllCallbackGetPtr Returns the pointer to a callback function that can be passed to the Win32 API.
DllCallbackRegister Creates a user-defined DLL Callback function.
DllClose Closes a previously opened DLL.
DllOpen Opens a DLL file for use in DllCall.
DllStructCreate Creates a C/C++ style structure to be used in DllCall.
DllStructGetData Returns the data of an element of the struct.
DllStructGetPtr Returns the pointer to the struct or an element in the struct.
DllStructGetSize Returns the size of the struct in bytes.
DllStructSetData Sets the data of an element in the struct.

______________________________________________
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)

_________________

- Mi correo:
juana1991@yahoo.com
- KIO4.COM - Política de cookies. Textos e imágenes propiedad del autor:
© Juan A. Villalpando
No se permite la copia de información ni imágenes.
Usamos cookies propias y de terceros que entre otras cosas recogen datos sobre sus hábitos de navegación y realizan análisis de uso de nuestro sitio.
Si continúa navegando consideramos que acepta su uso. Acepto    Más información