Questions tagged [winapi]

The Windows API (formerly called the Win32 API) is the core set of application programming interfaces available for the Microsoft Windows operating systems. This tag is for questions about developing native Windows applications using the Windows API.

The Windows API, informally WinAPI, is Microsoft's core set of application programming interfaces (APIs) available in the Microsoft Windows operating systems. It was formerly called the Win32 API; however, the name Windows API more accurately reflects its roots in 16-bit Windows and its support on 64-bit Windows. Almost all Windows programs interact with the Windows API. You can find more help on the Windows API Documentation.

The Windows API (Win32) is primarily focused on the C programming language in that its exposed functions and data structures are described in that language in recent versions of its documentation. However, the API may be used by any programming language compiler or assembler capable of handling the (well defined) low level data structures along with the prescribed calling conventions for calls and callbacks.

42239 questions
10
votes
1 answer

Why is my TB_INSERTBUTTON message causing comctl32 to throw?

I'm trying to add an additional button into a toolbar in Internet Explorer. I assumed the implementation to be straight forward, and am currently using this code: TBBUTTON buttonToAdd; ZeroMemory( &buttonToAdd, sizeof( TBBUTTON )…
Oliver Salzburg
  • 21,652
  • 20
  • 93
  • 138
10
votes
1 answer

How to set the size of the Non-client area of a Win32 window (native)

How to set the size of the Non-client area of a Win32 window (native). What I want is to make the CAPTION/TITLE bar THICKER. I've read and been told that I should handle WM_NCCALCSIZE but I can't find nothing clear on the documentation. From MSDN:…
noripcord
  • 3,412
  • 5
  • 29
  • 26
10
votes
1 answer

.NET wrapper for Windows API functionality

Does anyone know of a .NET managed wrapper around Windows API functionality that is not available in the .NET framework itself? Areas such as window creation and display styles, common UI control manipulation, keyboard/mouse input, file and disk…
Ash
  • 60,973
  • 31
  • 151
  • 169
10
votes
2 answers

Alias for function

I want to import some functions from kernel32.dll, but I want to use different names. Example function: [DllImport("kernel32.dll")] private static extern bool ReadProcessMemoryProc64 (...); private static bool BetterReadableAndWriteableName (...)…
Cubi73
  • 1,891
  • 3
  • 31
  • 52
10
votes
1 answer

Describing dynamically generated code with RtlAddFunctionTable on Windows x64

My application (written in Delphi, but that doesn't really matter) generates chunks of code dynamically (it contains a built-in compiler). In order to let exceptions on Windows x64 work correctly, I need to describe the generated functions via…
Frederik Slijkerman
  • 6,471
  • 28
  • 39
10
votes
0 answers

Programmatically execute Windows Explorer context menu items

Is there a consistent, foolproof way to get at the context menu items that Explorer shows when I right click on an item? I don't want to show a menu, I just want to parse the items in the background and execute them programmatically. I've tried…
jgraves
  • 477
  • 4
  • 9
10
votes
5 answers

How do I detect when output is being redirected?

I have a Win32 application written in C that can have its console output via printf() redirected to a log file. It would be nice if I could have my app. detect if it had been started with or without a redirect '>'. Any ideas?
logout
  • 187
  • 3
  • 13
10
votes
2 answers

winapi BN_CLICKED how to identify which button was clicked?

I'm creating a simple win32 program using c++, although I think i'm only using c in this app. I need to determine which HWND button was pressed on the app. I've searched msdn reference and it only told me HIWORD is the notification code, and LOWORD…
Vince
  • 2,596
  • 11
  • 43
  • 76
10
votes
1 answer

In what thread does a low-level mouse and keyboard hook callback run?

I'm setting a low-level mouse hook with SetWindowsHookEx: HANDLE handle = SetWindowsHookEx(WH_MOUSE_LL, &callback, GetModuleHandle(NULL), …
Thomas
  • 174,939
  • 50
  • 355
  • 478
10
votes
8 answers

What is the best way to wait for a variable in a multithreaded application

I would like to do something like the below for a multi-threaded program: // wait for variable to become true but don't hog resources // then re-sync queues Is something like this a good solution? while (!ready) { Thread.Sleep(250); //…
T.T.T.
  • 33,367
  • 47
  • 130
  • 168
10
votes
4 answers

Issue with SetForegroundWindow in .NET

I'm using SetForegroundWindow API in .NET using PInvoke. When I use the API while debugging in Visual Studio its works perfectly. But it doesn't work always when the application is running normally. I put some logs just before a call to…
Aster Veigas
  • 866
  • 3
  • 13
  • 34
10
votes
1 answer

How to verify that my orgainization signed a trusted windows binary?

This is a followup question to question 1072540, 'WinVerifyTrust to check for a specific signature?'. I want to write a C++ function Lets call it TrustedByUs of the form: bool TrustedByUs(std::string pathToBinary, std::string pathToPublicKey) The…
Jim In Texas
  • 1,524
  • 4
  • 20
  • 31
10
votes
3 answers

How to disable push button - Win32 API

I creating a program, i need : after click Button A, do something, and disable button A (mean that button is selected, not to be continue clicked !) I see MSDN this page:…
VanPers
  • 339
  • 3
  • 6
  • 12
10
votes
1 answer

Get size of volume on Windows

I'm writing a library to extract information about physical disks, partitions, and volumes on a Windows system (XP or later). I'm trying to get the capacity of a volume. Here are the approaches I know about and the reason each…
Ben Voigt
  • 277,958
  • 43
  • 419
  • 720
10
votes
4 answers

How can I get the path of a Windows "special folder" for a specific user?

Inside a service, what is the best way to determine a special folder path (e.g., "My Documents") for a specific user? SHGetFolderPath allows you to pass in a token, so I am assuming there is some way to impersonate the user whose folder you are…
kgriffs
  • 4,080
  • 5
  • 37
  • 42