elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Curso de javascript por TickTack


  Mostrar Mensajes
Páginas: 1 2 [3] 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ... 74
21  Programación / Programación Visual Basic / Re: Ayuda a crear en visual basic "Generar Enlace" en: 5 Enero 2016, 06:12 am
hola estudialo y trata de entenderlo al menos.

Código:
Option Explicit

Private Sub Command1_Click()
    Dim i As Integer
    Dim sLinks() As String
    Dim sResult As String
   
    sLinks = Split(Text1.Text, vbCrLf)
   
    For i = 0 To UBound(sLinks)
        If Len(sLinks(i)) Then
        sResult = sResult & "<Script>code(" & Chr$(34) & Format(i + 1, "000") & Chr$(34) & "," & _
                    Chr$(34) & sLinks(i) & Chr$(34) & ");</script>" & vbCrLf
        End If
    Next
    Text2.Text = sResult
End Sub

Private Sub Command2_Click()
    Text2.Text = vbNullString
End Sub
22  Programación / Programación Visual Basic / Re: VB6: Problema con función "ProcessExists" en: 25 Noviembre 2015, 13:57 pm
hola por lo que vi estas llamando mal la funcion

Incorrecto

Código:
MsgBox IsProcessRunning(FindProcessID("teste.exe"))

IsProcessRunning requiere el nombre del proceso (string) no el id por lo que no es necesario llamar a findprocessID, Ó como quieras puedes usar findprocessID  y si este retorna <>  0 quiere decir que el proceso esta en ejecucion

Código:
MsgBox IsProcessRunning("teste.exe")

o

Código:
MsgBox FindProcessID("teste.exe") <> 0
23  Programación / Programación Visual Basic / Re: VB6: Problema con función "ProcessExists" en: 24 Noviembre 2015, 17:42 pm
Hola perdona me estoy llendo al trabajo pero veo que pasaste un rar de 22mb que para solo comprobar  si un exe se esta ejecutando? mira yo creo que con lo que tenes antes tiene que funcionar sino decime cual es el ejcutable en cuestion
24  Programación / Programación Visual Basic / Re: VB6: Problema con función "ProcessExists" en: 24 Noviembre 2015, 16:05 pm
Hola es por un tema de privilegios. para ello tenes que darle ciertos privilegios a tu proceso pega en un modulo bas este codigo

Código
  1. Option Explicit
  2. Private Declare Function GetCurrentProcess Lib "kernel32" () As Long
  3. Private Declare Function OpenProcessToken Lib "advapi32" (ByVal ProcessHandle As Long, ByVal DesiredAccess As Long, TokenHandle As Long) As Long
  4. Private Declare Function LookupPrivilegeValue Lib "advapi32" Alias "LookupPrivilegeValueA" (ByVal lpSystemName As String, ByVal lpName As String, lpLuid As Luid) As Long
  5. Private Declare Function AdjustTokenPrivileges Lib "advapi32" (ByVal TokenHandle As Long, ByVal DisableAllPrivileges As Long, NewState As TOKEN_PRIVILEGES, ByVal BufferLength As Long, PreviousState As Any, ReturnLength As Long) As Long
  6.  
  7. Private Type Luid
  8.    lowpart                     As Long
  9.    highpart                    As Long
  10. End Type
  11.  
  12. Private Type LUID_AND_ATTRIBUTES
  13.    pLuid                       As Luid
  14.    Attributes                  As Long
  15. End Type
  16.  
  17. Private Type TOKEN_PRIVILEGES
  18.    PrivilegeCount              As Long
  19.    Privileges(1)               As LUID_AND_ATTRIBUTES
  20. End Type
  21.  
  22. Private Const TOKEN_ADJUST_PRIVILEGES           As Long = &H20
  23. Private Const TOKEN_QUERY                       As Long = &H8
  24. Private Const SE_PRIVILEGE_ENABLED              As Long = &H2
  25. Private Const SE_DEBUG_NAME                     As String = "SeDebugPrivilege"
  26.  
  27. Public Function AdjustPrivileges() As Boolean
  28.    Dim lToken              As Long
  29.    Dim tTOKEN_PRIVILEGES   As TOKEN_PRIVILEGES
  30.    Dim lProcessID          As Long
  31.  
  32.    lProcessID = GetCurrentProcess
  33.    If Not OpenProcessToken(lProcessID, TOKEN_ADJUST_PRIVILEGES Or TOKEN_QUERY, lToken) = 0 Then
  34.        With tTOKEN_PRIVILEGES
  35.            If LookupPrivilegeValue(vbNullString, SE_DEBUG_NAME, .Privileges(0).pLuid) = 0 Then
  36.                Exit Function
  37.            End If
  38.            .PrivilegeCount = 1
  39.            .Privileges(0).Attributes = SE_PRIVILEGE_ENABLED
  40.        End With
  41.        If Not AdjustTokenPrivileges(lToken, 0, tTOKEN_PRIVILEGES, Len(tTOKEN_PRIVILEGES), 0&, 0&) = 0 Then
  42.            AdjustPrivileges = True
  43.        End If
  44.    End If
  45. End Function

