winapi

How to record wav sound from mic using Windows API?

How to record wav sound from mic using Windows API? ...

GetProfileInt... where in the registry?

Hi all, Simple question, if someone happens to know the answer. I'm maintaining an old Windows app; it uses GetProfileInt to retrieve a setting. Documentation says it reads "from the registry". Whereabouts? I know on older OSs, it read from win.ini. Where do the win.ini-type entries get stored in the registry? Thanks, Laure ...

I'm a Windows Forms\WPF developer. Should I read Petzold's Programming Windows (the C language one) book?

I'm a C# developer working with either Windows Forms or WPF. Sometimes I have to deal with unmanaged code, which I don't like. I think that the main reason why I dislike this is ignorance. I don't know the underlying Win API. I think that I'm not the only person who has negative feelings against unmanaged Windows code. Question: Should...

Should I use GetProcAddress or just include various win32 libraries?

Wonder what the difference between: static PROCESSWALK pProcess32First=(PROCESSWALK)GetProcAddress(hKernel,"Process32First"); ... pProcess32First(...); and #include <Tlhelp32.h> ... Process32First(...); What are the differences, I wonder which I should use. Is there any difference in terms of best practices then? ...

CreateRemoteThread 32->64 and/or 64->32

I need a way to CreateRemoteThread in x64 windows into both 64 and 32 bit processes. I've worked out how to find instruction set of target process, how to allocate memory in the target process for the assembly sled, and I've almost worked out what to do about address space randomization. I don't know how to actually start the thread on ...

How do I use a third party dll in Visual Studio C++?

I understand that I need to use LoadLibrary(). But what other steps do I need to take in order to use a third party dll? I simply jumped into C++ and this is the only part that I do not get (as a Java programmer). I am just looking into how I can use a Qt Library and tesseract-ocr, yet the process makes no sense to me and is so difficult...

How can I access a variable in a calling application from a dll?

I'm trying a little concept test to change one of the features of the logitech MS3200 keyboard (the zoom feature). I've got the keys that are sent from the zoom control. So, I have a main app, and a dll that contains a hook procedure. Here's the main app: #include <stdio.h> #include <windows.h> HANDLE hHook; int main() { HINSTAN...

How can I simulate key presses to any currently focused window?

I am trying to change the keys my keyboard sends to applications. I've already created a global hook and can prevent the keys I want, but I want to now send a new key in place. Here's my hook proc: LRESULT __declspec (dllexport) HookProc(int nCode, WPARAM wParam, LPARAM lParam) { int ret; if(nCode < 0) { return CallNex...

How to detect if my application is running in a virtual machine?

How can I detect (.NET or Win32) if my application is running in a virtual machine? ...

Best way of getting path to "Application Data" directory?

There are several possible ways of getting the path to the application data directory: using the %APPDATA% environment variable calling SHGetFolderPath with CSIDL_APPDATA What is the best way to get the path from within an program? Are there any gotchas when I use the environment variable? Which method is safest across XP, Vista and...

Which api functions to install a file system driver in Windows?

I want to install a driver for Ext2 partitions under Windows XP, the installation will be done with a self written Inno Setup script. Which API functions do I need to call for this? From what I googled so far I don't seem to be needing an inf file, and therefore no call to SetupCopyOEMInf. But I don't know what to do instead... Please e...

Pinvoke call for getting the windows serial number?

The normal way to get the windows serial number is WMI. ManagementObjectSearcher mos = new ManagementObjectSearcher("Select * From Win32_OperatingSystem"); // ... // Select number from managementobject mo["SerialNumber"] I don't want to use WMI because the compact framework dosn't support it. The assembly must work on the desktop a...

How to debug file change notifications obtained by FindFirstChangeNotification?

So, the question is: I get some notifications I don't want to get. But I don't know for what file/dir I got them. Is there a way to know why given notification was fired? If you think about ReadDirectoryChangesW, please include a meaningful code sample. ...

How to programmatically open control panel?

How do I open a custom control panel programmatically, like custom.cpl? Specifically, how do I open a 64-bit cpl when running as 32-bit application? ...

How do I run a Perl script in background on Windows?

I have a Perl script that pops up a message box when its work is done. How can I run this in the background? I looked at Proc::Background but this requires launching a specific command. I'd like my code to run in the background with out spawning a new process if possible. ...

WinAPI and UTF-8 support

Quick question regarding UTF-8 support and various Win32 API's. In a typical C++ MFC project, is it possible for MessageBox() to display a UTF-8 encoded string? Thanks, Andrew ...

Interprocess communication between 32- and 64-bit apps on Windows x64

We'd like to support some hardware that has recently been discontinued. The driver for the hardware is a plain 32-bit C DLL. We don't have the source code, and (for legal reasons) are not interested in decompiling or reverse engineering the driver. The hardware sends tons of data quickly, so the communication protocol needs to be pretty...

How to know the computer is idle now?

Is there any Win32 API to know if the computer is idle or not? ...

Win32 API For Shutting Down Another Process Elegantly?

I'm looking for a way to shutdown a windows app from another. Is there a way to do this? Ideally I'd like something that basically mimics an ALT-F4, or pressing the 'X' in the top right corner or some such. Alternatively, is there an application out there that does this already? tskill is a bit too harsh for what I have in mind. ...

How relevant is Win32 programming to modern professionals?

As a big fan of Charles Petzold's books Code and The Annotated Turing I came across his book Programming Windows which teaches Win32 programming in C. I am a freshman computer science student who learned C first, but I use C# and .NET for Windows programming now, so I was wondering if Win32 is still relevant to professional Windows progr...