Thread: C++ - How to 'fprintf' a right mouse click

  1. #1
    Registered User
    Join Date
    May 2015
    Posts
    56

    C++ - How to 'fprintf' a right mouse click

    Hello,

    If I right click the mouse and type 'circle'/return then '10,10'/return then '15'/return,
    the program does what is ecpected.

    I'm running this code from a menu click and would like to send the data to the screen.
    I'm not sure that 'fprintf' is the right call.

    Any suggestions will be greatly appreciated.
    If possible the code to run on Windows, Linux and Mac OS X (re-compiled).

    Regards
    Code:
        fprintf(stdout, right mouse click);
        fprintf(stdout, "%s\n", "circle");
        fprintf(stdout, "%d%s%d\n", 10, ",", 10);
        fprintf(stdout, "%d\n", 15);
        fflush(stdout);

  2. #2
    Registered User
    Join Date
    Jun 2017
    Posts
    156
    If you use C++ you better use the streams not the old C files.
    Basic Input/Output - C++ Tutorials

  3. #3
    Registered User
    Join Date
    May 2015
    Posts
    56
    Hello.

    Quote Originally Posted by OldGuy2 View Post
    If you use C++ you better use the streams not the old C files.
    Basic Input/Output - C++ Tutorials
    Thanks.
    I still need to 'cout' right mouse click.

    Regards
    Code:
    cout << right mouse click;
    cout << "circle\n";
    cout << "10,10\n";
    cout << "15\n";

  4. #4
    Banned
    Join Date
    Aug 2017
    Posts
    861
    that is like key codes or an event. on mouse click it depends on the OS to get the 'signal' output
    like
    Code:
     onEvent(event ev)
    if (ev == MouseDnLeftBn)
    do something
    they got down and up events
    windows
    Responding to Mouse Clicks (Windows)

    Linux
    Xlib Programming Manual: Event Types

    Mac
    Handling Mouse Events
    Last edited by userxbw; 10-09-2017 at 04:19 PM.

  5. #5
    Registered User
    Join Date
    May 2015
    Posts
    56
    Hello userxbw,

    I don't think its an OS problem.
    on mouse click it depends on the OS to get the 'signal' output
    When the program is running, it knows what to do with mouse cliick events and the keyboard.
    What I want to do is on a menu item click, send the mouse right click and some other data to the screen, the program is waiting to pick up the mouse/keystrokes.
    When the program is running, it picks up the mose events and key strokes.
    Your links show how to capture mouse events, not useful.
    My question is how to send a right mouse click.

    Regards
    Last edited by mad-hatter; 10-10-2017 at 04:00 AM. Reason: spelling

  6. #6
    Banned
    Join Date
    Aug 2017
    Posts
    861
    Quote Originally Posted by mad-hatter View Post
    Hello userxbw,

    I don't think its an OS problem.
    When the program is running, it knows what to do with mouse click events and the keyboard.

    What I want to do is on a menu item click, send the mouse right click and some other data to the screen,

    the program is waiting to pick up the mouse/keystrokes.
    When the program is running, it picks up the mouse events and key strokes.

    Your links show how to capture mouse events, not useful.
    My question is how to send a right mouse click.

    Regards
    I was referring to OS depended due to the names they give the events,
    in order to use then to figure out which event took place.

    menu item click, send the mouse right click and some other data to the screen
    you cannot send an event to a screen, only a touch screen can get an event off the screen. but not send it to the screen. That'd probably have to give someone a electrical shock in order to do that.

    thinking... you're trying to just print out what the code number is for a right mouse click event ,

    or are you trying to cause a right mouse click event to take place off of a menuClick then send some kind of confirm message that it took place then the rest of the data to output to a screen?

    How to: Simulate Mouse and Keyboard Events in Code | Microsoft Docs

  7. #7
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    What exactly is it that you're trying to accomplish? Maybe someone here can suggest a better way.
    What can this strange device be?
    When I touch it, it gives forth a sound
    It's got wires that vibrate and give music
    What can this thing be that I found?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. X lib Mouse Click Error
    By lautarox in forum C Programming
    Replies: 8
    Last Post: 12-08-2008, 12:00 PM
  2. Using mouse click
    By kakashi in forum C++ Programming
    Replies: 10
    Last Post: 01-31-2006, 01:38 AM
  3. Hold Mouse Click
    By zach0616 in forum C++ Programming
    Replies: 3
    Last Post: 07-06-2005, 08:13 PM
  4. Making a Mouse Click
    By r0ss in forum C Programming
    Replies: 1
    Last Post: 06-03-2004, 08:55 PM

Tags for this Thread