windows

How do I check if a disk is in a drive using python?

Say I want to manipulate some files on a floppy drive or a USB card reader. How do I check to see if the drive in question is ready? (That is, has a disk physically inserted.) The drive letter exists, so os.exists() will always return True in this case. Also, at this point in the process I don't yet know any file names, so checking to...

What is SRV in MS RPC and what should I know about it?

This MSDN article about interface registration flags when describing the RPC_IF_ALLOW_LOCAL_ONLY flag talks about some entity called SRV: ...When this interface flag is registered, the RPC runtime rejects calls made by remote clients. ... RPC allows ncacn_NP calls only if the call does not come from SRV... I've looked through the RFC 2...

How to check that system is in Log off state?

I want to check that whether the system is in log off state or not in VC++, any ideas? ...

How to know the dimension of swf file without Flash ?

I've a swf file and i want to embed this file into HTML page but i don't know the exact dimension of swf . Windows XP file properties doesn't show the dimension and I don't have Adobe Flash software. Then how can i know the Dimension. ...

Windows batch script to print error message if port in use

I'm trying to write a batch script that errors if port 1099 is already in use. Unfortunately I have to write it in a DOS batch script (I cannot install anything). I know that I can print the PID of the process hogging port 1099 manually: netstat -aon | findstr ":1099" But I want to be able to run that command in a batch script and e...

Where's repl in Windows Server 2008?

Hi, Where can I find the %windir%\system32\repl directory in Windows Server 2008? The machine is a Domain Controller. Thanks ...

What is required to enable marshaling for a COM interface?

I have a 32-bit ATL COM component without a type library. It has a class factory for one given class that implements several interfaces. When I use it as an in-proc server, everything works fine - the client side invokes CoCreateInstance(), the object is instantiated and QueryInterface() retrieves a pointer to a requested interface. But...

How to know when a new USB storage device is connected in Qt?

I want to know when a USB device is connected to the computer that my Qt application is running on (in Windows). In my main QWidget, I've reimplemented winEventFilter like this: bool winEventFilter ( MSG * msg, long * result ) { qDebug() << msg; return false; } I'd expect qDebug to send at least something when I connect a USB ...

Win32, C++: Creating a popup window without stealing focus

I am creating a program that displays a popup at certain times (just like some chat clients for example) on which the user can click. However, I do not want to take away the focus from the current application. The way I'm doing it now is by using a HWND with WS_POPUPWINDOW and minimizing and then restoring the window. However, this ste...

Win32 API for determining if a path is relative or absolute?

Is there a win32 function that will tell me if a path is relative or absolute? Thanks, ...

Free Server Monitoring Service or Software

Looking for a free service, or software to monitor 2 websites, one is hosted on a linux machine, and the other a windows machine (though, shouldn't really matter). Any suggestions? ...

Controlling windows services via the web?

Hi, I've been thinking of a piece of software and wondering if it exists ... a quick scout around on google indicates that it doesn't. Here's our problem, we have a bunch of global services that run at various international locations. We need to globally control these services, for example a global bounce (something that occurs every w...

How to overwrite Response.Redirect to prevent port coming with it

Hi, I have a scenario that my load balancer translates port 80 from outside into port 801 which is local. And When it comes to server, server obviously sees port 801 and in Response.Redirect it tries to inject port 801 into the URL it redirects to but this is not the desired solution for me. What I am thinking is to: 1. Overwrite Respo...

Locking files using C++ on Windows

I have a program writing/reading from a file, and I want to lock the file for other instances of my application. How can I do it (in c++ visual studio 2003)? I tried using the _locking() but then also I myself cannot reach the file when trying to read/write (in the same instance). I know there's an option of LockFile() but have no idea ...

BackgroundWorkerThread access in a thread

I use BackgroundWorker most of the time in the win form apps to show progress as I'm getting data. I was under impression that Work_completed is guaranteed to be executed on Main UI thread but it's not. If we create a thread and call the worker.RunWorkerAsync within it, it breaks if we try to update any gui control. Here is an example p...

Running programs easily from a command line on Windows

Linux allows me to have a short system path by placing binaries in just a few locations. I don't have to edit the path because I just installed a new application, and I don't have to hunt for applications I want to run. How can I, with PowerShell as the program I use to launch programs from, accomplish the same thing on Windows (Vista)? ...

Enforce File Naming Convention on Windows Share?

Hi Everyone, Simple question, but I can't seem to find the answer anywhere. Is there a way in Windows, or via a third-party utility, to enforce file naming conventions within a Windows network share? I'm sure this is easy in Sharepoint, but I want to be able to limit users to the file name format they save into a folder. I could crea...

C++ compiler error in netbeans.

I've tried everything from reading the Netbeans help to browsing Google. This code works fine in Dev-Cpp but not Netbeans 6.5.1. Netveans also places and exclamation mark next to #include <iostream> which i checked and is in the include path of netbeans and is in the include folder: #include <iostream> int main() { std::cout << "Te...

taskkill in an if condition?

Hello, Has anyone used taskkill on Win XP in an if condition? I want to use it as a watchdog to restart a program in case it leaks memory and grows too big by adding it in an unending loop. For example with the following command I can kill Internet Explorer if its memory usage is greater than 40kb (will happen every time): taskkill /...

How to read from a text file using VBScript?

I am looking to see a simple way to read from and write to a text file using VBScript. I think this is an acceptable method for writing to a file. Dim f, Dim fso Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.CreateTextFile("C:\test.txt", True, True) f.WriteLine("Data to Add to file.") f.Close However, I wo...