Help with API Calls please.........I am at wits end :( 
Author Message
 Help with API Calls please.........I am at wits end :(

Hi, my name is Kumaran

I need to use 2 API calls in my VB App.

1) To get the NT logon name. I am using a SQL Server Database and this
would expedite a lot if I could get the NT Logon Name.

2) I am using a Treeview Control, I have used popup menus on right clicks
on certain nodes and items, the problem I have is that the Right Mouse
Click does not shift the Focus Rectangle or change the SelectedItem as the
Left Mouse Button does, meaning I have to LEft-Click first then
Right-CLick. Please help me with this one. I am assuming it is an API call,
I might be wrong though

Thanking you


           |
        \__/



Mon, 24 May 1999 03:00:00 GMT  
 Help with API Calls please.........I am at wits end :(

There are a couple of things that you can do here without API's. Since
you HAVE the x and y coordinates of the click as I assume you are
capturing all this in the mouse down event, you can manually set the
SelectedItem property

Set Treeview1.SelectedItem = Treeview1.HitTest(x,y)

If you want the highlight there as well.
Set Treeview1.DropHighlight = Treeview1.SelectedItem

I had to add a LOT of code to this object to 'firm it up'

Also you may get error 91 problems when youe code trys to reference
the Selected Node and no node is selected. I write code that simply
selects the root node in this case. Let me know how you make out

Quote:

>Hi, my name is Kumaran
>I need to use 2 API calls in my VB App.
>1) To get the NT logon name. I am using a SQL Server Database and this
>would expedite a lot if I could get the NT Logon Name.
>2) I am using a Treeview Control, I have used popup menus on right clicks
>on certain nodes and items, the problem I have is that the Right Mouse
>Click does not shift the Focus Rectangle or change the SelectedItem as the
>Left Mouse Button does, meaning I have to LEft-Click first then
>Right-CLick. Please help me with this one. I am assuming it is an API call,
>I might be wrong though
>Thanking you

>       |
>    \__/

A mind which has been expanded by a new idea,
never returns to it's original dimensions.


Mon, 24 May 1999 03:00:00 GMT  
 Help with API Calls please.........I am at wits end :(

Quote:
> the Right Mouse Click does not shift the Focus
> Rectangle or change the SelectedItem as the Left
> Mouse Button does, meaning I have to LEft-Click
> first then Right-CLick. Please help me with this one.
>  I am assuming it is an API call, I might be wrong
> though

I assume you want the right mouse click to act like a left mouse click as
far as selecting an item goes. In VB 3/WIn 3.1 I had a similar job to do
except that I was using a listbox and not a Treeview control. I found
that I could call GetCursorPos and convert to the proper coordinate
system and that would tell me where the mouse had clicked on my form.
Then I found that in a standard VB listbox each item is the same height
as the TextHeight method for the appropriate font. Based on that it
wasn't hard to calculate an offset from the top edge of the listbox and
then add listbox.TopIndex to find which item had been clicked on. The
most tedious part was converting between coordinate systems. Some
functions return values in pixels relative to the upper left corner of
the desktop, some return twips relative to the upper left corner of the
form and you have to figure out of the width of the form's frame is
included in that number, etc.

Good luck
Phil

Save the Earth -- shoot yourself.
URL O' the Day: http://www.vegweb.com



Tue, 25 May 1999 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. 3rd Post: I am at my Wit's End

2. newbie at wits end - please help simple problem

3. My wits end...help

4. PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP,

5. At wits end - File not found: VBA6.DLL

6. at wit's end with simple file access

7. At my wits end-Out of memory error

8. At wits end..formula execution

9. At Wit's End

10. At my wit's end, WebClass/ADO

11. Font.name vrs fontname (at my wits end)

12. At wits end-out of memory

 

 
Powered by phpBB® Forum Software