Inject OnClick Event into running EXE - forms

Is it possible with some program to to send an OnClick Event eg: MenuNewClick (File New) or others.
I have an application that has no Keyboard shortcuts.
When I use a Resource Editor I can see the Delphi Forms for each OnClick Event I need.
I would just like to be able to send these OnClick Events with Keyboard Shortcuts into the running exe.
Have used apps like Darker's Enabler, EDA Preview that allow you to modify the layout of a running exe.
Possible ?
Even this forum has options "Keyboard shortcuts
Enable keyboard shortcuts (when enabled, press ? for help)"
Thanks.

If the application is indeed made with Delphi and if it uses default TMainMenu component you could modify the RCData in which the .dfm is stored (this data alows you to view the form and its properties with programs like PE Exporer and similar) in a way that you change the AutoHotkeys property of TMainMenu to maAutomatic and then change ShortCut property of each menu item to contain proper keyboard shortcut.
If you have access to Delphi I recomend you first make an example application which will have all available shourctuts implemented so you could comparison the RCData between these two applications and made necessary changes.
NOTE: What I'm suggesting will require editing the EXE resource data so make sure you are working on a copy of the exe and not on the real one so you don't break your application.

Related

How to create a modal for a VSCode extension?

I'm trying to make an extension for VSCode to Find text in File (Like in Notepad++).
Is there an API for using a modal in a VSCode extension? or at least extend the Command Palette?
VS Code (1.34) has no concept modal UI. Extensions can only show basic dialog messages modally using the showMessage apis.
Messages can show message text and a set of buttons. By default VS Code will render messages in its UI. The MessageOptions.modal option makes VS Code render the message using system UI instead.
Try positing a more specific question about what you are trying to accomplish. VS Code's extension model is different from other editors, so if you are trying to replicate functionality from another editor like Notepad++ you may need to rethink the user experience.
I believe what you are looking for is an input box. It will show a UI where you can input text. From there you can grab the text of a document and parse it for entered text. For completeness, VS Code does this with ctrl + f or cmd + f depending on OS. Add the shift key to search the whole project.
As mentioned above there are the limited built-in inputs and message box (which can also be used to display choice buttons).
You can also have a look at WebView these can be used to display a side-bar view (like the EXPLORER) or a full document. They are made up from HTML and plain old JavaScript. You will have to pass simple string messages between your HTML/JS view and vscode itself.
https://code.visualstudio.com/api/extension-guides/webview
https://github.com/Microsoft/vscode-extension-samples/tree/main/tree-view-sample
A large 'document' view example vscode extension is call 'nearest-icons'
https://github.com/noGreg/nearest-icons

External/USB controller integrated with Eclipse

I own an APC MINI USB/MIDI button pad and have been trying to get windows to more or less recognize it as a operating-system-wide input device. My primary use case is to trigger macros or shortcuts in Eclipse.
For example, instead of the current keybinding of ALT+] to clone a window I could press [btn_1] on the external controller to trigger the action. Another example is I could move the slider up and down changing the zoom on my text.
Ideally I'll be able to fire off any macro or shortcut just by pressing a button on the USB pad. If I could get it working at the OS level, I could see having a row of buttons start or focus frequently used applications. For example be able to open FireFox or press a button to navigate a tab to StackOverflow.com.
I supposed I COULD slap together a quick jar with a Midi library, listen for input from the device and map the "notes" (button presses) to a key combination/shortcut but I feel like there has got to be a way to have windows treat the pad as an input device just like a mouse or keyboard. Been all over the internet looking for solutions but most use cases deal with software engineered to handle midi input. Not afraid to write .bat files to cooperate with windows but still need some way to link the buttons on my board to said .bat files.
Any ideas or suggestions would be greatly appreciated!

Delphi TPopupMenu ShortCut Property in MDI application

I have a TPopupMenu with several buttons I would like to be activated via shortcuts. I have assigned them various shortcuts using the ShortCut property of the TPopupMenu class but they do not trigger the associated event when I use them. I seem to remember reading once that this functionality does not work for MDI applications - is this the case and, if so, what is the best way to overcome it?

Using IAction::setAccelerator does not work as expected

I face an issue regarding keyboard shortcuts using JFace IAction and setAccelerator(). My sample code:
menuAction.setAccelerator(SWT.CTRL | 'A');
The keyboard shortcut CtrlL+A is not recognised within my application.
To my knowledge, the accelerator property of an IAction only carries the information which key shortcut should be used.
The actual implementation that captures key shortcuts and executes matching actions is not part of JFace or at least not active by default. Some bits and pieces that are part of Platform/UI make it work in the workbench.
To see what is actually needed to make accelerators work in a standalone JFace application, you should follow the call to ExternalActionManager.ICallback::isAcceleratorInUse() in ActionContributionItem ~ line 825.
If this doesn't lead to a solution, you can still add a display filter to invoke the respective actions for a key shortcut (see also SWT Actions with Keyboard Shortcuts... without having to add them to the menu).
Don't forget to add this action menuAction to your menu manager and after applying all you stuffs you must to update the menu manager. Call updateAll(true) method on your menu manager. This update is required because the menu manager didn't notice your accelerator assignment yet!

How to ID a control with Windows Spy?

Newby here...I have my first script running...yeah! But I'd like to read some window controls. I see in the AHK Help for GetControlPos and others:
Can be either ClassNN (the classname and instance number of the control) or the name/text of the control, both of which can be determined via Window Spy.
Duh, I can't find the info in Windows Spy. Can someone point me in the right direction...TIA.
You have to hover over the controls with you mouse. In the "Under mouse" section you will see what can be gathered from the application. In quite a few situations, you will not see more that the colour under the mouse. When the application has named controls, you will then see the ClassNN name/ID.
In short, not all programs have named controls.
You can test with e.g. Notepad and in Notepad use file save. The file save dialog has named controls.