windows

Intercept Windows Vista shutdown event in C#

I want to be able to intercept the shutdown event in C# for Windows Vista. Due to the advanced security features with Vista, any applications that are running after the shutdown command is called are halted and displayed in a list, prompting the user to do something with them. Does anybody know how to overcome this and what events I ne...

Using P/Invoke correctly

Hi, I need to call an external dll from c#. This is the header definition: enum WatchMode { WATCH_MODE_SYSTEM = 0, WATCH_MODE_APPLICATION = 1 }; LONG ADS_API WDT_GetMode ( LONG i_hHandle, WatchMode * o_pWatchMode ); I've added the enum and the call in C#: public enum WatchMode { WATCH_MODE_SYSTEM = 0, WAT...

Windows batch files: .bat vs .cmd?

As I understand it, .bat is the old 16-bit naming convention, and .cmd is for 32-bit Windows, i.e., starting with NT. But I continue to see .bat files everywhere, and they seem to work exactly the same using either suffix. Assuming that my code will never need to run on anyhting older than NT, does it really matter which way I name my ba...

Recovery from optical media ignoring read errors

I have backups of files archived in optical media (CDs and DVDs). These all have par2 recovery files, stored on separate media. Even in cases where there are no par2 files, minor errors when reading on one optical drive can be read fine on another drive. The thing is, when reading faulty media, the read time is very, very long, because ...

How can I limit the maximum number of running processes within Microsoft Windows?

I'm looking for a way to limit the maximum number of running processes in Windows Server 2003. Is there a registry key somewhere that controls it? If so, which one is it? ...

Way to Stop a Windows Service when CanStop is set to False (C#)

Ok so part two of I have no will power experiment is: Summary Question - Is there a way to set the CanStop property on a windows service dynamically? Whole Spiel - I have a service that is currently checking and killing processes (IE Games) I have told it to if it's day I'm not allowed. Great. I set the CanStop to false so that I can...

How to programmatically get the CPU cache page size in C++?

I'd like my program to read the cache line size of the CPU it's running on in C++. I know that this can't be done portably, so I will need a solution for Linux and another for Windows (Solutions for other systems could be usefull to others, so post them if you know them). For Linux I could read the content of /proc/cpuinfo and parse th...

Get list of available Windows audio file formats

I've got a C# program that's supposed to play audio files. I've figured out how to play any sound file for which Windows has a codec by using DirectShow, but now I want to properly fill in the file type filter box on the Open dialog. I'd like to automatically list any file format for which Windows has a codec. If some random user inst...

Side effects of calling RegisterWindow multiple times with same window class?

I'm working on a little test application at the minute and I have multiple window objects floating around and they each call RegisterWindowEx with the same WNDCLASSEX structure (mainly because they are all an instance of the same class). The first one registers ok, then multiple ones fail, saying class already registered - as expected. ...

Embedding SVN Revision number at compile time in a Windows app

I'd like my .exe to have access to a resource string with my svn version. I can type this in by hand, but I'd prefer an automated way to embed this at compile time. Is there any such capability in Visual Studio 2008? ...

Get other running processes window sizes in Python

This isn't as malicious as it sounds, I want to get the current size of their windows, not look at what is in them. The purpose is to figure out that if every other window is fullscreen then I should start up like that too. Or if all the other processes are only 800x600 despite there being a huge resolution then that is probably what t...

root folder equivalent in windows

Is C drive treated as the root folder in windows when one says \folder1\folder2\ in linux and windows C:\folder1\folder2. ...

saslpasswd2: generic failure on Windows

I get a generic failure when I try to run: saslpasswd2 username This was installed by Collanet's Subversion 1.5.2. ...

Send mail from a Windows script

I would like to send mail from a script on a Windows Server 2003 Standard Edition. I think the server setup is pretty much out of the box. The mail server is an Exchange one, and when you're on the internal network you can use plain old SMTP. I have done it from my machine with Perl, but unfortunately Perl is not available on the server...

GetProcessesByName() and Windows Server 2003 scheduled task

Does anybody know what user privileges are needed for the following code needs to successfully execute as a scheduled task on Windows Server 2003: System.Diagnostics.Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName) When NOT running as scheduled task i.e. under a logged in user, as long as the user is a member of "Pe...

Windows Command Line Reference

Can you recommend a reference for the windows command line? I would like an exhaustive reference. Perhaps something along the lines of Unix in a Nutshell? I see that there is a Windows XP in a Nutshell - is that the same sort of thing? ...

Which are the differences between dialog|main/child/mdi windows ?

I need to understand the differences between windows main/mdi/child/dialogs.... how win32 messages should be propagated... why some messages are present in one type and not other... ...

Deployment tools ENTERPRISE - what is the best for Windows environment?

What is the "best" tool for creating deployment packages/jobs/stuff for all "enterprise level" deployments..... GAC, COM+, Credentials, App pools, Web sites, registry entries, etc... It would be best if there is a way to "tokenize" the credentials and registry entries so that we can enter the appropriate credentials for the "next" enviro...

Launch web page from my application

Ok, this probably has a really simple answer, but I've never tried to do it before: How do you launch a web page from within an app? You know, "click here to go to our FAQ", and when they do it launches their default web browser and goes to your page. I'm working in C/C++ in Windows, but if there's a broader, more portable way to do it I...

Runnning a Python web server as a service in Windows

I have a small web server application I've written in Python that goes and gets some data from a database system and returns it to the user as XML. That part works fine - I can run the Python web server application from the command line and I can have clients connect to it and get data back. At the moment, to run the web server I have to...