winapi

Is is possible to use IOCP (or other API) in Reactor-style operations?

Hello, Is there any scalable Win32 API (like IOCP not like select) that gives you reactor style operations on sockets? AFAIK IOCP allows you to receive notification on completed operations like data read or written (proactor) but I'm looking for reactor style of operations: I need to get notification when the socket is readable or writa...

How might I wrap the FindXFile-style APIs to the STL-style Iterator Pattern in C++?

Hello everyone :) I'm working on wrapping up the ugly innards of the FindFirstFile/FindNextFile loop (though my question applies to other similar APIs, such as RegEnumKeyEx or RegEnumValue, etc.) inside iterators that work in a manner similar to the Standard Template Library's istream_iterators. I have two problems here. The first is w...

Printing on console WIN32/WTL.

I am developing WTL GUI application. I want to print something on console. How to enable console printing in win32/WTL application. ...

motherboard, network cards, ports, printer detection tools for .net

does anybody have a hardware detection api for .net? ...

Best Method for Minimizable Fullscreen Window

Hi, I'm coding a short game in C++ and Win32, and I want to be able to make it in fullscreen with a fixed size. I also want the user to be able to switch focus between the game window and other windows as much as he/she wants without any weird screen glitches. So far I know of the ChangeDisplaySettings function and creating the window w...

How do I create an inheritable Semaphore in .NET?

I am trying to create a Win32 Semaphore object which is inheritable. This means that any child processes I launch may automatically have the right to act on the same Win32 object. My code currently looks as follows: Semaphore semaphore = new Semaphore(0, 10); Process process = Process.Start(pathToExecutable, arguments); But the sem...

How to detect whether a control is standard or active-x control?

In MFC Application, how can we differentiate whether a control is a standard control like CComboBox or it is an custom active-x control? ...

Trying to use SHCreateShellItem, having #include issues

There is a function in called SHCreateShellItem which is declared in <shlobj.h>, but it has been #ifdef'd out based on whether or not _WIN32_IE is greater than or equal to 0x601 (if it is, then the declaration is present). However, even when I define _WIN32_IE to 0x601 before I include <shlobj.h>, MSVC++ still complains that SHCreateShel...

Windows <sys/file.h> equivalent

Is there a Win32 equivalent to the linux header file? I'm working on a Linux to Windows port (and my first time doing so) and it's failing on this file. ...

Changing the working directory for a process remotely

I've got an application that has a bug right now, but we're unable to update the end-user to get the fix out. What a possible workaround would be is to change the working directory to the application's install directory, but from what I can tell, there's no way to do that outside of the program itself. Is there some sort of Windows API c...

WOW64: get x64 %CommonProgramFiles% from 32 bit process

Queries I tried: ExpandEnvironmentStrings("%COMMONPROGRAMFILES%"), GetSpecialPath(CSIDL_PROGRAM_FILES_COMMON). All resolve to (typically) c:\\Program Files (x86)\\Common Files from my 32 bit app. I need to check a file version installed (typically) under c:\\Program Files\\Common Files of a 643 bit application. ...

Get country tld

Hello, How do I programmatically get the system country tld. In the registry there's a key called sCountry which has the country's name, but in the system language, eg. If the user has the Spanish version sCountry would be Espana, German version would be Deutschland, etc. ...

What is the PIXELFORMATDESCRIPTOR parameter in SetPixelFormat() used for?

Usually when setting up OpenGL contexts, I've simply filled out a PIXELFORMATDESCRIPTOR structure with the necessary information and called ChoosePixelFormat(), followed by a call to SetPixelFormat() with the returned matching pixelformat from ChoosePixelFormat(). Then I've simply passed the initial descriptor without giving much thought...

How to change the border size of a single window?

Is it possible to change the border width for a single window? I know you can change the border width for all windows, but I want to change only one. ...

Why can't I tile and cascade captionless windows?

I have several child windows, all with the same parent. I want to cascade/tile these windows and was happy to find the TileWindows and CascadeWindows functions. But they don't seem to work on my windows if they don't have a caption (and they don't have one)! With caption everything is fine. Why is this? ...

Structuring Win32 GUI code

I wish to improve my code and file structure in larger Win32 projects with plenty of windows and controls. Currently, I tend to have one header and one source file for the entire implementation of a window or dialog. This works fine for small projects, but now it has come to the point where these implementations are starting to reach 100...

What is the exact difference between MEM_RESERVE and MEM_COMMIT states?

As I understand it MEM_RESERVE is actually 'free' memory, ie available to be used by my process, but just hasn't been allocated yet? Or it was previously allocated, but had since been freed? Specifically, see in my !address output below how I am nearly out of virtual address space (99900 KB free, 2307872 as MEM_PRIVATE. But the sta...

How do I get an unexpanded REG_EXPAND_SZ string from a remote registry?

I am currently using RegistryKey.GetValue(string name, object defaultValue, RegistryValueOptions options) with RegistryValueOptions.DoNotExpandEnvironmentNames for the options value. However, this is only valid when run on the local machine. Digging down via Reflector, I find it expands the strings locally. Which means that irrespecti...

Override tooltip text for Titlebar buttons (Close, Maximize, Minimize, Help)

I have been trying without luck to change the text of the tooltip that appears for the buttons on the main title bar of a form. In a nutshell, we have harnessed the 'Help' button for Windows Forms to have some other purpose. This is working fine. The issue is that when hovering the mouse over that button, a 'Help' tooltip appears, whi...

Problem in implementing progress control using threading!

hello all, I am new to the concept of threading in C..so I find it difficult to implement that in my function...I have a simple application in which i want to display a progress bar at a particular place..In a particular funtion I will read files(in a for loop) for some manipulations(regarding my application) ...while its readin...