winapi

Scan computer memory

How to search given sequence of bytes in a computer memory? ReadProcessMemory API does not suit because it only reads process memory, not whole memory. Is there any existent solutions? ...

ruby win32api & structs (VerQueryValue)

I am trying to call the standard Win32 API functions to get file version info, using the win32-api library. The 3 version.dll functions are GetFileVersionInfoSize, GetFileVersionInfo, and VerQueryValue. Then I call RtlMoveMemory in kernel32.dll to get a copy of the VS_FIXEDFILEINFO struct (see Microsoft documentation: http://msdn.mic...

I can use SetWindowPos to place the window behind another window, but how do I place it in front of a given window?

SetWindowPosition second parameter is hWndInsertAfter which means behind. How do I place a window in front of another (above)? ...

How to know if the user is using multiple monitors

Hello, I'm trying to figure out a way to know if the user is using multiple monitors. I would like to know how to do this in native C++ (using the Win32 API) and with managed code (using the .NET Framework). Thanks in advance ...

Windows Routing API: What API calls are needed to build a managed version of route.exe for Windows?

In order to ensure we have the correct routes for various vpn connections, we typically run a batch file that calls commands similar to the following: route add xxx.xxx.xxx.xxx mask 255.255.255.0 yyy.yyy.yyy.yyy We have a C# application that uses the NetworkInterfaces class to listen for network events, and runs this command using the...

how to get process handle from process id?

I have process Id , I want to get its process handle. Is there any API available for that. I tried to use OpenProcess but it returns NULL, and GetLastError =0. This I am trying on Vista. I guess I need to enable SeDebugPrivilege before using OpenProcess . But for enabling SeDebugPrivilege I need to get its Process handle. ...

HID device info structure from GetRawInputData

Where can I get the structure for an HID device? For example: raw data from a device, using GetRawInputData: ( 0 137 117 0 146 130 24 128 0 ) ( 0 137 117 0 146 130 8 128 0 ) /\ at this I can see that || there is being a button released that means, at the 6-th char at 4-th bit By analyzing the...

What is a message pump?

In this thread (posted about a year ago) there is a discussion of problems that can come with running Word in a non-interactive session. The (quite strong) advice given there is not to do so. In one post it is stated "The Office APIs all assume you are running Office in an interactive session on a desktop, with a monitor, keyboard and ...

Win32: How to make drop shadow honor non-rectangular Layered window?

i've created a layered window by adding the the WS_EX_LAYERED extended style: wndClass.ExStyle = wndClass.ExStyle || WS_EX_LAYERED; The window will use black as the chroma key color value. i've left a large surround of black to make the problem obvious: After the window is constructed, i tell it to use black as a chroma-key color...

Is there a way in windows to know if a process is not responding?

Is there a way to know when a process is hung? is there a win32 call for this? ...

How do you have a window that has no icon in the tasktray?

I found the windows style WS_EX_TOOLWINDOW but this changes the title bar. Is there a way to not have the tasktray icon but keep the normal window titlebar? ...

tr1::function WINAPI

How can I use tr1::function with WINAPI calling convention ? (at least in windows). I can use visual c++ 9 SP1 TR1 or BOOST's one... typedef void (WINAPI *GetNativeSystemInfoPtr)(LPSYSTEM_INFO); HMODULE h = LoadLibrary (_T("Kernel32.dll")); GetNativeSystemInfoPtr fp = (GetNativeSystemInfoPtr) GetProcAddress (h,"GetNativeSystemInfo"); SY...

Executing a process normally from an elevated one

Is there some way to launch a process in non-elevated way from an elevated one. My setup is launched elevated and when it finalizes, it will just launch the main application. Because the setup is elevated, the main process will be elevated as well which is not desirable. What is the best solution to this? ...

What does LPCWSTR stand for and how should it be handled with?

First of all, what is it exactly? I guess it is a pointer (LPC means long pointer constant), but what does "W" mean? Is it a specific pointer to a string or a pointer to a specific string? For example I want to close a Window named "TestWindow". HWND g_hTest; LPCWSTR a; *a = ("TestWindow"); g_hTest = FindWindowEx(NULL, NULL, NULL, a);...

What is the best way to split up utility functions in a library to maximize reusability?

I have a recurring problem with a statically linked library I've written (or in some cases, code was accumulated from open sources). This library, MFC Toolbox Library by name, has a lot of free functions, classes, and so on which support MFC programming, Win32 API programming, as well as the venerable C-library and newer C++ standard li...

TCHAR[], LPWSTR, LPTSTR and GetWindow Text function

So the GetWindowText is declared on MSDN as follows: int GetWindowText( HWND hWnd, LPTSTR lpString, int nMaxCount ); However for the code to work we have to declare the second parameter as TCHAR[255] WTitle; and then call the function GetWindowText(hWnd,Wtitle,255); The LPTSTR is a pointer to an array of tchar, so...

Differences between visual component library(vcl) and WinApi

Is there any difference between using vcl components in Delphi and WinApi functions to create gui application. ...

Getting volume change notifications on Vista/7 (C++)

I'm trying to get notifications whenever the master volume changes on Windows Vista/7. This is the code I'm using: #include <audiopolicy.h> #include <audioclient.h> #include <mmdeviceapi.h> #include <endpointvolume.h> #include <windows.h> #include <shlwapi.h> #include <iostream> #include <Tchar.h> static const GUID AudioSessionVolumeCt...

Any language binding for MFC ?

THere are a lot of wrappers for toolkits like Qt, Cocoa or WxWidgets for D, Python, Ruby and other languages. I wonder if anyone has ever written a binding for MFC ? ...

Win32: BitTest, BitTestAndComplement, ... <- How to disable this junk?

WinNT.h has the following lines in it, in the VS2008 SP1 install: #define BitTest _bittest #define BitTestAndComplement _bittestandcomplement #define BitTestAndSet _bittestandset #define BitTestAndReset _bittestandreset #define InterlockedBitTestAndSet _interlockedbittestandset #define InterlockedBitTestAndReset _interlockedbittestandre...