luego en el form load llama a  AdjustPrivileges,
y la funcion IsProcessRunning anda bien.

Saludos.
25  Programación / Programación Visual Basic / Re: Problema MDIChild en: 26 Abril 2015, 22:10 pm
Hola la propiedad MDIChild es solo para tiempo de diseño, te aconsejo busques otra alternativa.

Saludos.
26  Programación / Programación Visual Basic / Re: Capturar contenido en un Picturebox en: 15 Enero 2015, 18:42 pm
Hola casualmente alguien pregunto en otro foro lo mismo pero con zoom, aca tenes una rutina

en un modulo
Código
  1. Option Explicit
  2.  
  3. Private Type GUID
  4.    Data1 As Long
  5.    Data2 As Integer
  6.    Data3 As Integer
  7.    Data4(7) As Byte
  8. End Type
  9.  
  10. Private Type PicBmp
  11.    Size As Long
  12.    Type As Long
  13.    hBmp As Long
  14.    hPal As Long
  15.    Reserved As Long
  16. End Type
  17.  
  18. Private Type RECT
  19.    Left As Long
  20.    Top As Long
  21.    Right As Long
  22.    Bottom As Long
  23. End Type
  24.  
  25. Private Declare Function GetDC Lib "user32.dll" (ByVal hwnd As Long) As Long
  26. Private Declare Function ReleaseDC Lib "user32.dll" (ByVal hwnd As Long, ByVal hdc As Long) As Long
  27. Private Declare Function PrintWindow Lib "user32.dll" (ByVal hwnd As Long, ByVal hdcBlt As Long, ByVal nFlags As Long) As Long
  28. Private Declare Function OleCreatePictureIndirect Lib "olepro32.dll" (PicDesc As PicBmp, RefIID As GUID, ByVal fPictureOwnsHandle As Long, IPic As IPicture) As Long
  29. Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
  30. Private Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hdc As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
  31. Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
  32. Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long
  33. Private Declare Function GetWindowRect Lib "user32.dll" (ByVal hwnd As Long, ByRef lpRect As RECT) As Long
  34. Private Declare Function SetStretchBltMode Lib "gdi32.dll" (ByVal hdc As Long, ByVal nStretchMode As Long) As Long
  35. Private Declare Function StretchBlt Lib "gdi32.dll" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long
  36. Private Declare Function DeleteObject Lib "gdi32.dll" (ByVal hObject As Long) As Long
  37.  
  38.  
  39. Function GetPictureControl(oControl As Object, Zoom As Integer) As Picture
  40.    Dim hdc As Long
  41.    Dim hDCMemory As Long, hBmp As Long, hBmpPrev As Long
  42.    Dim hDCMemory2 As Long, hBmp2 As Long, hBmpPrev2 As Long
  43.    Dim tRect As RECT
  44.    Dim lWidth As Long, lHeight As Long
  45.    Dim NewWidth As Long, NewHeight As Long
  46.    Dim Pic As PicBmp, IPic As IPicture, IID_IDispatch As GUID
  47.  
  48.    GetWindowRect oControl.hwnd, tRect
  49.  
  50.    lWidth = tRect.Right - tRect.Left
  51.    lHeight = tRect.Bottom - tRect.Top
  52.  
  53.    hdc = GetDC(0)
  54.    hDCMemory = CreateCompatibleDC(0)
  55.    hBmp = CreateCompatibleBitmap(hdc, lWidth, lHeight)
  56.    hBmpPrev = SelectObject(hDCMemory, hBmp)
  57.  
  58.    PrintWindow oControl.hwnd, hDCMemory, 0
  59.  
  60.  
  61.    NewWidth = (lWidth * Zoom / 100)
  62.    NewHeight = (lHeight * Zoom / 100)
  63.  
  64.    hDCMemory2 = CreateCompatibleDC(0)
  65.    hBmp2 = CreateCompatibleBitmap(hdc, NewWidth, NewHeight)
  66.    hBmpPrev2 = SelectObject(hDCMemory2, hBmp2)
  67.  
  68.    SetStretchBltMode hDCMemory2, vbPaletteModeNone
  69.    StretchBlt hDCMemory2, 0, 0, NewWidth, NewHeight, hDCMemory, 0, 0, lWidth, lHeight, vbSrcCopy
  70.  
  71.    ReleaseDC 0, hdc
  72.  
  73.    DeleteObject SelectObject(hDCMemory, hBmpPrev)
  74.    Call DeleteDC(hDCMemory)
  75.  
  76.    Call SelectObject(hDCMemory2, hBmpPrev2)
  77.    Call DeleteDC(hDCMemory2)
  78.  
  79.    With IID_IDispatch
  80.        .Data1 = &H20400
  81.        .Data4(0) = &HC0
  82.        .Data4(7) = &H46
  83.    End With
  84.  
  85.  
  86.    With Pic
  87.        .Size = Len(Pic)
  88.        .Type = vbPicTypeBitmap
  89.        .hBmp = hBmp2
  90.    End With
  91.  
  92.    Call OleCreatePictureIndirect(Pic, IID_IDispatch, 1, IPic)
  93.  
  94.    Set GetPictureControl = IPic
  95.  
  96.  
  97. End Function
  98.  

