winapi

Passing NT handles through DCOM

Is it possible to pass a raw NT handle (eg, to an event object) via a DCOM call - on the local machine, of course. If so, how would one go about doing so? ...

find out the keyboard shortcuts of a window programmatically

is there a way to find out what keys is a window listening for (preferably Windows)? or at least the menu Alt-keys? ...

RegisterHotKey API issue - not releasing when application is closed.

I am having the same as this. http://win32apiforum.com/topic.php?f=15&t=17 I used RegisterHotKey API to provide hot keys for certain events. Key combination Ctrl+C is registered successfully and my application works fine. If I don’t close my application and run another application (such as Notepad or Microsoft Word) where Ctrl+C ke...

Is there a pocket reference book for winapi?

I'm told that Programming Windows (Charles Petzold) is the most recommended full text for using C++ in the Windows API, but is there an O'Reilly-like pocket reference equivalent? ...

How to stop a process using a "Stop Button"

Hi, I created a simple window with two buttons, the first one calls a function that lasts a long time, the second one sets the value of a variable "stop" to TRUE, that was initially set to FALSE. My intention is that, by pressing the first button it runs a long process, that controls if the stop variable is set to TRUE or FALSE for ever...

windows - sendmessage

I'm calling a subroutine form the WndProc function in a windows app. WndProc was called from the message processing loop when a button was pushed. The subroutine takes a fair amount of time to run so it sends periodic messages using SendMessage(WM_USER). These messages should cause screen updates. Unfortunately, the updates are all h...

Enumerating Windows "log-in screen" user accounts in VB6

I am attempting to retrieve the log-in accounts that are actually visible when Windows first loads (XP, Vista and 7). I am able to enumerate all accounts (thanks to this code: freevbcode.com), however this particular function enumerates all system user accounts (Administrator, Guest, HomeGroupUser$, LogMeInRemoteUser, etc.) whether they...

Using <urlmon.h> and URLDownloadToFile to get HTTPS Web Resources

All, I am making a programming that will be able to download content from various websites on and off of my local network.To do this, I must use the libs and c++ for compatibility reasons. So far I have been able to successfully access a normal HTTP page, and an HTTPS page on the web. Example: HRESULT res = URLDownloadToFile( NULL, ...

Delphi notification when a file gets updated

Hi All, My app contains documents in its database. The users can open the documents in which case, the document gets saved to a temporary folder and gets opened on the user's computer. I'd like to get a notification when one of these temporary files are changed, and offer the user to save the changed document back to the database. Wha...

Decode wav file into raw on win32

How can I decode a wav file (RIFF) containing PCM data on Windows into raw samples (so that I can feed it to ASIO) on win32? I don't have time to reinvent the wheel. If there's a library out there that does the whole "play a wav file into ASIO" thing at once, that would be nice. ASIO is simple enough, though, and has many examples for...

Setting FILE_ATTRIBUTE_DEVICE in Visual Studio

Hello, I would like to know whether it is possible to call a CreateFile Function in Visual C++ to create a file with attribute FILE_ATTRIBUTE_DEVICE (0x00000040 hex, 64 decimal). According to the MSDN API, FILE_ATTRIBUTE_DEVICE is reserved and therefore I cannot use it, but I know there must be some way to create a file with such attrib...

Lock file but allow usage by current process?

I want to be able to lock a file in Win32 so that it can only be used by my current process. The most obvious way to accomplish that seemed to be via CreateFile: HANDLE file = ::CreateFile("c:\\foo.txt", GENERIC_READ | GENERIC_WRITE, 0, NULL, ...

How to map a file offset in an EXE to its PE section

I've opened up a program I wrote with ImageHlp.dll to play around with it a little, and I noticed that there seem to be large gaps in the file. As I understand it, for each PE section, the section header gives its offset in the file as PhysicalAddress, and its size as SizeOfRawData, and thus everything from PhysicalAddress to PhysicalAd...

Using undocumented classes in C++

I'm in the process of reverse-engineering a Windows executable. I found a class that I want to use from some code that I inject into the executable (different thread, own stack). How would I go about declaring such a class, given method addresses and member variables structure? For instance, let's say I found a class called foo, with it...

How can I add a watermark or png or bitmap to the background of a CTreeCtrl?

I would like to have a background image for a list control (CTreeCtrl). Is this possible and how can I do it? (This is for a Visual Studio 2008 C++ mfc app) ...

msdn CM_GET_Parent Example Doesn't Work

I am working on getting the device id from the usb device i plug... The above application works on win-Xp but not in Windows 7 When i try to figure it i found that CM_Get_Parent () not works... can anybody please guide me on why its not working ...and is there any compatible function which can work on windows 7 source code: HDEVINF...

Using Win32::API to accessing the methods of a DLL in Perl

I have in my possession a Microsoft Powershell script which examines all the files in a folded ending in .wtv (Windows Media Center recorded TV programmes), extracts some metadata (using a DLL called "Toub.MediaCenter.Dvrms.dll") and then writes it to stdout: [void][System.Reflection.Assembly]::LoadFile("C:\Toub.MediaCenter.Dvrms.dll") ...

PeekMessage problem

Hi, I tried to test the "Examining a Message Queue" example in this page: http://msdn.microsoft.com/en-us/library/ms644928(VS.85).aspx In order to test it I created a simple window with an edit control and some buttons, but it doesn't work as I expected, It should Display repeatedly the string "Some Text" in the EditControl until I ...

Help with Hardware ID

I'm using C# and .NET 2.0. My app needs some way to check the different users so I'll use hardware id, but I saw that I can use only: mac address - easily changeable and not everybody have it // NO processor id - using WMI it returns a value for the cpu model, it's not unique // NO motherboard serial - not every motherboard have it // ...

Proper handling of GetLastError (and others) in a multithreaded context.

Is it correct to assume that GetLastError (and variants) are per-thread or is it per-process? The problems if it is per-process are somewhat obvious in multithreaded apps because there is no way to guarentee that no other Win32 calls were made between your failed call and GetLastError. Sometimes the value of GetLastError is important. ...