Saltar al contenido
Underc0de /foro

Windows API Library

🌐 This is an automatic translation of a topic from Underc0de, the largest Spanish-speaking hacking and IT community. Read the original (Spanish) and reply →
Alex ·
[INDEX]
<br /><br />    * Sleep <br />    * Findwindow <br />    * Shellexecute <br />    * ShFileOperation <br />    * Copyfile <br />    * SetwindowPost <br />    * Exitprocess <br />    * GetCurrentProcess <br />    * URLDownloadToFile <br />    * GetLogicalDrives <br />    * Keybd_Event <br />    * DoFileDownload <br />    * MoveFile <br />    * TextOut <br />    * GetParent <br />    * SetCursorPos <br />    * BlockInput <br />    * ExitWindowsEx<br />    * GetLogicalTime<br />    * GetCursorPos<br />    * SetWindowText<br />    * GetForegroundWindow<br />    * GetWindowText<br />    * mouse_event
Alex ·
Name: Sleep<br /><br />Declaration:<br /><br />
Código: text
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)<br />Explicacion: Se usa para generar un retardo.+
<br /><br />Usage example:<br /><br />
Código: text
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)<br />private sub form_load()<br />sleep(5000)<br />msgbox "ya pasaron 5 segundos"<br />end sub
Alex ·
Name: Findwindow<br /><br />Declaration:<br /><br />
Código: text
Private Declare Function FindWindow _ <br />     Lib "user32" _ <br />     Alias "FindWindowA" ( _ <br />         ByVal lpClassName As String, _ <br />         ByVal lpWindowName As String) As Long
<br /><br /><br />Explanation of this API: It's used to find out whether a window is active, among other things.<br /><br />Usage example:<br />
Código: text
Private Declare Function FindWindow _ <br />     Lib "user32" _ <br />     Alias "FindWindowA" ( _ <br />        ByVal lpClassName As String, _ <br />        ByVal lpWindowName As String) As Long<br />private sub command1_click() <br />   <br /> Dim hola As Long <br />         <br />     hola = FindWindow(clase, vbNullString) <br />       <br /><br />     If hola<> 0 Then <br />         MsgBox "está abierta"<br />     Else  
Alex ·
Name: Shellexecute<br /><br />Declaration:<br /><br />
Código: text
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _<br />(ByVal hWnd As Long, ByVal lpOperation As String, ByVal _<br /> lpFile As String, ByVal lpParameters As String, ByVal _<br /> lpDirectory As String, ByVal nShowCmd As Long) As Long<br />
<br /><br />Explanation: What this API does is execute files.<br /><br />Usage example: (this code is by mr.blood, thanks friend)<br /><br />
Código: text
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _<br />(ByVal hWnd As Long, ByVal lpOperation As String, ByVal _<br /> lpFile As String, ByVal lpParameters As String, ByVal _<br /> lpDirectory As String, ByVal nShowCmd As Long) As Long<br /><br />Public Function Archivos(ByVal rute As String, hWnd As String, VBHide As Boolean)<br />Dim num As Integer<br />If VBHide = False Then<br />num = 1<br />Else<br />If VBHide = True Then<br />num = 0<br />End If<br />End If<br />Call ShellExecute(hWnd, "Open", rute, "", "", num)<br />End Function<br />es un ejemplo de una dll, para reproducir musica.
Alex ·
Name: ShFileOperation<br /><br />Declaration:<br /><br />
Código: text
Private Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long  
<br /><br />Explanation: This API is used to delete a file.<br /><br />Usage example:<br /><br />
Código: text
Private Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long  <br />  <br /> Private Sub Form_Load()  <br />     Dim Operacion As SHFILEOPSTRUCT  <br />     Dim file As String  <br />     file = "c:\Nuevo Documento de texto.txt"  <br />    With Operacion  <br />          <br />         .wFunc = 3  <br />         'Este el Path al archivo a eliminar  <br />         .pFrom = App.Path & "\" & file  <br />          <br />         .fFlags = 64  <br />     End With  <br />        <br />     SHFileOperation Operacion  <br />  <br /> End Sub
<br /><br />Note: the file is deleted on this line:<br /><br />
Código: text
SHFileOperation Operacion
<br /><br />Operacion is the path of the file to delete.
Alex ·
Name: Copyfile<br /><br />Declaration:<br /><br />
Código: text
Private Declare Function CopyFile Lib "kernel32" Alias "CopyFileA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal bFailIfExists As Long) As Long<br />
<br /><br />Explanation: It's used to copy a file.<br /><br />Usage example:<br /><br />
Código: text
Private Declare Function CopyFile Lib "kernel32" Alias "CopyFileA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal bFailIfExists As Long) As Long<br />Dim Copiar As Long<br /><br />Copiar = CopyFile(App.Path & "\Drinky.crack", "C:\Drinky.crack", 1)
<br /><br />thanks drinky :D<br /><br />regards!
Alex ·
Name: SetwindowPost<br /><br />Declaration:<br /><br />
Código: text
Public Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long<br />
<br /><br />Explanation: It's used to make a window always stay on top, among other things.<br /><br />Usage example:<br /><br />
Código: text
Public Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long<br /><br />Private Const HWND_TOPMOST = -1<br /><br />Private Sub Form_Load()<br />Me.ScaleMode = vbPixels<br />SetWindowPos Me.hwnd, HWND_TOPMOST, Me.ScaleLeft, Me.ScaleTop, Me.ScaleWidth, Me.ScaleHeight, 0<br />End Sub
Alex ·
Name: Exitprocess<br /><br />Declaration:<br /><br />
Código: text
Private Declare Sub ExitProcess Lib "kernel32" ( _ <br />     ByVal uExitCode As Long) <br /> Private Declare Function GetExitCodeProcess Lib "kernel32" ( _ <br />     ByVal hProcess As Long, _ <br />     lpExitCode As Long) As Long
<br /><br />Explanation: It's used to kill a process.<br /><br />Usage example:<br /><br />
Código: text
Private Declare Sub ExitProcess Lib "kernel32" ( _ <br />     ByVal uExitCode As Long) <br /> Private Declare Function GetExitCodeProcess Lib "kernel32" ( _ <br />     ByVal hProcess As Long, _ <br />     lpExitCode As Long) As Long<br />ExitProcess GetExitCodeProcess(GetCurrentProcess, 0)
<br /><br />Note: This API goes hand in hand with the GetCurrentProcess API (explained further below. If you don't read how it's used, you won't understand this API either, already explained.
Alex ·
Name: GetCurrentProcess<br /><br />Declaration:<br /><br />
Código: text
Private Declare Function GetCurrentProcess Lib "kernel32" () As Long
<br /><br />Explanation: Reads the processes that are open.<br /><br />Usage example: Same as the Exitprocess API, but declaring this one. I already said before that these APIs go hand in hand.<br />Ask if you have any questions about them.
Alex ·
Name: URLDownloadToFile<br /><br />Declaration:<br /><br />
Código: text
Private Declare Function URLDownloadToFile _ <br />     Lib "urlmon" _ <br />     Alias "URLDownloadToFileA" ( _ <br />         ByVal pCaller As Long, _ <br />         ByVal szURL As String, _ <br />         ByVal szFileName As String, _ <br />         ByVal dwReserved As Long, _ <br />         ByVal lpfnCB As Long) As Long
<br /><br />Explanation: It's used to download files.<br /><br />Usage example:<br /><br />
Código: text
Private Declare Function URLDownloadToFile _ <br />     Lib "urlmon" _ <br />     Alias "URLDownloadToFileA" ( _ <br />         ByVal pCaller As Long, _ <br />         ByVal szURL As String, _ <br />         ByVal szFileName As String, _ <br />         ByVal dwReserved As Long, _ <br />         ByVal lpfnCB As Long) As Long<br />private sub command1_click()<br />Call URLDownloadToFile(0, Url, App.Path & "\nombre.drinkyf", 0, 0)
<br /><br />Note: the first parameter is the URL and the second is where it gets saved.
Alex ·
Name: Keybd_Event<br /><br />Declaration:<br />It is declared as follows:<br /><br />
Código: text
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, _ <br />     ByVal bScan As Byte, _ <br />     ByVal dwFlags As Long, _ <br />     ByVal dwExtraInfo As Long) <br />y acen falta dos constantes:<br />Código:<br />Const KEYEVENTF_KEYUP = &H2 <br /> Const KEYEVENTF_EXTENDEDKEY = &H1
<br /><br />Explanation: It's used to simulate key presses.<br /><br />Usage example:<br /><br />
Código: text
   <br /> Const KEYEVENTF_KEYUP = &H2 <br /> Const KEYEVENTF_EXTENDEDKEY = &H1 <br />     <br />   Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, _ <br />       ByVal bScan As Byte, _ <br />       ByVal dwFlags As Long, _ <br />       ByVal dwExtraInfo As Long) <br />     <br />     <br />     <br />   Sub Pulsar_Tecla(Tecla As Long) <br />     <br />       Call keybd_event(Tecla, 0, 0, 0) <br />     <br />       Call keybd_event(Tecla, 0, KEYEVENTF_KEYUP, 0) <br />     <br />   End Sub  <br /><br />   Private Sub Timer1_Timer() <br />   Call Pulsar_Tecla(vbKeyTab) <br />   End Sub 
Grupo de WhatsApp