winapi

How to list physical disks?

How to list physical disks in windows? In order to obtain a list of "\.\PhysicalDrive0" available. ...

Monitoring a displays state in python?

How can I tell when Windows is changing a monitors power state? ...

Setting monitor power state in python?

How can I send a monitor into/out-of a different power state (like sleep)? ...

Get machine properties

Hi, I would like to write a program that will identify a machine( for licensing purposes), I tought about getting the following information and to compile an xml file with this data: MAC address. CPU data (serial, manufacture, etc) MotherBoard Identification. (serial, manufacture, etc) can someone refer me to a lib that provide such...

A good book to understand WinAPI programming?

I have a course at university where we are learning WinAPI programming. As I know C++ a bit, I must say that it is rather hard to deal with WinAPI - all these functions, structures, old-style casts, etc. But at the same time, I think that a good book can make every difficult moment easy to learn. My question actually consists of: Wha...

CComPtr CoCreateInstance() fails

I have a COM .dll registered successfully with regsvr32 but somehow CoCreateInstance() fails to create one of its interfaces. Is there a freeware tool which can determine the reason for the failure? ...

How to get serial number from hard disks?

Is there an easy way to get the serial number of all the hard disks in a PC using the Win32 API? ...

Windows threading: _beginthread vs _beginthreadex vs CreateThread C++

What's a better way to start a thread? I'm trying to determine what are the advantages/disadvantages of _beginthread, _beginthreadex and CreateThread. All of these functions return a thread handle to a newly created thread, I already know that CreateThread provides a little extra information when an error occurs (it can be checked by c...

Common C# source code for Windows and Windows Mobile

I have a goal to build an application with UI that would run on both Windows Mobile and "normal" desktop Windows. The priority is for it to "look good" under Windows Mobile, and for desktop Windows it is OK if it distorted. Before I invest days trying, I would like to hear if that is possible to begin with. There are several parts to thi...

Get active window without global hooks or polling GetActiveWindow?

How can I get notifications about what is the currect active window and when this changes without polling GetActiveWindow or using global hooks? I don't like polling, and I'm working in C# and global hooks don't work (mostly). ...

Calling NT function on pre-NT system

So I don't do a lot of Win32 calls, but recently I have had to use the GetFileTime and SetFileTime functions. Now although Win98 and below are not officially supported in my program people do use it there anyway, and I try to keep it as usable as possible. I was just wondering what will happen as those functions do not exist in pre-NT sy...

to use a library dll with LoadLibrary() method on C++

Can I use LoadLibrary method for to import a data of type struct?? excuse me for my English. thanks. ...

Windows system cache and huge files.

Hi, i have a problem with windows system cache. Sample code: int main(int argc, char* argv[]) { HANDLE file_ = INVALID_HANDLE_VALUE; file_ = CreateFile( "test_file.txt", GENERIC_WRITE, FILE_SHARE_READ, 0, ...

How to run arbitrary code when windows resumes from hibernate?

Hi All, I need to run some code when my computer resumes from hibernate (even before I logon). The laptop I am using has a bizzare problem. If I have an external monitor connected to it while resuming from hibernate the laptop chooses the external display as the main video device and the laptop screen remains blank. This becomes more fr...

GUI App with Visual C++ Express Edition

What tool (preferably free) can be used with Visual C++ 2008 Express Edition to create Win32 GUI applications? As you know the Express Edition does not include a GUI resource editor. ...

c++ modify resources at runtime

Is it possible to edit resources for an executable at runtime programmatically? If so, how? If not, is there another program that can easily be used to modify resources? Thanks, Derek. ...

Asynchronous ReadDirectoryChangesW()?

I want to monitor the modifications in a specified directory, and retrieve the exact change information. So I've decided to use the ReadDirectoryChangesW() function. But I want to use it asynchronously, which means I don't want my worker thread to be blocked if there's no changes in the directory. How can I do this? Thank you! ...

What is the C++ equivalent to GetObject in JavaScript and VBScript?

What is the C++ equivalent to GetObject in JavaScript and VBScript? The closest match I found to my question is: http://codewiz51.blogspot.com/2008/06/vb-script-getobject-c-api-cogetobject.html However the sample use an unexisting interface and asking for the IUnknown returns null. Did someone have an example that works? ...

::FindWindow fails from Service application

Windows API ::FindWindow function fails when called from Service application. GetLastError() also returns 0 (success?). Is this some privilege\access right problem? Do you think it's design problem and I should use another IPC method? ...

Web service can't open named pipe - access denied

Hi All, I've got a C++ service which provides a named pipe to clients with a NULL SECURITY_ATTRIBUTES as follows: hPipe = CreateNamedPipe( lpszPipename, PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT, PIPE_UNLIMITED_INSTANCES, BUFSIZE, BUFS...