How to open the Run window programmatically - windows

Everyone knows the Run window that you can open with the shortcut Windows+R or directly in the Windows menu then Run.
I'm wondering how to open this Run window programmatically.
This window seems to be part of explorer.exe.
Does anyone have an idea on it ?

You can use IShellDispatch::FileRun to achieve this.
See Using the Windows RunFile dialog - The documented and undocumented way for details and sample code.

If you mean that it could open say at 8:00 am, then you can use autohotkey and simply write
SendInput {Raw}{Lwin}{R}
and then compile it as an .exe and put it as a cron job

Related

TestComplete:How to run Run dialog box through C# scripting in Testcomplete?

In one of my tests, i need to open Run Dialog Box and open an application.
How can i open 'Run' in the very first step using C# script in Testcomplete.
Thanks in Advance
Helen is right: the best way is to just use the Tested Applications feature. However, if you must use the Run dialog for some reason, you can open it using this code of line:
Sys.Keys("[Hold][Win]r[Release]");

Assign VBS Script to a Keyboard Shortcut

I have a very basic VBS script that I plan on using frequently on my Windows 7 machine. Is there any way I can bind it to a keyboard shortcut so I don't have to navigate to it through Explorer obnoxiously.
I realize this question does not directly pertain to programming, or even scripting for that matter, but I could not find a straight answer online or through my own experimentation. I'm sure that there is a simple solution somewhere...
Thank you for taking the time to read, and hopefully respond to my inquiry.
Evin Ugur.
Windows does have built-in support for shell shortcut keys, where a keypress is used to invoke an *.lnk file that launches your VBScript (using either cscript or wscript).
Create a shortcut file, have it invoke your VBScript file directly or run cscript or wscript with the appropriate arguments, then save it and open its Properties sheet and set a keystroke in the "Shortcut key" field (I suggest something like Ctrl+Alt+K).
Like so:
Then, whenever you press Ctrl+Alt+K, regardless of the active application, your script will be invoked.
A more heavy-duty alternative is AutoHotKey: http://www.autohotkey.com/
Just as an FYI.
I tried this and I was not able to register the hotkey when I had the Icon in a costume folder. Even if I added the hotkey, it failed to work.
Once I moved the icon to the "C:\ProgramData\Microsoft\Windows\Start Menu\Programs", the hotkey started to work.

How to handle drag-and-drop to a Win32 application icon?

I have to update a Win32 application in order to handle the drag-and-drop of files over the icon of the executable.
I am not sure about how to proceed. A few researches led me to considering the "WM_DROPFILES" message, but MSDN syas it is "Sent when the user drops a file on the window", while I don't want to open a window.
Think of a command line tool "MyProgram.exe" : if I drag "MyFile.file" on the windows icon "MyProgram" in the desktop, I would like it to execute the same way as it would do when typing ">MyProgram MyFile.file" in the command prompt.
Any idea how to achieve this result ?
While it is true that apps get this for free by parsing the command line, there is a shell interface called IDropTarget you can implement if you need more control. See MSDN and this blog entry for more details.
Windows does this for you automatically. Any program foo.exe accepts drags of any file.
Martyn

Command line in Visual Studio - how to close popup window?

I have situation like below.
I'm running some command and then I get a popup with Y/N answer. Is there a possibility to force answer Yes and automatically close the window through command line?
If you want to click a button in an external window, you'll need to hook the window with the button exposed. You can accomplish this by grabbing the window handle via FindWindow, finding the child button, and sending a BM_CLICK with an API call via SendMessage.
you mean a command window within VS ? I don't think there's anything generic, you could run all sorts of things, depends on what your command is - and how much control over it you have - maybe some example of what you're trying to do could help. 'picking' the window will work but depends again on what you're doing, how custom it is etc.

Windows shutdown dialog

Is there a way to bring up the Windows XP shutdown dialog (the one with the three buttons – Suspend, Shutdown, Restart and Hibernate when Shift is pressed) using any language (preferred: C/C++, VB, Haskell, batches)?
I think I can load the msgina.dll in my C++ program, but I dunno what to do next – what function in the dll is used to show the dialog?
Assuming that your language has a way to do basic file I/O and invoke shortcuts on Windows, try this tip from here:
Create a new txt file somewhere on your system, open it and put in this one line:
(new ActiveXObject("Shell.Application")).ShutdownWindows();
Save and close the file. Change the extension to *.js.
You can make a shortcut to that file to make it easy to shut down your system.
I find PowerShell to be more elegant than other Windows scripting options.
(New-Object -Com Shell.Application).ShutdownWindows()

Resources