windows-shell

How can I get monitors numbers from Screen Resolution dialog in win7 programmatically?

纵饮孤独 提交于 2019-11-27 20:50:13
When you press Identify button in Screen Resolution dialog then Windows shows you big white monitor numbers on each monitor. It was easy to find them programmatically together with monitor coordinates in Windows XP (with EnumDisplayDevices) but on Windows 7 it's broken. How can I do that? EnumDisplayDevices and GetMonitorInfo are not reliable anymore for that purpose in Windows 7. I tried GetMonitorInfo and then extracting monitor number from MONITORINFOEX.szDevice (I.E. \.\Display2) with no success. Another guy did that too two years ago and claimed that getMonitorInfo has a bug. This bug was

ShellIconOverlayIdentifiers - why so few?

江枫思渺然 提交于 2019-11-27 17:14:12
At this point, everyone knows that there's a limit to the number of ShellIconOverlayIdentifiers (from MSDN): The number of different icon overlay handlers that the system can support is limited by the amount of space available for icon overlays in the system image list. There are currently fifteen slots allotted for icon overlays, some of which are reserved by the system. For this reason, icon overlay handlers should be implemented only if there are no satisfactory alternatives I can understand the 15 overlay limt in Windows 95. But in an environment where there's Gigs of RAM, numerous Cores,

“Bring to front” for Windows XP command shell

风流意气都作罢 提交于 2019-11-27 16:43:22
问题 Is there a command I can put into a Windows XP .bat file to bring the command shell to the front? 回答1: From a batch file, no. If you want to activate a window you have to use SetActiveWindow(). If you don't want to get dirty with windows programming but still want to activate windows and simple stuff like that, I highly recommend checking out Autoit. You could always call this program from your batchfile to have it do the task. 回答2: nircmd will do this, though it involves a little scripting.

How do i get the path name from a file shortcut ? Getting exception [duplicate]

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-27 09:06:53
Possible Duplicate: Get target of shortcut folder For example, in C:\TEMP\ I have a shortcut called test.dll the shortcut will lead to the file name test.dll I want to get from the shortcut only the path name to the file it self. So, I'm calling this function in another recursive function and put in this function each time another directory from my hard disk. For example, the first directory is C:\TEMP then in C:\TEMP there is the shortcut file which I want to get the path only to the file. In C:\TEMP for the test I have now 3 files : hpwins23.dat hpwmdl23.dat hpwmdl23.dat - Shortcut ( C:\TEMP

can .vbs file be a scheduled script?

这一生的挚爱 提交于 2019-11-27 08:33:20
问题 I have written a .vbs script which presently is run manually by users. How can I make this script schedule itself in Task Scheduler (to run at a fixed time each day automatically) on Windows XP and Windows 7 the first time it is executed manually? EDIT Option Explicit Dim oShell : Set oShell = WScript.CreateObject ("WScript.Shell") Dim FSO : set FSO = CreateObject("Scripting.FileSystemObject") Dim StartTime,Elapsed 'msgBox(oShell.CurrentDirectory) 'MsgBox(FSO.GetFile(Wscript.ScriptFullName)

How to control the size of the Windows shell window from within a python script?

无人久伴 提交于 2019-11-27 07:15:14
问题 When launching a script-type python file from Windows you get a windows shell type window where the script runs. How can the script determine and also set/control the Window Size, Screen Buffer Size and Window Position of said window?. I suspect this can be done with the pywin32 module but I can't find how. 回答1: You can do this using the SetConsoleWindowInfo function from the win32 API. The following should work: from ctypes import windll, byref from ctypes.wintypes import SMALL_RECT STDOUT =

How do I write a batch file which opens the GitBash shell and runs a command in the shell?

馋奶兔 提交于 2019-11-27 06:44:13
I'm on Windows 7 trying to use a batch file to open the GitBash shell and make a git call. This is the contents of my batch file: REM Open GitBash C:\Windows\SysWOW64\cmd.exe /c ""C:\Program Files (x86)\Git\bin\sh.exe" --login -i" REM retrieve archive git archive master | tar -x -C %~1 REM quit GitBash exit I noticed that the GitBash is logging out before the next command "git archive...". Does anybody know if I can pass the command into GitBash and how? Mike Erik "C:\Program Files (x86)\Git\bin\sh.exe" --login -i -c "git archive master | tar -x -C $0" "%~1" rugg You can also run a shell

How to set focus back to form after opening up a process (Notepad)?

一笑奈何 提交于 2019-11-27 06:06:28
问题 I open up a notepad from my program using Process.Start() but the new opened notepad covers the screen. But I do want my application to maintain its focus. I similarly (using the same Process.Start) open up MS Excel and Word but to get focus back to my form all I need to write is: this.Focus(); But quirk with Notepad: I open notepad (and all other processes like this) Process process = new Process(); process.StartInfo.UseShellExecute = true; process.EnableRaisingEvents = true; process

How to “safely” delete folder into Recycle Bin

孤人 提交于 2019-11-27 06:00:42
问题 I'm looking for a way to put a folder (with subfolders) into a Recycle Bin with these conditions: It must be done silently -- without any Windows UI. The folder must never be permanently deleted. If it can't be put into Recycle Bin, I'd expect the API to fail. Get a callback routine for the process like CopyFileEx does. So far I was able to come up with this: SHFILEOPSTRUCT sfo = {0}; sfo.wFunc = FO_DELETE; sfo.pFrom = L"K:\\test del from USB\0"; //Folder on a USB stick sfo.fFlags = FOF

Programmatically select multiple files in windows explorer

有些话、适合烂在心里 提交于 2019-11-26 22:33:37
I can display and select a single file in windows explorer like this: explorer.exe /select, "c:\path\to\file.txt" However, I can't work out how to select more than one file. None of the permutations of select I've tried work. Note: I looked at these pages for docs, neither helped. https://support.microsoft.com/kb/314853 http://www.infocellar.com/Win98/explorer-switches.htm This should be possible with the shell function SHOpenFolderAndSelectItems EDIT Here is some sample code showing how to use the function in C/C++, without error checking: //Directory to open ITEMIDLIST *dir =