Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Send Mouse Click to DirectX app

Posted on 2003-11-07
5
Medium Priority
?
395 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

926 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