Bueno como me ando iniciando en las APIs les dejo este pequeño tutorial de como Pasarla de vb6 a Autoit.
La traducción al Español se las debo. :P

bueno de ejempo usaremos esta funcion muy simple.

MoveFile function

Uso: Moves an existing file or a directory, including its children.

Syntax

BOOL WINAPI MoveFile(
__in LPCTSTR lpExistingFileName,
__in LPCTSTR lpNewFileName
);



Los Parametros:

Parameters

lpExistingFileName [in]
The current name of the file or directory on the local computer.

lpNewFileName [in]
The new name for the file or directory. The new name must not already exist. A new file may be on a different file system or drive. A new directory must be on the same drive.

valor de retorno.
Return value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.


Codigo VB6

Código: Seleccionar todo

Private Declare Function MoveFile Lib "kernel32.dll" Alias "MoveFileA" _
(ByVal lpExistingFileName As String, ByVal lpNewFileName As String) As Long


Private Sub Command1_Click()
Dim retval As Long

retval = MoveFile("C:\Users\usuario\Desktop\1.txt", "C:\1.txt")
End Sub

Ok ahora A pasarlo a Autoit

Para usar Dll en Autoit usamos la Función

DllCall

Sintaxis
DllCall ( "dll", "return type", "function" [, type1, param1 [, type n, param n]] )

Nos basaremos es esta tabla de conversión de los Tipos.

Conversions from Windows API types to AutoIt types:
WINDOWS API Type ====> AutoIt Type
[LPCSTR/LPSTR ====> str
LPCWSTR/LPWSTR ====> wstr
LPVOID ====> ptr
LPxyz ====> xyz*
HINSTANCE ====> handle
HRESULT long
LONGLONG/LARGE_INTEGER ====> INT64
ULONGLONG/ULARGE_INTEGER ====> UINT64
SIZE_T ====> ULONG_PTR


Explicación de la sintaxis



DllCall ( "dll", "return type", "function" [, type1, param1 [, type n, param n]] )


DllCall ( "Nombre de la Dll", "Tipo de Retorno segun La Libreria MSDN", "Nombre de la F" [, Tipo1, parametro1 [, tipo n, parametro n]] )


Entoces nos queda.


DllCall("kernel32.dll","int","MoveFile","str","C:\Users\usuario\Desktop\1.txt","str","C:\1.txt")


int = Un entero de 32 Bits/4bytes
str= cadena ANSI (un mínimo de 65.536).

De esto nos podemos fijar en la tabla de Tipos Valitos de Autoit
[Enlace externo eliminado para invitados]


Bueno Espero que les Sirva el Pequeño Tutorial Cuanquier Duda Pregunten.
Imagen
Responder

Volver a “Manuales”