Adding GUI controls to external program - external

is it possible to add buttons or menu items to external programs? For instance, adding an menu item into notepad itself which will show a messagebox (after clicking on it) with the current text within notepad. if yes, is there a url which gives some more details about it?
looking forward to your answers.

It's possible by creating the control (via the Windows API or whatever) and then assigning your target window's HWND as the new control's parent. For reference, check the SetParent Win32 API function on MSDN.
Not sure how well this will work with a menu, but that's the normal way to add a control to a window. Be careful, though. There are lots of gotchas (commands taken by the target application, memory considerations, etc).

Related

Why is Sublime Text context menu disabled (image below)

I have installed HTML-CSS-JS Prettify package in Sublime Text 3 (on Ubuntu 18.4).
The image below shows that it appears on the context menu. However, when I select its context menu (the second context menu) has all options greyed out. I can't find a explanation anywhere and would appreciate knowing how to enable it.
If it is any use the "Anaconda" selection is also all greyed out when I select it. Nodejs is not.
Many thanks.
Menu items appear disabled for a couple of different reasons.
The first (and most common) is that when a menu is about to be displayed, Sublime asks every command bound to an item available in the menu if it should be enabled right now or not, and the command can decide to disable itself if it currently doesn't apply.
The second reason is that the command bound to the menu item is currently missing. For people using packages and not creating them themselves, that generally means that there's something wrong with the plugin that provides the command, such as it not loading for some reason.
In this case, based on the items in there it seems more likely that the second case is what's getting you here.
In order to check that, use View > Show Console or the associated key binding and see if there are any messages that look like a package didn't load for some reason. If so, resolving whatever issue that is should get things working.

configure right click mouse for code comments in phpstorm?

Is it possible to configure comments code directly when right click mouse? For example, I select some code, then right click, then I can choose html comment, php comment, multiline comment.
No, it's not possible. But you can add your feature request on JetBrains tracker: http://youtrack.jetbrains.com/issues/WI#newissue=yes
Yes, all menus in PhpStorm are fully customisable.
Open Settings|Menus and Toolbars, then expand Editor popup menu, select any suitable existing element and use Add After to add one of Main Menu|Code|Comment ... actions.
This will make them appear in "right click menu" within editors. Action may be disabled depending on whether it is defined for the language at caret position.
Note, that built-in actions will automatically choose comment style depending on context.
If your intent is to specifically surround the selection with i.e. html comment you'll need to take additional steps - create a custom template for Surround with action, recording a Macro that invokes it on selection and adding that macro to the menu as described above.

Execute button inside a ribbon

I want to write a script (C# or AutoIT or VBScript.. whatever works) which should
Get reference of already open outlook application
Iterate through ribbons to find a specific button
Execute that button click
How can I do it?
Use AutomationPeers.
Here is the MSDN article with lots of details:
http://msdn.microsoft.com/en-us/library/ms752331.aspx
Add references to:
UIAutomationClient
UIAutomationClientsideProviders
UIAutomationProvider
UIAutomationTypes
And here is a little C# code snippet of how to get the AutomationId of what currently has focus:
var id = AutomationElement.FocusedElement.Current.AutomationId;
this.txt.Text = id;
You can navigate the entire tree of a window and drive the entire UI using automation peers. This is how accessibility applications interact with applications in Windows. This is also one way that automated UI testing applications do it as well.

Creating Chrome popup with a C++ program

Problem context:
I have a C++ program and a web presence. Currently the way things are working I have made a control panel with javascript and html. And it send commands via an unimportant communication medium to control things or get information from the C++ program.
Now, when the C++ program launches, I'm making it run a
ShellExecute(NULL, "open", addressBuffer," --new-window", NULL, SW_NORMAL);
This is a way of launching the default browser with the given address. The addressBuffer in this case points to an intermediate HTML file that quickly turns around and uses the
window.open()
in Javascript to open the final popup, then closes itself.
The result is the user now has the popup control panel that I want them to have but the user's main browser window also gets given focus, un-minimized, and placed on a different tab than the one they had selected. (Basically pops up out of nowhere and selects a another tab)
Problem:
I'm looking for a way to launch a Chrome popup, without disturbing a previously open browser window. Any ideas or solutions would be very helpful.
Lastly, it's worth noting that the " --new-window" from the code above doesn't actually open a new window like you would expect. In this case it's actually doing nothing... If it did work, none of this would really be an issue.
I know this is wordy so thanks in advance for you time!
-Michael
Alright, I came up with a solution.
Something about how ShellExecute processes it's commands was preventing the command line args to be passed in correctly.
My work-around includes grabbing the path to Chrome from the registry,
HKET_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe
Then simply doing a system() command with the chrome path "--new-window" and the web path.
Then I let the intermediate html page open it's popup and close itself.
Tada done.
Thanks.

Block Access mousewheel behavior in external ActiveX controls

In an Access (2002 / 2003) data-bound form, a turn of the mousewheel moves to the next/previous record, even if the cursor is inside a multiline text field or a listbox. This is a major annoyance to users and cannot be turned off easily.
I recently discovered a DLL called MouseHook (http://www.lebans.com/mousewheelonoff.htm) which can effectively block this mousewheel behavior and replace it with more expected behavior.
However, when an external ActiveX control is added to an Access form, this module does nothing. For example, I have a form with a FlexGrid control on it, and it can contain a lot of rows. When a user tries to scroll in there using the mousewheel, Access again simply goes to another record instead, even with MouseHook DLL loaded.
Is there a solution like MouseHook DLL but which also works for external ActiveX controls? Or is the source code of the MouseHook DLL available so it can be modified to deal with controls like FlexGrid?
PS: I wanted to ask the author of MouseHook DLL, but he is currently "on a hiatus" until June 2009.
If you really have to alter the UI and change how the user expects the mouse wheel to work, I would actually recommend just disabling it rather than altering how it scrolls. While it's scrolling may seem odd to you, it is how the program works. What would you do if you had to read PDF's all day, and then one day one person decided that the way the mouse wheel scrolling worked wasn't good enough and changed to so it defaulted to huge jumps or horizontal or whatever. Yes, it may have been a better solution, however it is annoying to the user because it doesn't do what it is supposed to do.
Why are you using a flexgrid in Access? To me, this is a read flag that you likely are approaching the project with an Access-hostile point of view, since you seem to be choosing non-native controls to do things that are almost always much more easily accomplished with Access's native controls.
Hook the flexgrid, intercept the WM_MOUSEWHEEL message, ignore it and call your intended behaviour.
Not a direct answer to your question, but the way we deal with the mouse wheel movement is to prevent accidental changes of records after the user has started editing. When the user opens the form, the wheel moves the records willy-nilly as normal. As soon the user edits something on the field, and then moves the mouse wheel, the BeforeUpdate event fires, which causes our code to put up a prompt saying they must save the record first. We have a save button which the user must explicitly press to supress the warning in the BeforeUpdate event.