Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mouse position X problem

Status
Not open for further replies.

eatwork

Technical User
May 16, 2005
155
CA
Hello everyone,
I was wondering if anyone knows how to convert a variable of type single to a single or long that is equivalent in pixels?
THE PROBLEM:
Code:
Declare Sub GetCursorPos Lib "user32" (lpPoint As typPOINTAPI)

Type typPOINTAPI
    X As Single
    Y As Single
End Type
This code returns a number, but it is not I need the value to be in pixels.
eg. typPOINTAPI returns 545 = 20,000 or something.

Any ideas? thank you
 
Hi everyone,
The problem I have is that I have 4 numbers,
1)x position of the mouse when clicked eg.873
2)track postion of the horiz. scroll bar eg. between 1 & 15
3)width of listbox - 14579
4)width of all columns in listbox - 18400
5)number of columns in listbox - 15

The problem I am having is I can't seem to figure out how to calculate what the x position of the mouse when clicked in the listbox, when scrolled and not scrolled.

I thought that ((18400 / 15) * (scinfo.nTrackPos + 1)) would work, but it doesn't take into account where the mouse was clicked.

Any ideas? thank you
 
Hi I forgot to add that the position of the mouse in the list box ranges from 0 to 970, and it doesn't match up with the 14579 width of the listbox. Thank you
 
Okay everyone, I have been able to return the TWIPS.
I now have:
1)x position of the mouse when clicked eg. 8000 - 255
2)track postion of the horiz. scroll bar eg. between 1 & 15
3)width of listbox - 14579
4)width of all columns set in listbox - 18400
5)number of columns in listbox - 15

I don't know how to use the horizontal scroll bar position to calulate an X position when the user has moved the scroll bar.
Any ideas? thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top