Menú

Mostrar Mensajes

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ú

Mensajes - Dessa

#221
Algo asì ? (no se si te va a servir en tu caso)



Option Explicit

Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Const WM_ENTER = &HD: Private Const WM_CHAR = &H102

Public Sub Clicar(lHwnd As Long, x As Long, y As Long)
 Dim Rst As Long: Dim Prm As Long
 Prm = y + x
 Rst = PostMessage(lHwnd, WM_CHAR, vbKeySpace, ByVal Prm)
End Sub

Private Sub Command1_Click()
 Call Clicar(Text1.hwnd, 1, 1)
End Sub
Private Sub Command2_Click()
 Call Clicar(Text1.hwnd, 1, 10)
End Sub

Private Sub Form_Load()
Text1 = "X"
End Sub



S2

EDIT: para el tabulador seria vbKeyTab en lugar de vbKeySpace

#222
Tambien probá si te sirve esta otra opcion:

las coordenadas que quieras en lugar de 1,1



Option Explicit

Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Const WM_LBUTTONDOWN = &H201: Const WM_LBUTTONUP = &H202

Public Sub Clicar(lHwnd As Long, x As Long, y As Long)

Dim Rst As Long
Dim Prm As Long

Prm = y + x
Rst = PostMessage(lHwnd, WM_LBUTTONDOWN, 0&, ByVal Prm)
Rst = PostMessage(lHwnd, WM_LBUTTONUP, 0&, ByVal Prm)

End Sub


Private Sub Command1_Click()

Call Clicar(WebBrowser1.hwnd, 1, 1)

End Sub



S2
#223
Dejo un ejemplo simple del uso de SendMessage + WM_GETTEXT para el que le sirva.

Nota: no hace falta usar un timer es solo para facilitar el concepto



Option Explicit

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Long, ByVal Msg As Long, wParam As Any, lParam As Any) As Long
Private Const WM_GETTEXT = &HD: Private Const WM_SETTEXT = &HC

Private Sub Form_Load()
  Timer1.Interval = 16
  Me.AutoRedraw = True
  Shell "calc"
End Sub

Private Sub Timer1_Timer()
  Dim Hwndl As Long
  Hwndl = FindWindow("SciCalc", vbNullString)
  Hwndl = FindWindowEx(Hwndl, 0, "Edit", vbNullString)

  Dim recibir As String: recibir = Space$(34)
  Call SendMessage(Hwndl, WM_GETTEXT, ByVal 34, ByVal recibir)

  Me.Cls
  'Me.Print recibir
  Me.Print Replace(recibir, vbNullChar, "")
End Sub



S2
#224
SendMessage con sETTEXT para enviar y SendMessage con GETTEXT para recibir.

http://foro.elhacker.net/programacion_vb/pasar_variables_por_memoria_src-t244803.0.html

S2
#225
Algo así ?



Option Explicit

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function IsIconic Lib "user32" (ByVal hwnd As Long) As Long
Const SW_NORMAL = 1



Private Sub Form_Load()

Me.Caption = "INSTANCIA 1"

If App.PrevInstance Then
Me.Caption = "INSTANCIA 2"
MsgBox "NO", , Me.Caption

If IsIconic(FindWindow(vbNullString, "INSTANCIA 1")) = 0 Then
    MsgBox "no esta minimizado"
    Call SetForegroundWindow(FindWindow(vbNullString, "INSTANCIA 1"))
Else
    MsgBox "esta minimizado"
    Call ShowWindow(FindWindow(vbNullString, "INSTANCIA 1"), SW_NORMAL)
    Call SetForegroundWindow(FindWindow(vbNullString, "INSTANCIA 1"))
End If
End
End If


End Sub




S2

#226
En cuanto pongas la propiedad del formulario BorderStyle en "0" (cero) no te aparece mas el mensaje

En diseño (antes de ejecutar el code)

S2

#227


Option Explicit

Private 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

Private Sub Form_Load()

  Call SetWindowPos(Me.hwnd, -1, 0, 0, 0, 0, &H2 Or &H1)

' todas estas propiedades en diseño
If Me.BorderStyle <> 0 Then MsgBox "FORM SIN BORDES EN DISEÑO": End
Command1.Left = 0
Command1.Top = 0
Me.Height = Command1.Height
Me.Width = Command1.Width

End Sub


Private Sub Command1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)

If Button = 1 Then
MsgBox "CODIGO"
End If
If Button = 2 Then
End
End If

End Sub



S2
#228
Yo para dos strings uso el "+" porque tengo la tecla mas cerca ...
#229
 ;)

#230
 FileName = App.Path + "\imagen.bmp"


S2