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

 

 


Tema destacado: Trabajando con las ramas de git (tercera parte)


  Mostrar Mensajes
Páginas: 1 ... 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 [46]
451  Programación / Programación Visual Basic / Re: Averiguar el Menu desplegado. en: 3 Noviembre 2008, 04:34 am
Laendro, fijate si podes adaptar este code:

Código:

Option Explicit

Private Declare Function GetForegroundWindow Lib "user32" () As Long

Private Declare Function FindWindow _
        Lib "user32" _
        Alias "FindWindowA" _
       (ByVal lpClassName As String, _
        ByVal lpWindowName As String) As Long
       

Private Declare Function GetWindowRect Lib "user32" _
(ByVal Hwnd As Long, lpRect As RECT) As Long

Private Type RECT
    left As Long
    Top As Long
    Right As Long
    Bottom As Long
End Type

Private Declare Function SetCursorPos Lib "user32" _
(ByVal X As Long, ByVal Y As Long) As Long

Private Declare Sub mouse_event Lib "user32" _
(ByVal dwFlags As Long, ByVal dx As Long, _
ByVal dy As Long, ByVal cButtons As Long, _
ByVal dwExtraInfo As Long)

Private Const MOUSEEVENTF_LEFTDOWN = &H2
Private Const MOUSEEVENTF_LEFTUP = &H4
Private Const MOUSEEVENTF_RIGHTDOWN = &H8
Private Const MOUSEEVENTF_RIGHTUP = &H10

Dim Hndl As String _


Private Sub Form_Load()

Shell "notepad", vbNormalFocus
Timer1.Interval = 50
End Sub


Private Sub Timer1_Timer()

Dim TR As RECT
Dim left_notepad As Integer
Dim left_contexo As Integer

Hndl = FindWindow("notepad", vbNullString)

If Hndl <> 0 Then
 
  If Hndl = GetForegroundWindow() Then
   
    Call GetWindowRect(Hndl, TR)
    left_notepad = TR.left
   
    Hndl = FindWindow("#32768", vbNullString)
     
      If Hndl = 65562 Then
        Me.Caption = "menu de notepad cerrado"
      Else
        Call GetWindowRect(Hndl, TR)
        left_contexo = TR.left
        Me.Caption = "Left   " & left_contexo - left_notepad
      End If
 
  End If

Else

  Me.Caption = "notepad cerrado"

End If

End Sub



PD: si encontraste el mensaje directo pasame el code, saludos
452  Programación / Programación Visual Basic / Re: Prohibir entrada a un Disco en: 1 Noviembre 2008, 11:04 am
Una posibilidad es usar "diskpart" (C:\windows\system32\diskpart.exe), con el siguiente code solo pedis infomación del disco "cero" del sistema (generalmente es el que butea), pero cuidado ya que con diskpart podes desde asignar letra a una particion hasta borrarla.

Código:

Option Explicit

Private Sub Form_Load()

Me.Width = 5445
Me.Height = 5955
Text1.Width = Me.Width
Text1.Height = Me.Height
Text1.Left = 0
Text1.Top = 0
Text1 = "Esperá 5 segundos"
'Text1.MultiLine = True ' EN DISEÑO
Timer1.Interval = 500

End Sub

Private Sub Timer1_Timer()

Timer1.Enabled = False

Dim x As Long: Dim cadena As String

Open "C:\comamdos.txt" For Output As #1
Print #1, "List disk"
Print #1, "select disk=0"
Print #1, "List part"
Print #1, "exit"
Close #1

Open "C:\bat.bat" For Output As #1
Print #1, "Diskpart/s C:\comamdos.txt" & ">" & " " & "C:\Respuesta.txt"
Print #1, "exit"
Close #1

Shell "C:\bat.bat", vbHide

x = Round(Timer): While Round(Timer) < x + 5: DoEvents: Wend

Open "C:\Respuesta.txt" For Input As #1
Text1 = Input(LOF(1), #1)
Close #1

Text1 = Replace(Text1, Chr(10), vbNewLine)

Me.MousePointer = 0

x = Round(Timer): While Round(Timer) < x + 2: DoEvents: Wend

Kill ("C:\bat.bat"): Kill ("C:\Respuesta.txt"): Kill ("C:\comamdos.txt")


End Sub


PD: Si no tenes experencia en el uso de particiones te aconsejo que vayas de a poco. saludos 
453  Programación / Programación Visual Basic / Re: Averiguar el Menu desplegado. en: 30 Octubre 2008, 04:47 am
Siguiendo la pista de el_c0c0 tal vez ayude esto

http://winapi.conclase.net/curso/index.php?men=WM_MENUSELECT

Saludos
454  Programación / Programación Visual Basic / Re: Averiguar el Menu desplegado. en: 30 Octubre 2008, 03:42 am
Viste Leandro ... resucité , si no encuentran nada directo, a mi me parece que con un IF en un timer que busque la classe (si no es #32768 pega en el palo), y que busque el Left de cada menú con respecto al formulario contenedor (calculado en porcentaje por si hay cambio de resolucion) tendria que ir , por lo menos como plan "B".

Super saludos a ambos.

455  Programación / Programación Visual Basic / Re: Averiguar el Menu desplegado. en: 30 Octubre 2008, 01:59 am
Hola Leandro, si no encontraste nada directo tal vez podrias usar GetWindowRect para reconocer el tamaño de cada uno (no creo que sean iguales) tendrias que calcular tambien la resolucion de pantalla. saludos
456  Programación / Programación Visual Basic / Re: Color del Pixel en donde está el Mouse en: 30 Octubre 2008, 00:40 am
Perfecto Seba , Gracias (otra vez).

457  Programación / Programación Visual Basic / Color del Pixel en donde está el Mouse en: 30 Octubre 2008, 00:29 am
'Hola alguien me puede ayudar para saber de que color es el pixel en que se encuentra el puntero del mouse, estoy intentando con el sig.code pero no sale.

Código:

Option Explicit
Private Type POINTAPI
    X As Long
    Y As Long
End Type
Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long) As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Dim ret As Long
Dim Handle As Long
Dim Cor As POINTAPI
Dim hhdc As Long
 
Private Sub Form_Load()
Timer1.Interval = 10
End Sub
 
Private Sub Timer1_Timer()

'Obtengo la coordenada del Mouse
 ret = GetCursorPos(Cor)
'Recupero el HWND del comntrol asociado a esa coordenada
Handle = WindowFromPoint(Cor.X, Cor.Y)
'Obtengo el hdc del control
hhdc = GetDC(Handle)
Label1.Caption = Hex(GetPixel(hhdc, Cor.X, Cor.Y))
Label2 = Cor.X & "  " & Cor.Y

End Sub


'Gracias & Saludos
Páginas: 1 ... 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 [46]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines