|
-
Jun 3rd, 2002, 07:33 PM
#1
Thread Starter
Lively Member
Creating new objects via code
How do you create objects (I want shapes) from code?(while running, that is. Not by putting it in a form)
Also another question - Whats the equivalent of GetKeyState for mouse clicking? I need to get the X and Y coords of the pointer whenever I click. This would work with MouseDown event, but I'm using it in a loop.
Last edited by Drakon; Jun 3rd, 2002 at 07:39 PM.
Do you know if you will answer no to this question?
If we've never seen something happen, we can't know if its impossible.
If the soles of a shoe make faces at the floor when we don't look and isn't being watched via mirror or video tape, will we ever know?
If someone orders you to disobey all of their orders, do you obey or disobey?
-
Jun 4th, 2002, 08:21 AM
#2
Frenzied Member
You could probably use a hook for proper mouse clicks, but you can just use these consts with the GetKeyState API:
VB Code:
VK_LBUTTON = &H1
VK_RBUTTON = &H2
VK_CANCEL = &H3
VK_MBUTTON = &H4 ' NOT contiguous with L RBUTTON
And you can use this for the Cursor Pos:
VB Code:
Private Type POINTAPI
x As Long
y As Long
End Type
Private Declare Function GetCursorPos Lib "user32" Alias "GetCursorPos" (lpPoint As POINTAPI) As Long
'Holds the cursor co-ordinates
Dim CursorPosition As POINTAPI
'Get the co-ords
Call GetCursorPos(CursorPosition)
MsgBox CursorPosition.x & ":" & CursorPosition.y
-
Jun 4th, 2002, 06:09 PM
#3
Thread Starter
Lively Member
Thanks, they both work. However, I have two problems.
When I click at the right side of my screen on my form, which is 12000 twips wide, ... Hehe... it suddenly struck me as I write. I fixed that one...
Now, problem 2. When I click a mouse button, the computer thinks I'm still clicking it until it clicks again. I have a block that moves to the pointer (not instantly, it "walks") when I click. But if I move the pointer around, it continues to follow the pointer. I want it to just walk where I clicked, then wait for me to click again. How do I fix that?
Do you know if you will answer no to this question?
If we've never seen something happen, we can't know if its impossible.
If the soles of a shoe make faces at the floor when we don't look and isn't being watched via mirror or video tape, will we ever know?
If someone orders you to disobey all of their orders, do you obey or disobey?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|