winapi

Where can I find a good example of ReportEvent function usage?

As with most "legacy" MSDN pages, the page for ReportEvent has too little information for me to make much sense of it. I've tried searching, but can't find a good, clean, simple example of the function's usage. Could anyone suggest one? ...

Please could someone suggest some books for WinAPI?

Possible Duplicate: A good book to understand WinAPI programming? Please close; duplicate of 329776. I just recently got involved with an open source project that uses Windows.h WinAPI extensively, and libraries such as Advapi32. I'm a real newbie when it comes to low level C++ stuff, since I've been a C# developer most of ...

How to get the code page of the current keyboard layout?

My non-Unicode application needs to be able to process Unicode keyboard input (WM_CHAR/etc.), thus receive the 8-bit character code then internally convert it to Unicode. 9x-compatibility is required, so using most Unicode APIs is not an option. Currently it looks at the language returned by PRIMARYLANGID(GetKeyboardLayout(0)), and loo...

Native Linux app to edit Win32 PE like ResHacker

Hi, I want to run a auto modify .dll service, users submit a specific .dll, I modify it on the server, then user can download modified version of the .dll. Are there any native Linux app that provide common Win32 PE modification capabilities like Icons, Strings, Accelerators, Dialogues, etc. which at least provide a commandline or script...

Does the POSIX module in the standard Perl distribution work in Win32/64?

I was wondering whether using POSIX.pm would make my Perl code less cross platform. From reading the documentation it's not very clear how well it's supported on Win32/64 Perl implementations. Is it wise to rely use POSIX.pm if one cares about portable code? ...

wait for works item to complete pooled using QueueUserWorkItem (not .NET)

I have some work items pooled using the legacy QueueUserWorkItem function (I need to support OSs earlier than vista, so for( <loop thru some items >) { QueueUserWorkItem( ) } I need to wait on these before proceeding to the next step. I've seen several similar answers...but they are in .NET. I'm thinking of using a storing an E...

Under which circumstances does the System process (PID 4) retain an open file handle?

My application running on a Windows server makes use of a Jet/Access database. For some reasons around every two weeks that database file gets locked by the System process (PID 4, seems to be fixed) After some googling I found some other users having their files locked by that special process, but different files (of course). What's t...

On Windows, using C++, is there a way to tell an application to safely exit?

Right now, I'm using: TerminateProcess(pi.hProcess, 0) ... but this doesn't allow the application to clean up. Our application has a wndProc function, but when I send WM_CLOSE... PostThreadMessage(pi.dwThreadId, WM_CLOSE, 0, 0); The function doesn't seem to be getting the message. pi is of type: PROCESS_INFORMATION ...

Transparent window containing opaque text and buttons

I'm creating a non-intrusive popup window to notify the user when processing a time-consuming operation. At the moment I'm setting its transparency by calling SetLayeredWindowAttributes which gives me a reasonable result: However I'd like the text and close button to appear opaque (it doesn't quite look right with white text) while k...

How would I handle a close request for in a non-windowed application?

I'm working on a C++ Windows application, that runs as a process but not a windowed application (does not have WndProc). It has it's own message loop, which is used to process a quit message, and that's how we safely exit the application from within it's self. What I want to do is somehow send a message to the process from another proce...

How can I make a hidden, disposable console application and communicate with it?

I've written a small console application to wrap a third-party DLL that has issues. I am calling it from a GUI application using _popen, and just want to read a value from the console program's standard output. In doing so, an undesirable console window is briefly displayed. I am aware that this can be avoided by using a certain STARTUP...

How to adjust the brightness of the screen on notebook displays

I have a slide bar to adjust the brightness of the screen on notebook displays in my application, but I found those articles from internet are adjusting the Gamma value, the behavior is not really like pressing the special key in keyboard. Is there a way to do it? Thanks in advance. Here is some links what I found. http://www.codeproj...

Resolve Windows drive letter to a path (subst and network)

I wonder if there is a universal way of resolving a path using a drive letter (such as X:\foo\bar.txt) into its equivalent UNC path, which might be one of the following: X:\foo\bar.txt if X: is a real drive (i.e. hard disk, USB stick, etc.) \\server\share\foo\bar.txt if X: is a network drive mounted on \\server\share C:\xyz\foo\bar.txt...

Drag and Drop to taskbar notification area with WinApi

Is it possible to implement drag and drop behavior in the notification area of the windows taskbar? Like having the icon there that can monitor something dragged and dropped on it. I suppose it should be a little bit tricky (if ever possible) ...

CPU consumption equivalent for harddisk scanning.

I would like my software that scans disk structure to work in background but lowing the priority for the thread that that scans disk structure doesn't work. I mean you still have the feeling of the computer hard working and even freezing even if your program consumes only 1 percent of the processor time. Is it possible to implement "hard...

Reading binary files without buffering the whole file into memory in C++

Hi, In order to make a binary comparer I'm trying to read in the binary contents of two files using the CreateFileW function. However, that causes the whole file to be bufferred into memory, and that becomes a problem for large (500MB) files. I've looked around for other functions that'll let me just buffer part of the file instead,...

Native equivalent of NetworkChange class; how to spot IP address changes in Windows

Is there a native Windows API which does the same as the .NET System.Net.NetworkInformation.NetworkChange class? Basically I'm looking for something to report changes to connectivity and IP address changes. ...

What benefit does MSDN article on CoRevokeClassObject talk about?

MSDN article on CoRevokeGetClassObject() says that when the COM server calls it the class object referenced by clients is not released. Then the following comes: If other clients still have pointers to the class object and have caused the reference >count to be incremented by calls to IUnknown::AddRef, the reference count will not be...

Closing and immediately re-opening a COM port fails: Why?

I'm trying to do 'pre-flight checks' by testing a COM port's 'openability' before launching a dialog window which allows the user to do com-porty things. Here's the code sequence, in outline: handle = CreateFile("\\\\.\\COM4:", GENERIC_READ | GENERIC_WRITE, 0,NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED,NULL); if (handle != INVALID_HANDL...

Jump to listbox item by typing first few characters

I have a list of items (potentially large) from which the user must select one. I'd like to allow the user to type the first few letters of the desired item to jump to the correct place in the list. By default, each keypress jumps to the first item starting with that letter, so you can't type the first several letters. Is there any st...