Solved

Send Mouse Click to DirectX app

Posted on 2003-11-07
5
378 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
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…

739 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