windows-vista

Eventlog listener - Applications and Services

扶醉桌前 提交于 2019-11-30 05:27:33
问题 Is there a way to watch events of "applications and services" when they are generated (in C#)? I've figured out that I can not use WMI for it. Any other ideas? 回答1: You can subscribe to EventLog.EntryWritten Event Occurs when an entry is written to an event log on the local computer. From MSDN: .... EventLog myNewLog = new EventLog(); myNewLog.Log = "MyCustomLog"; myNewLog.EntryWritten += new EntryWrittenEventHandler(MyOnEntryWritten); myNewLog.EnableRaisingEvents = true; } public static void

How do I turn Password Protected Sharing on or off programmatically?

笑着哭i 提交于 2019-11-30 05:26:32
Windows Vista and 7 has this switch in Network and Sharing Center. It's on by default, and that prevents unauthenticated access to shares even if they're shared with Everyone (like the Public folder). I need to teach my application to turn it on and off automagically. How? I suspect there is a value somewhere in the registry that's responsible for this, but I have no idea how to find it. Probably too late :) , but hopefully useful for others. The following steps worked just fine for me (it worked on W8 consumer preview too). to turn it off: 1 - Enable guest account by running net user guest

How do I create add a shortcut (.lnk) for my application to the Startup folder programatically in .NET/C#

∥☆過路亽.° 提交于 2019-11-30 05:21:42
My application will have a per machine (not per user) Startup shortcut. I can create a shortcut during the installer process no problem. My problem comes when the user later removes it and then tries to re-enable. In otherwords, they turn off RunOnStartup (which deletes the Startup ink) and at a later time they decide they do want it to run on startup so they go back into preferences and re-enable. Apparently, this is a pretty common gripe with .NET that there isn't a native way to create shortcuts. But, haven't found a very good solution. Solutions I've Found/Considered: Rather then create a

How to check if a file can be created inside given directory on MS XP/Vista?

最后都变了- 提交于 2019-11-30 05:20:09
问题 I have a code that creates file(s) in user-specified directory. User can point to a directory in which he can't create files, but he can rename it. I have created directory for test purposes, let's call it C:\foo . I have following permissions to C:\foo : Traversing directory/Execute file Removing subfolders and files Removing Read permissions Change permissions Take ownership I don't have any of the following permissions to C:\foo : Full Control File creation Folder creation I have tried

Managing apps volume in Windows 7

陌路散爱 提交于 2019-11-30 04:38:48
问题 How can I retrieve the list of application audio sessions (like in Windows volume mixer) and change volume of one application (for example, Mozilla) manually (C++, Delphi)? Skype do something the same when you start talking (decreases the volume of other applications). Thanks in advance! 回答1: To enumerate the Audio sessions you must use the IAudioSessionManager2 interface and call the GetSessionEnumerator method, this will return a IAudioSessionEnumerator interface , from here you must invoke

BDE initialization failure (error $2501) on Vista

假装没事ソ 提交于 2019-11-30 04:07:46
问题 I have a small datasnap server written in Delphi 2007 that accesses the BDE. It works fine on Windows 2000 and XP but from time to time (actually quite regularly) on Vista I get the error message: An error occurred while attempting to initialize the Borland Database Engine (error $2501) Closing everything down that uses the BDE fixes the error (although you sometimes need to "End Process" the datasnap server to close it). This is becoming rather annoying as more and more of our clients are

GetThreadId on pre-vista systems?

心不动则不痛 提交于 2019-11-30 03:55:36
问题 Apperantly, GetThreadId is a Vista API. How can I get a thread's id on pre vista systems? 回答1: There are a few options: When you call CreateThread, you get the handle back. You can call GetCurrentThreadId to get the current thread's ID. You can use Thread32First/Thread32Next to enumerate threads. 回答2: If you can somehow make the thread in question call GetCurrentThreadId and store it somewhere, you could read the result. 回答3: If the thread in question enters an alertable wait state frequently

How do I make my program work in Windows Vista and Windows 7?

空扰寡人 提交于 2019-11-30 02:26:23
I have an application written in Delphi 2006 that was working fine in Windows XP. I packed the application using Inno Setup, using Program Files as the default folder. A few users migrated to Windows Vista and Windows 7. The issue here is that the application creates some files inside its installation folder by its own. This was working in XP but in Windows Vista the users were having problems with the created files (they don't appear and so on). After investigating the users' reports I discovered KB 927387 : "Common file and registry virtualization issues in Windows Vista or in Windows 7."

Get HDD (and NOT Volume) Serial Number on Vista Ultimate 64 bit

你说的曾经没有我的故事 提交于 2019-11-30 02:22:37
I was once looking for getting the HDD serial number without using WMI, and I found it. The code I found and posted on StackOverFlow.com works very well on 32 bit Windows, both XP and Vista. The trouble only begins when I try to get the serial number on 64 bit OSs (Vista Ultimate 64, specifically). The code returns String.Empty, or a Space all the time. Anyone got an idea how to fix this? EDIT: I used the tools Dave Cluderay suggested, with interesting results: Here is the output from DiskId32, on Windows XP SP2 32-bit: To get all details use "diskid32 /d" Trying to read the drive IDs using

findstr or grep that autodetects chararacter encoding (UTF-16)

不想你离开。 提交于 2019-11-30 01:41:03
问题 I want to do this: findstr /s /c:some-symbol * or the grep equivalent grep -R some-symbol * but I need the utility to autodetect files encoded in UTF-16 (and friends) and search them appropriately. My files even have the byte-ordering mark FFEE in them so I'm not even looking for heroic autodetection. Any suggestions? I'm referring to Windows Vista and XP. 回答1: Thanks for the suggestions. I was referring to Windows Vista and XP. I also discovered this workaround, using free Sysinternals