windows-vista

Looking for C# code for detecting removable drive (usb flash)

懵懂的女人 提交于 2019-11-26 17:15:42
问题 I'm looking for a C# code snippet to give me a notification for when a USB drive is plugged into my PC in Windows Vista (or win7) 回答1: There's a class called DriveDetector over at Codeproject that sounds like it does what you want. 回答2: Look at WM_DEVICECHANGE. This message should be sent when a drive is inserted. 回答3: I know this is not exactly what you asked for, but if you want to check what devices are available at any moment in time, there's another way. You can use the WMI classes in

powershell : changing the culture of current session

你。 提交于 2019-11-26 17:13:14
问题 I am using powershell on windows vista. How do I change the culture of current session? My computer's culture is tr-TR so I am getting the error messages on Turkish. I would like to change to EN? any chance? 回答1: Have a look here: http://blogs.msdn.com/b/powershell/archive/2006/04/25/583235.aspx and here: http://poshcode.org/2226: function Set-Culture([System.Globalization.CultureInfo] $culture) { [System.Threading.Thread]::CurrentThread.CurrentUICulture = $culture [System.Threading.Thread]:

CreateDesktop() with vista and UAC on (C, windows)

[亡魂溺海] 提交于 2019-11-26 16:47:39
问题 I asked this in CreateDesktop() with Vista UAC (C Windows) I set a bounty but in trying to vote down the only answer the "accept" was pressed by mistake (i've been awake for more than 48 hs). so I am asking it again. I'm using CreateDesktop() to create a temporary desktop where an application will run, perform a cleanup action (while remaining out of the way) and terminate. I'm closing that desktop once the application is gone. Everything is fine when using Windows XP and even Vista. The

How can I control my PC's fan speed using C++ in Vista?

人走茶凉 提交于 2019-11-26 16:47:38
问题 How can I use C++ to control CPU fan speed in Windows Vista Ultimate? I would like to use ACPI. 回答1: ACPI: You need to learn about and use the WMI - Windows system management interface. Here are a few resources that will give you clues on where to start: SetSpeed Method of the CIM_Fan Class WMI C++ Application Examples Example: Calling a Provider Method Note that some motherboards don't support fan speed changes, and even those that do may not expose this to the WMI. In the best case you may

How to run NOT elevated in Vista (.NET)

☆樱花仙子☆ 提交于 2019-11-26 16:38:29
I have an application that I have to run as Administrator. One small part of that application is to start other applications with Process.Start The started applications will also be run as administrators, but I'd rather see them run as the 'normal' user. How do I accomplish that? /johan/ The WinSafer API's allow a process to be launched as a limited, normal, or elevated user. Sample Usage: CreateSaferProcess(@"calc.exe", "", SaferLevel.NormalUser); Source code: //http://odetocode.com/Blogs/scott/archive/2004/10/28/602.aspx public static void CreateSaferProcess(String fileName, String arguments

how to get process handle from process id?

 ̄綄美尐妖づ 提交于 2019-11-26 16:34:24
问题 I have process Id , I want to get its process handle. Is there any API available for that. I tried to use OpenProcess but it returns NULL, and GetLastError =0. This I am trying on Vista. I guess I need to enable SeDebugPrivilege before using OpenProcess . But for enabling SeDebugPrivilege I need to get its Process handle. 回答1: OpenProcess(PROCESS_ALL_ACCESS, TRUE, procId); You'll need to verify that you're using a valid process ID, and that you're permitted the access rights you request from

Get SSID of the wireless network I am connected to with C# .Net on Windows Vista

北慕城南 提交于 2019-11-26 16:26:31
I'd like to know if there is any .Net class that allows me to know the SSID of the wireless network I'm connected to. So far I only found the library linked below. Is the best I can get or should I use something else? Managed WiFi ( http://www.codeplex.com/managedwifi ) The method that exploits WMI works for Windows XP but is it not working anymore with Windows Vista. mariosangiorgio I resolved using the library. It resulted to be quite easy to work with the classes provided: First I had to create a WlanClient object wlan = new WlanClient(); And then I can get the list of the SSIDs the PC is

How can I detect if my process is running UAC-elevated or not?

情到浓时终转凉″ 提交于 2019-11-26 15:49:38
问题 My Vista application needs to know whether the user has launched it "as administrator" (elevated) or as a standard user (non-elevated). How can I detect that at run time? 回答1: For those of us working in C#, in the Windows SDK there is a "UACDemo" application as a part of the "Cross Technology Samples". They find if the current user is an administrator using this method: private bool IsAdministrator { get { WindowsIdentity wi = WindowsIdentity.GetCurrent(); WindowsPrincipal wp = new

How can I programmatically refresh Windows Explorer?

和自甴很熟 提交于 2019-11-26 15:42:08
问题 I have a Windows shell extension that uses IShellIconOverlayIdentifier interface to display overlay icons on files and folders. My extension is a little like TortoiseCVS or TortoiseSVN. Sometimes I need to make Windows Explorer redraw all it's icons. To do this, I call SHChangeNotify like this: SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL) This refreshes the desktop and right hand pane of any open explorer windows. It doesn't refresh the folder tree on the left hand side of any

Node.Js on windows - How to clear console

时光毁灭记忆、已成空白 提交于 2019-11-26 15:22:02
问题 Being totally new into node.js environment and philosophy i would like answers to few questions. I had downloaded the node.js for windows installer and also node package manager.Windows Cmd prompt is being currently used for running nodejs apps. cls clears the command window or errors in command prompt. Is there a equivalent for node.js ? console.clear does not exist ;( or does it in some other form? I created a server through this code below var http = require("http"); http.createServer