Solved

Send Mouse Click to DirectX app

Posted on 2003-11-07
5
362 Views
Last Modified: 2008-01-09
Im trying to send a mouse click to a certain area in a directx game. Generating a mouse click in any other app (not DX) works fine with this code:

 Call PostMessage(CLng(param(1)), WM_LBUTTONDOWN, 1, CLng(param(2)) + CLng(param(3)) * &H10000)
            Call PostMessage(CLng(param(1)), WM_LBUTTONUP, 1, CLng(param(2)) + CLng(param(3)) * &H10000)

I even used Spy++ and the MouseClicks do not register. MouseMove and KeyPress all come through, but mouse clicks dont.

Any idea how i can generate a mouseclick on a DX app. thx
0
Comment
Question by:GoldStone32767
5 Comments
 
LVL 2

Expert Comment

by:MaxPol
ID: 9702974
The issue is how the mouse click event is handled by the DX application.
If it is via the DIRECTINPUT device, that the event will not be got and thus handled.

Bye,

Max
0
 
LVL 1

Expert Comment

by:fsaims
ID: 9707230
Public objDX As New DirectX8
Public objDI As DirectInput8
Set objDIDev = objDI.CreateDevice("guid_SysMouse")
Call objDIDev.SetCommonDataFormat(DIFORMAT_MOUSE)
Call objDIDev.SetCooperativeLevel(frmCanvas.hwnd, _
        DISCL_FOREGROUND Or DISCL_EXCLUSIVE)
You need DIRECTINPUT Class Functions to handle mouse events in your game.
0
 

Accepted Solution

by:
amp072397 earned 0 total points
ID: 10528606
PAQed - no points refunded (of 125)

amp
Community Support Moderator amp~at~experts-exchange.com
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now