Solved

Send Mouse Click to DirectX app

Posted on 2003-11-07
5
358 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

707 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

18 Experts available now in Live!

Get 1:1 Help Now