windows

In the windows API, is there a generic method which will give you the appropriate HTTP proxy for a URL?

I'm writing an application intended for distribution around the world. I recently discovered a method of WinHTTP: http://msdn.microsoft.com/en-us/library/aa384097(VS.85).aspx This can decode any Netscape-style PAC file (in Javascript) and tell me the correct proxy to use for any URL I might want to use. That's all great, but I've not...

Which is better for windows? pthreads or CreateMutex?

Hi all, I am porting my application to windows from Linux. I am fairly new to the fine-art of porting application across platforms. As far as I know, Windows does not natively support POSIX threads implementation. Is this true? I have heard about some implementation of pthreads for windows (a wrapper or something), would it be better to ...

^M at the end of every line in vim

When I am editing source files using vim and other editors sometimes at the end of the line I get these ^M characters at the end of each line. I think that it has something to do with editing a file in windows and then in linux. How can I remove all of these automatically? ...

Semi-standard resolutions don't appear on Windows slider.

I have a custom monitor/projector that has passed the Windows Logo Test but I'm still having trouble finding out why my custom resolutions don't appear on the slider bar. They appear under the "advanced" windows when you click on "list all modes" and I can change resolutions that way. I can also change resolutions using PowerStrip. Th...

How to emulate shm_open on Windows?

My service needs to store a few bits of information (at minimum, at least 20 bits or so, but I can easily make use of more) such that it persists across service restarts, even if the service crashed or was otherwise terminated abnormally it does not persist across a reboot can be read and updated with very little overhead If I store ...

Windows batch file for renaming file at specified interval

I would like to write a windows batch file for the purpose of renaming a file every 25 seconds. I would also like the batch file to terminate after 300 seconds have passed. How would I go about doing this? Here is what I have thusfar. START RENAME test.g test.go SLEEP 25 RENAME test.go test.g GOTO START ...

Why doesn't a * in my pipe open in Perl work on Windows?

I am having this strange issue with Perl. I am trying to execute an external program from inside my Perl script and this external program takes string + wildcard as parameters. My Perl program looks like this my $cmd_to_run = 'find-something-in-somedb myname* |' open(procHandle, $cmd_to_run); # I am using open because I want to ...

How can I tell if a Windows module handle is still valid?

A module can be unloaded, so how can I tell for sure if it is still in memory? I have a handle to it, obtained from GetModuleHandle. When I tried calling GetHandleInformation on it I see error 0xc0000008 - "An invalid HANDLE was specified." This happened before it could have been unloaded. ...

VS 2005 rebuilds project without changing any files.

This is a really strange issue. One day my project started to do a rebuild every time I launched it in the debugger, even if I hadn't changed the code. ie. I would go Build->Build Solution, then Debug->Start Debugging, it would rebuild when I tried to start debugging. The specific file that it recompiles is shown (left out source code, j...

Why would StretchDIBits fail on turning image upside down when drawing to EMF file?

I'm attempting to draw an image using StretchDIBits with an Enhanced Meta File handle as the HDC to my OnDraw function using C++ and Visual Studio 2008. I load the .bmp source file using GDIplus and using GetHBITMAP. If I use the HDC returned by BeginPaint there are no problems. If I draw the bitmap upright, flipped horizontally, or fli...

Compilng C/C++ makefile files under Windows (XP)

I'm trying to use a Python library (pyMedia) that has some non-Python requisites libraries. (libogg, libvorbis, liblame, and libfaad2 - this isn't relevant to the question specifically). libogg requires you to manually compile it from the source and comes with a makefile. I have GCC installed for Windows. How would I go about compiling ...

Programmatically empty out large text file when in use by another process

Hey everyone, I am running a batch job that has been going for many many hours, and the log file it is generating is increasing in size very fast and I am worried about disk space. Is there any way through the command line, or otherwise, that I could hollow out that text file (set its contents back to nothing) with the utility still ha...

Trouble restarting exe

Hi, I need to restart the program that im working on after an update has been downloaded except im running into some issues. If i use CreateProcess nothing happens, if i use ShellExecute i get an 0xC0150002 error and if i use ShellExecute with the command "runas" it works fine. I can start the command prompt fine using CreateProcess an...

DNS Lookup in PHP

I have a Windows server that is intermittently losing the ability to lookup DNS information. I'm trying to get to the root cause of the problem but in the mean time I'd like to be able to monitor whether the server can perform lookups. Basically, it should attempt to lookup some common hostnames and the display 'Success' if the lookups...

DNS Lookup in ASP / ASP.Net

I have a Windows server that is intermittently losing the ability to lookup DNS information. I'm trying to get to the root cause of the problem but in the mean time I'd like to be able to monitor whether the server can perform lookups. Basically, it should attempt to lookup some common hostnames and the display 'Success' if the lookups ...

How can i close collapse property of treeview

I m working on windows project with c#. I want to close collapse property of treeview when i m double clicking on the nodes. ...

Update desktop "show window contents while dragging" setting programatically.

Hi All, One of my programs seems to be changing the Display Properties > Appearance > Effects > Show window contents while dragging setting to off every few hours. I'm not sure exactly which program, or when it happens. I have a number of programs that seem like likely culprits - wallpaper rotators, software for multiple monitors, mul...

Helgrind for Windows?

Helgrind is a Valgrind tool for detecting synchronisation errors in C, C++ and Fortran programs that use the POSIX pthreads threading primitives. Anyone knows an equivalent tool for windows? After googling a bit I haven't found anything... ...

When to use named pipes in Windows?

In *nix many command line applications that accept file names as arguments accept pipes also. Example: anApplication file.txt Also works with anApplication | anotherApplication arguments And the result of the "anotherApplication" is redirected to "anApplication" as it was a file I learned that the Windows equivalent to this is a "...

Custom Windows folder icon

Skype has a nice custom folder icon for the Skype folder in C:\Program Files. How do you do register a custom icon for a specific windows (XP and up) folder? ...