If Notepad is open (or many other programs, don't need to be pinned) and user shift+clicks its taskbar item, it will open a new window. This behavior doesn't seem to be handled but the Windows Shell so it won't open another instance by default.
I have tried creating a hook MainWindowProc to get all window messages but that is not one of them and I don't know how to detect that event. Is there a way to get it from .NET?
Related
I was wondering if there is a window property, for a wpf application, that disables any actions outside of the window. For example, when you open a message dialog and click outside of it, the message dialog background flashes. Kind of saying you can't do any actions outside of the message dialog untill you click the 'OK' button. I want that implemented in some windows that I open in a program i'm developing but can't seem to find any info on it. Looking for ways on how i might approach this.
Try ShowDialog() instead of Show()
Opens a window and returns only when the newly opened window is closed.
Window childWindow = new Window();
childWindow.ShowDialog();
Note that it will prevent clicks only on parent window(s). Clicks on other applications or Desktop can't be prevented by the Dialog.
I'm working on a program to simultaneously control a handful of other programs of the same type.
So far I use EnumWindows() and collect the handles of the appropriate windows(programs) that I'm going to be controlling. Upon recognizing some keyboard keystroke, I iterate through all of the programs(there could be any number of them open) and I post click messages to all of these programs simultaneously by using EnumChildWindows() to find the appropriate windows(buttons) based on which keystroke was pressed and then using PostMessage() to actually send the click.
Each of these programs that I'm controlling has a button named "Load Settings" which opens an Open file dialog when clicked. What I would like to do is first use PostMessage() to click "Load Settings"(I have successfully gotten this far, what follows is what I'm trying to do). Then I want to get the handle of that Open file dialog window, fill in the text field with the path to the appropriate settings file that I've already determined, then click the "Open" button to finish the task and close the Open window.
My main problem is finding that Open window. Now, I can use EnumWindows once again to find that window but the problem with this is upon clicking "Load Settings" the Open window doesn't open instantaneously. I could sleep after clicking the button, then enum through the windows to find it, but that's not practical as the window could take any amount of time to open.
I've used spy++ to gather some information about this window, but as far as I know, none of it helps enough. Anyways, here is what I have found:
The window "Open" is the Previous Window to the program which it was opened from.
The window "Open"'s parent is the program which it was opened from.
The window "Open"'s owner is the program which it was opened from.
But even though it's listed as a child of the main program under its window properties, it's listed on the same level as the main program (it's not nested like other child windows).
I've tried FindWindowEx() and EnumChildWindows() but neither could find the Open window.
I would think there should be some way to, based on some handle, get the handle of the previous window.
Once that's working, then I need to fill the Edit(text field) window with the appropriate file path.
UIA is what you want, if your goal is to automate UI actions (e.g. for testing). UIA exposes the entire UIA tree which contains all applications active on the machine.
So what you'll see is a root node which has one child node for each application. Each of those nodes should represent the top level window of that application. Any further children depend on the application itself.
See more info at UIA Overview
I'm opening some ie-windows from my c#-client
Is it possible to assign it to an exisiting tabgroup or at least open it as a tab in the already opened ie-window.
Maybe this would work with javascript in the onload of the window?
It has no parent, so is there a possibility to set this value before the window opens?
I use the IE-tab-settings to open new windows always in a tab, but this doesn't work for windows from my client...
I want to create a gadget. when opening windows they appear on the shell tray as:
how can I prevent a window from showing on that tray. I already know how to send a window to the back to make it appear as a gadget. I found that example in here. It will be nice if that menu does not show up meanwhile the window is active and open.
Use the Window property ShowInTaskbar to restrict or allow your Window to appear in the taskbar.
We have a C# application which contains both modal and non-modal windows. It is possible for a user to have several non-modal windows open and open a modal window from one of these.
If the user switches to another application and then switches back to ours by clicking one of the non-modal windows (other than the one which opened the modal window) in the Task Bar, the non-modal window becomes activated but does not accept input because the modal window is open, but is behind other windows.
How can we ensure that no matter which of our windows the user switches back to, the one which is modal is the one which is actually activated? This is the behaviour exhibited by Microsoft Outlook, for example.
Any assistance would be appreciated.
Its certainly possible, but is really annoying to maintain. I regularly work on an application which mixes modal and non-modal windows. This is my strategy (which isn't 100% full-proof)
Set the modal windows TOPMOST when
possible.
When certain actions are
detected (like pressing windows-d button),
you have to manually set the window
back to topmost. I dont know why the windows go to the back, but the behavior is not consistent between windows XP, vista, 2003, etc.
Its really annoying maintaining the code that rearranges the windows. I would urge you to try to not mix modal and non-modal windows.
Edit
I forgot to mention that i use WTL and alot of native win32 functions. I also try to create windows which have parent / child relationship so that keyboard and mouse messages get REFLECTED as much as possible to the child windows.