y en el formulario lo llamas asi con un zoom de 150 (si lo queres tal cual le pones 100)
Código
  1. Private Sub Command1_Click()
  2.    Me.Picture = GetPictureControl(Picture1, 150)
  3. End Sub
  4.  


Saludos.
27  Programación / Programación Visual Basic / Re: Abrir imagen en el paint con VBS en: 11 Diciembre 2014, 05:33 am
Hola mira creo que asi:
hay dos formas una tomando como base la misma ruta que el .vbs y la otra utilizando la ruta del escritorio.

Código:
Set WshShell = WScript.CreateObject("WScript.Shell")
'WshShell.Run "%windir%\system32\mspaint.exe " & chr(34) & left(WScript.ScriptFullName,instrrev(WScript.ScriptFullName,"\")) & "Imagen\35737.png" & chr(34)
WshShell.Run "%windir%\system32\mspaint.exe " & chr(34) & WshShell.SpecialFolders("Desktop") & "\Imagen\35737.png" & chr(34)
28  Programación / Programación Visual Basic / Re: Utilizar función ShowInTaskbar con firefox en: 3 Noviembre 2014, 19:13 pm
hola no manejo .net  pero a simple vista te dira que remplazes "Long" por  "System.IntPtr", es importante para que los cambios se resalten tenes que poner la ventana hide luego aplicar el camibio a  Not WS_EX_APPWINDOW y luego ponerla visible.

Código:
    ShowWindow hwndFireFox, 0
    SetWindowLong hwndFireFox, GWL_EXSTYLE, GetWindowLong(hwndFireFox, GWL_EXSTYLE) And Not WS_EX_APPWINDOW
    ShowWindow hwndFireFox, 1
 
29  Programación / Programación Visual Basic / Re: Utilizar función ShowInTaskbar con firefox en: 31 Octubre 2014, 20:26 pm
Hola dos ayudas rapida, por lo que vi en algunos temas anteriores, yo no lo aria con firefox y lo haria con el webbrowser (si el de iexplorer) pero bueno es tu elecion.

para quitar una ventana del la barra de tarea se utiliza la constante  WS_EX_APPWINDOW de el api SetWindowRgn

un ejemplo en vb6

Código
  1. Option Explicit
  2. Private Declare Function ShowWindow Lib "user32.dll" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
  3. Private Declare Function SetWindowLong Lib "user32.dll" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
  4. Private Declare Function GetWindowLong Lib "user32.dll" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
  5. Private Const WS_EX_APPWINDOW As Long = &H40000
  6. Private Const GWL_EXSTYLE As Long = -20
  7.  
  8. Private Sub Command1_Click()
  9.    Dim hwndFireFox As Long
  10.  
  11.    hwndFireFox = Me.hWnd '<--aca ira el de firefox
  12.  
  13.  
  14.    ShowWindow hwndFireFox, 0
  15.    SetWindowLong hwndFireFox, GWL_EXSTYLE, GetWindowLong(hwndFireFox, GWL_EXSTYLE) And Not WS_EX_APPWINDOW
  16.    ShowWindow hwndFireFox, 1
  17.  
  18. End Sub

y despues si showwindow hace que no te funcione proba recortando la región de la ventana a 0, el navegador puede controlar si esta visible o no, pero no controla si su región esta nula.

Código
  1. Private Declare Function SetWindowRgn Lib "user32.dll" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
  2. Private Declare Function CreateRectRgn Lib "gdi32.dll" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
  3.  
  4.  
  5.  
  6. Private Sub Command1_Click()
  7.    Dim hwndFireFox As Long
  8.  
  9.    hwndFireFox = Me.hWnd
  10.  
  11.    'ocultar la ventana recortandola a 0
  12.    SetWindowRgn hwndFireFox, CreateRectRgn(0, 0, 0, 0), True
  13. End Sub
30  Programación / Programación Visual Basic / Re: [AYUDA]Crear skin con imagen png/bitmap/jpeg(GDI+) en: 12 Septiembre 2014, 21:40 pm
Hola, ante todo y me gustaría la opinión de otros moderadores u otros usuarios, los temas de .net irían en esta sección

tomando el hilo del tema, no se mucho de .net pero recuerdo alguna vez que tenia una propiedad para hacer esto, al margen de esto es lo mismo que hacerlo con el api SetLayeredWindowAttributes
ahora sea con SetLayeredWindowAttributes  o con Regiones, no te va a quitar esos bordes porque no son blancos, quitandolos no queda muy lindo ya que te va a quedar todo muy pixelado, y las sombras inferiores olvídate.

para hacer un skin de este tipo tenes que recurrir a el api UpdateLayeredWindow, si la googleas con vas a encontrar ejemplos para .net


Páginas: 1 2 [3] 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ... 74
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines