View Single Post
Old Mar 16th, 2007, 9:00 PM   #1
bigguy
Professional Programmer
 
bigguy's Avatar
 
Join Date: Sep 2005
Location: Arkansas
Posts: 298
Rep Power: 0 bigguy is an unknown quantity at this point
Send a message via AIM to bigguy Send a message via MSN to bigguy Send a message via Yahoo to bigguy
Little help with ListView Boxes

Hey yall. In my newer version of download blocker, I decided to add a Personal Block Settings option, for users to add their own custom programs to block. What I have is this, I have all the open windows in a listview box. Then I would like to it to where when I select the items in the listviewbox, it will tell their classname and iwndow title in textboxes. here is the code I am using

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Dim whPoint = WindowFromPoint(Cursor.Position.X, Cursor.Position.Y)

        GetClassName(whPoint, clsName, Len(clsName))
        GetWindowText(whPoint, wText, Len(wText))

        txtclass.Text = clsName 'GetClassName(whPoint, clsName, 0)
        txtapptext.Text = wText
    End Sub

The
Dim whPoint = WindowFromPoint(Cursor.Position.X, Cursor.Position.Y)
is what gets the windowclass name and window title, but with that. I have to move my mouse over the window I want blocked. I want it to be able where I just select the item out of the listbox and it get all the info, and display it in my txtboxes. But I have tried
Dim whPoint = Listview1.selecteditems
, and a couple more, but I always get a InvalidCastException at:
GetClassName(whPoint, clsName, Len(clsName))

So please help
__________________
Forgiveness is the fragrance that the violet sheds on the heal that has crushed it. - Mark Twain

Destruction leads to a very rough road, but it also breeds creation.
bigguy is offline   Reply With Quote