Log in to reply
 

C# Can I simulate a keypress?



  • I went from 1 menu in LemonUI to 2. One for my cars, one for my peds and locations. Cars are bound to F6. Peds to F7. I went to 2 menus because of the thousands of lines of codes and multiple .cs files I had (I like to keep things organized using many .cs files rather than one with 50,000 LOC.

    I'd like to be able to call one menu from the other by selecting the proper item. I don't know how this can be done with lemon so I was thinking of this:

    menu.Visible=false;
    SendKeys.Send("{F6}");

    I tried just with the SendKeys and it compiles but I get a runtime error (exception handler as usual).

    Sure I could do this by just using the F key binding but I sometimes call up the wrong menu, or I select from one menu and would then like to get the next menu without closing the menu and then doing a keypress.

    UPDATE: for a class project you need SendKeys.SendWait("{F6}");



  • Make the second menu public static then do SecondMenu.menu.Visible = true replacing "SecondMenu" with the class and "menu" with the variable. Or make a public static function called "Open" that sets Visible to true and call that function.



  • @Jitnaught Thanks but I forgot to mention that the menus are in 2 different projects, 2 different compiled dlls. So that approach wouldn't work right?

    The sendkeys.sendwait does the trick however even if it isn't the most elegant solution. But again thanks!




Log in to reply
 

Looks like your connection to GTA5-Mods.com Forums was lost, please wait while we try to reconnect.