windows

Why isn't my change to the registry persisting in C++?

I'm attempting to edit the registry with C++ and this is my first time trying to do so, and I'm failing. I'm not getting any error code, everything says it completed successfully, but it doesn't actually change the registry key. Here is the code I am using: HKEY hkey; DWORD dwDisposition, dwType, dwSize; int autorun = 0x00; int CD_AUTO...

How can I kill and then restart a proccess in C++?

I would like to kill and restart explorer.exe from my C++ application, how would I do this? ...

Getting correct shell verb text for action...

I've been looking over the following VB code: http://www.codeproject.com/KB/vb/toggleNetworkConn.aspx If you look under "The Methods", you'll see that he does a test to see whether or not the shell item verb is either "En&able" or "Disa&ble" - it looks pretty obvious that these are the same text strings that are listed in the right-cli...

How to append a date in batch files

I have the following line in a batch file (that runs on an old Win2k box): 7z a QuickBackup.zip *.backup How do I append the date to the QuickBackup.zip file. So if I ran the batch file today, ideally, the file would be QuickBackup20090514.zip Is there a way to do this? ...

How to deal with a second event-loop with message-dispatch?

I am working on a program which is essentially single-threaded, and its only thread is the main event-loop thread. Consequently, all its data structures are basically not protected by anything like critical region. Things work fine until it recently integrates some new functions based on DirectShow API. Some DirectShow APIs open a secon...

Monitoring certain system calls done by a process

I would like to be able to monitor certain system calls made by a process, primarily file I/O calls. On Linux I can probably get away using strace with suitable parameters, but how can I do this on Windows? I'm primarily interested in running a process and figuring out which files it has read and written. EDIT: I want to do this progra...

List all applications that handle a specified file type

Is it possible to list all the applications on a machine that can open a specific file type, using only the files extension? for example if I have a text file (.txt), I want a list of all applications that can open .txt files. ...

Is there a way to detect and react to/stop a process from starting?

I'd like to have a program that just runs in the background and detects whenever a certain process is started and hopefully prevent it from starting and then react to it some way, in Windows. Specifically, my co-workers will install "epic fail" on anyone's machine who forgets to lock it for 2 seconds and gets coffee or goes to the restro...

Is there something like linux ptrace syscall in Windows?

Reading http://stackoverflow.com/questions/864839/monitoring-certain-system-calls-done-by-a-process I'm wondering about a Windows equivalent to the ptrace syscall or a programatically workaround. ...

Monitoring a sub-process / can I get TotalProcessorTime for a Process group?

Is there a way to get the Process.TotalProcessorTime that reflects a process PLUS any processes that it has spawned? Alternatively, how can I verify that the process (or it's descendants) are still "actively" running? My app is spawning an external process and waiting for it to exit. With sample data it takes 5-20 minutes to complet...

Transferring files from AIX batch to Windows batch

The responses to my previous question suggested SSIS as the most efficient and reliable way to get files from AIX into SQL Server. I agree that it's probably a good idea. But for the sake of understanding the other options better, I'd like to narrow the scope a little bit. Irrespective of what I plan to do with the files, how can I dete...

How to troubleshoot Windows Scheduled Task not running?

In the process of deploying our .net app, I've got about 20 scheduled tasks set up on a server, all of which basically do the same thing: invoke a small .net console app that pulls data from a SQL db and posts it to a web service. Each task invokes a separate copy of the app, each copy having a different lookup ID value in its config fi...

Flickering child windows with alpha channels

When drawing child controls containing bitmaps with per-pixel alpha channels, we are getting quite a lot of flickering whenever they need to be redrawn. The actual blending is working correctly. I've found a lot of info about reducing flicker (such as this question or this site), but I can't seem to find anything that applies specifica...

C Timer Callback

Interested in something similar to JavaScript setTimeout in C on both UNIX and Windows. Basically, I want: start_timer(&function_pointer, int time_in_secs) or as close to that as I can get. Also, something similar to setInterval would be nice (where it calls the callback every n seconds), but that can be implemented using setTimeout...

How do I test the current drive letter in a batch file?

I'm trying to write a batch file that takes the drive letter the batch file is being run from, and uses it an an IF statement. If the letter is M: for example, it will jump to the label :mSection. Is this even possible? Thanks ...

Visual studio forgets window settings and makes a mess

I have this problem where I open Visual Studio and the internal windows are scattered all over the place. None of them are docked; some that should be visible have become invisible and vice versa. I then have to spend ages getting the windows back where I like them. It only seems to happen with some solutions and only appeared recently....

Qt: how to set main window's initial position?

I think the normally window manager determines the initial position of the QMainWindow position on the desk top. I want to set the initial position myself. How is this done with Qt on Windows? ...

Is it possible to programmatically disable the Caps Lock key on Windows?

The Caps Lock key is driving me nuts - I never use it intentionally, but sometimes accidentially press it instead of TAB. My current solution is to remove the button with a screwdriver (no damage, can be placed back if ever needed). Is there a way to disable the Caps Lock key programmatically on Windows - write a program with a keyboard...

Detect RPC client crash on the server side when using binding handles

A server application is using Microsoft RPC for interprocess communications. It starts an RPC server with an endpoint corresponding to a connection-oriented protocol (ncacn_np for example). Multiple clients call methods in this server using binding handles. Is it possible for the server to detect that a client that invoked any given clie...

What's the difference between RpcTestCancel and RpcServerTestCancel?

Descriptions of RpcServerTestCancel() and RpcTestCancel() look very similar. What's the difference between them? ...