|
332
|
Programación / Programación Visual Basic / Re: NayrocBits - Malware
|
en: 29 Diciembre 2006, 22:36 pm
|
Me encantaria insultarte! otro mas que crea un virus para romper la makina de alguien [...] que ganas...? ensima mira todo lo que posteas, no sabes que la mayoria de la gente no lee todo xq le parece agobiante, ponlo de a poco y explicado si lo vas a hacer. Salu2 y espero que no te sirva
|
|
|
333
|
Programación / Programación Visual Basic / Re: Cambiar la posición de un msgbox
|
en: 9 Septiembre 2006, 01:54 am
|
toma esto talvez que te sirve! Añade el siguiente código al módulo BAS: Nota: He dejado los comentarios originales en inglés, ya que no necesitan demasiada traducción... espero...
'------------------------------------------------------------------ 'Ejemplo para posicionar un MsgBox (15/Jun/98) ' 'Microsoft TechNet Knowledge Base, PSS ID Number: Q180936 'HOWTO: Position a MsgBox Using a Windows Hook Procedure ' '©Guillermo 'guille Som, 1998 '------------------------------------------------------------------ Option Explicit
Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type
Public Declare Function UnhookWindowsHookEx Lib "user32" _ (ByVal hHook As Long) As Long Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _ (ByVal hwnd As Long, ByVal nIndex As Long) As Long Public Declare Function GetCurrentThreadId Lib "kernel32" () As Long Public Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" _ (ByVal idHook As Long, ByVal lpfn As Long, _ ByVal hmod As Long, ByVal dwThreadId As Long) As Long 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 Public Declare Function GetWindowRect Lib "user32" _ (ByVal hwnd As Long, lpRect As RECT) As Long
Public Const GWL_HINSTANCE = (-6) Public Const SWP_NOSIZE = &H1 Public Const SWP_NOZORDER = &H4 Public Const SWP_NOACTIVATE = &H10 Public Const HCBT_ACTIVATE = 5 Public Const WH_CBT = 5
Public hHook As Long
Function WinProc1(ByVal lMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
If lMsg = HCBT_ACTIVATE Then 'Show the MsgBox at a fixed location (0,0) SetWindowPos wParam, 0, 0, 0, 0, 0, _ SWP_NOSIZE Or SWP_NOZORDER Or SWP_NOACTIVATE 'Release the CBT hook UnhookWindowsHookEx hHook End If WinProc1 = False
End Function
Function WinProc2(ByVal lMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Dim rectForm As RECT, rectMsg As RECT Dim x As Long, y As Long
'On HCBT_ACTIVATE, show the MsgBox centered over Form1 If lMsg = HCBT_ACTIVATE Then 'Get the coordinates of the form and the message box so that 'you can determine where the center of the form is located GetWindowRect Form1.hwnd, rectForm GetWindowRect wParam, rectMsg x = (rectForm.Left + (rectForm.Right - rectForm.Left) / 2) - _ ((rectMsg.Right - rectMsg.Left) / 2) y = (rectForm.Top + (rectForm.Bottom - rectForm.Top) / 2) - _ ((rectMsg.Bottom - rectMsg.Top) / 2) 'Position the msgbox SetWindowPos wParam, 0, x, y, 0, 0, _ SWP_NOSIZE Or SWP_NOZORDER Or SWP_NOACTIVATE 'Release the CBT hook UnhookWindowsHookEx hHook End If WinProc2 = False End Function
Este es el código que hay que añadir al formulario:
' '------------------------------------------------------------------ 'Ejemplo para posicionar un MsgBox (15/Jun/98) ' 'Microsoft TechNet Knowledge Base, PSS ID Number: Q180936 'HOWTO: Position a MsgBox Using a Windows Hook Procedure ' '©Guillermo 'guille Som, 1998 '------------------------------------------------------------------ Option Explicit
Private Sub Command1_Click() Dim hInst As Long Dim Thread As Long 'Set up the CBT hook hInst = GetWindowLong(Me.hwnd, GWL_HINSTANCE) Thread = GetCurrentThreadId() hHook = SetWindowsHookEx(WH_CBT, AddressOf WinProc1, hInst, Thread) 'Display the message box MsgBox "This message box has been positioned at (0,0)." End Sub Private Sub Command2_Click() Dim hInst As Long Dim Thread As Long 'Set up the CBT hook hInst = GetWindowLong(Me.hwnd, GWL_HINSTANCE) Thread = GetCurrentThreadId() hHook = SetWindowsHookEx(WH_CBT, AddressOf WinProc2, hInst, Thread) 'Display the message box MsgBox "This message box is centered over Form1." End Sub
|
|
|
334
|
Programación / Programación Visual Basic / funcion con $ o sin $
|
en: 8 Septiembre 2006, 03:58 am
|
Hola gente yo de nuevo, les parecera bastante ignorante esto (o talvez q no), hace mas de 1 año q uso vb y todavia no tengo ni la mas menor idea de la diferencia que hay entre una funcion y una funcion con el $ al final. Suponiendo una devuelve el valor y la otra? EJ: Espero que alguien me responda, gracias!
|
|
|
335
|
Programación / Programación Visual Basic / Grafico a colores
|
en: 7 Septiembre 2006, 02:19 am
|
Hola gente, miren estaba queriendo poner un cuadradito en el centro de la pantalla y lo logre pero lo que no puedo hacer es que tenga color, aqui les dejo hasta donde llegue, alguno me podria ayudar o darme las API's para hacerlo. Muchas gracias! Timer1.interval = 1 Private Declare Function GetWindowDC Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function Rectangle Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Sub Timer1_Timer() On Error Resume Next Rectangle GetWindowDC(0), 509, 381, 515, 387 End Sub
|
|
|
336
|
Programación / Programación Visual Basic / Re: Pregunta dicil.
|
en: 30 Agosto 2006, 03:35 am
|
- POLACO - ya esta todo, ya lo ayude y le sirvio le hice esa parte y kedo re bien! asi q creo q no necesita mas ayuda y los que intenten ayudar no se rompan el coco al pedo.
|
|
|
338
|
Programación / Programación Visual Basic / Re: de msdos a vb
|
en: 29 Agosto 2006, 02:39 am
|
Toma esto lo saque de la API-GUIDE: 'Redirects output from console program to textbox. 'Requires two textboxes and one command button. 'Set MultiLine property of Text2 to true. ' 'Original bcx version of this program was made by ' dl <dl@tks.cjb.net> 'VB port was made by Jernej Simoncic <jernej@isg.si> 'Visit Jernejs site at http://www2.arnes.si/~sopjsimo/ ' 'Note: don't run plain DOS programs with this example 'under Windows 95,98 and ME, as the program freezes when 'execution of program is finnished.
Option Explicit Private Declare Function CreatePipe Lib "kernel32" (phReadPipe As Long, phWritePipe As Long, lpPipeAttributes As SECURITY_ATTRIBUTES, ByVal nSize As Long) As Long Private Declare Sub GetStartupInfo Lib "kernel32" Alias "GetStartupInfoA" (lpStartupInfo As STARTUPINFO) Private Declare Function CreateProcess Lib "kernel32" Alias "CreateProcessA" (ByVal lpApplicationName As String, ByVal lpCommandLine As String, lpProcessAttributes As Any, lpThreadAttributes As Any, ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, lpEnvironment As Any, ByVal lpCurrentDriectory As String, lpStartupInfo As STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) As Long Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long Private Declare Function ReadFile Lib "kernel32" (ByVal hFile As Long, lpBuffer As Any, ByVal nNumberOfBytesToRead As Long, lpNumberOfBytesRead As Long, lpOverlapped As Any) As Long Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Type SECURITY_ATTRIBUTES nLength As Long lpSecurityDescriptor As Long bInheritHandle As Long End Type
Private Type PROCESS_INFORMATION hProcess As Long hThread As Long dwProcessId As Long dwThreadId As Long End Type
Private Type STARTUPINFO cb As Long lpReserved As Long lpDesktop As Long lpTitle As Long dwX As Long dwY As Long dwXSize As Long dwYSize As Long dwXCountChars As Long dwYCountChars As Long dwFillAttribute As Long dwFlags As Long wShowWindow As Integer cbReserved2 As Integer lpReserved2 As Byte hStdInput As Long hStdOutput As Long hStdError As Long End Type
Private Type OVERLAPPED ternal As Long ternalHigh As Long offset As Long OffsetHigh As Long hEvent As Long End Type
Private Const STARTF_USESHOWWINDOW = &H1 Private Const STARTF_USESTDHANDLES = &H100 Private Const SW_HIDE = 0 Private Const EM_SETSEL = &HB1 Private Const EM_REPLACESEL = &HC2
Private Sub Command1_Click() Command1.Enabled = False Redirect Text1.Text, Text2 Command1.Enabled = True End Sub Private Sub Form_Load() Text1.Text = "ping" End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) If Command1.Enabled = False Then Cancel = True End Sub
Sub Redirect(cmdLine As String, objTarget As Object) Dim i%, t$ Dim pa As SECURITY_ATTRIBUTES Dim pra As SECURITY_ATTRIBUTES Dim tra As SECURITY_ATTRIBUTES Dim pi As PROCESS_INFORMATION Dim sui As STARTUPINFO Dim hRead As Long Dim hWrite As Long Dim bRead As Long Dim lpBuffer(1024) As Byte pa.nLength = Len(pa) pa.lpSecurityDescriptor = 0 pa.bInheritHandle = True pra.nLength = Len(pra) tra.nLength = Len(tra)
If CreatePipe(hRead, hWrite, pa, 0) <> 0 Then sui.cb = Len(sui) GetStartupInfo sui sui.hStdOutput = hWrite sui.hStdError = hWrite sui.dwFlags = STARTF_USESHOWWINDOW Or STARTF_USESTDHANDLES sui.wShowWindow = SW_HIDE If CreateProcess(vbNullString, cmdLine, pra, tra, True, 0, Null, vbNullString, sui, pi) <> 0 Then SetWindowText objTarget.hwnd, "" Do Erase lpBuffer() If ReadFile(hRead, lpBuffer(0), 1023, bRead, ByVal 0&) Then SendMessage objTarget.hwnd, EM_SETSEL, -1, 0 SendMessage objTarget.hwnd, EM_REPLACESEL, False, lpBuffer(0) DoEvents Else CloseHandle pi.hThread CloseHandle pi.hProcess Exit Do End If CloseHandle hWrite Loop CloseHandle hRead End If End If End Sub
Si es lo mismo que esa web que estabas viendo perdon no tenia tiempo para verla. XD
|
|
|
340
|
Programación / Programación Visual Basic / puerto paralelo!
|
en: 28 Mayo 2006, 02:32 am
|
Hola people miren estuve leyendo el manual del puerto paralelo en la sección de electronica y lo intente, coloque 1 xtremo del led en el pin 2 del puerto y el otro xtremo a el pin 25 y en vb puse esto: Private Declare Function Inp Lib "inpout32.dll" Alias "Inp32" (byvalPortAddress As Integer) As Integer Private Declare Sub Out Lib "inpout32.dll" Alias "Out32" (ByVal portaddress As Integer, ByVal value As Integer)
Private Sub form_load() Out &H378, 2 End Sub con ese code el vb se cierra y no se prende el led tambien use la dll IO con este code: Private Declare Sub PortOut Lib "IO.DLL" (ByVal Port As Integer, ByVal Data As Byte)
Private Sub Form_load() PortOut &H378, 2 End Sub y asi tampoco anda, espero que alguien me tenga la solucion xq yame estoy volviendo loco XD. Gracias y salu2 Sancho.Mazorka
|
|
|
|
|
|
|