Oppure

Loading
20/01/08 20:26
vendicator3
E sono alla 3° spiegazione.

Con la speranza lo rispiego.:rotfl:

1)Allora io voglio sapere quando una finestra CHE NON é LA MIA APPLICAZIONE è selezionata ed il suo titolo, se ha un determinato titolo inviare delle stringhe.

2)Vorrei registrare i tasti premuti anche se la MIA applicazione VB non è selezionata.
Però in Vb 2008, con qualcosa di apposito perchè asynkkey non va per nulla bene col 2008.

Se potete scrivere come poter fare da un applicazione consolle.:D
aaa
21/01/08 14:41
GrG
X la 1 prova questo codice:

Option Explicit

Private Declare Function GetActiveWindow Lib "user32" () As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function GetForegroundWindow Lib "user32" () As Long


Private Sub Timer1_Timer()
Dim foreground_hwnd As Long
Dim txt As String
Dim length As Long

    foreground_hwnd = GetForegroundWindow()

    txt = Space$(1024)
    length = GetWindowText(foreground_hwnd, txt, Len(txt))
    txt = Left$(txt, length)

    lblCaption = txt
End Sub



Questo codice scrive nella labelbox cioè la lblCaption il nome della finestra selezionata.

X l'opzione N°2 invece nn ti posso aiutare xkè qui si parla di visual basic 6.0 non di vb.net 2008
aaa
21/01/08 15:13
P4p3r0g4
per la seconda
msdn2.microsoft.com/en-us/library/…

non l'ho mai provato sul 2008 ma dovrebbe funzionare.
Ultima modifica effettuata da P4p3r0g4 21/01/08 15:14
aaa
21/01/08 17:36
vendicator3
Errore.
Error	1	'Public Property Left() As Integer' has no parameters and its return type cannot be indexed.	C:\Documents and Settings\LORENZO\Documenti\Visual Studio 2008\Projects\avanced_style_v3\avanced_style_v3\Form1.vb	26	15	avanced_style_v3
Error	2	Type character '$' does not match declared data type 'Integer'.	C:\Documents and Settings\LORENZO\Documenti\Visual Studio 2008\Projects\avanced_style_v3\avanced_style_v3\Form1.vb	26	15	avanced_style_v3


Ho dovuto spostare l'explicit in questo modo:
Option Explicit On
Public Class Form1


    Private Declare Function GetActiveWindow Lib "user32" () As Long
    Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
    Private Declare Function GetForegroundWindow Lib "user32" () As Long


Qualche suggerimento per risolvere il problema di left.:-|
Left qui è una proprietà pubblica.
Togliendo la "$" elimino un errore.

Il 2° che mi avete detto non va, mi viene il dubbio: debbo importare qualcosa?
Ultima modifica effettuata da vendicator3 21/01/08 17:40
aaa
21/01/08 19:10
GrG
ma tuhai provato il codice in vb.net 2008??

p.s. se si allora nn ti posso aiutare, io conosco il vb6 nn il vb.net ke è diverso...
aaa
21/01/08 19:45
vendicator3
Microsoft Visual Basic 2008 Express Edition (Registrata)
aaa
21/01/08 19:53
P4p3r0g4
Error	1	'Public Property Left() As Integer' has no parameters and its return type cannot be indexed.	C:\Documents and Settings\LORENZO\Documenti\Visual Studio 2008\Projects\avanced_style_v3\avanced_style_v3\Form1.vb	26	15	avanced_style_v3
Error	2	Type character '$' does not match declared data type 'Integer'.	C:\Documents and Settings\LORENZO\Documenti\Visual Studio 2008\Projects\avanced_style_v3\avanced_style_v3\Form1.vb	26	15	avanced_style_v3


Ho dovuto spostare l'explicit in questo modo:
Option Explicit On
Public Class Form1


    Private Declare Function GetActiveWindow Lib "user32" () As Long
    Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
    Private Declare Function GetForegroundWindow Lib "user32" () As Long

sicuramente si puo` togliere $ a left.
a dire il vero io toglierei $ ad entrambi.
al massimo gli passi un cstring.
getwindowstext da un long.
text e` uno string.
quello che mi lascia perplesso e` il left() as integer che compare nell'errore.
left e` uno string.
non e` che hai una proprieta che gli ci sovrappone?
aaa
22/01/08 14:27
GrG
Qui si parla del vb6 non del 2008
aaa