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
45
votes
5 answers

How do I store and retrieve credentials from the Windows Vault credential manager?

I want to securely store a plaintext password on Windows PC. I am currently using DPAPI CryptProtectData to encrypt it, then store the encrypted blob in a file in user's local AppData. In Windows 7, there is Windows Vault, a credential manager…
45
votes
3 answers

What is the difference between BOOL and bool?

In VC++ we have the data type “BOOL” which can assume the value TRUE or FALSE, and we have the data type “bool”, which can assume the value true or false. What is the difference between them and when should each data type be used?
Umesha MS
  • 2,861
  • 8
  • 41
  • 60
44
votes
6 answers

Hosting external app in WPF window

We are developing a layout manager in WPF that has viewports which can be moved/resized/etc by a user. Viewports are normally filled with data (pictures/movies/etc) via providers that are under our control in the layout manager. My job is to examine…
Stiggy
  • 459
  • 1
  • 5
  • 4
44
votes
2 answers

Scaling the non-client area (title bar, menu bar) for per-monitor high-DPI support

Windows 8.1 introduced the ability to have different DPI settings for different monitors. This feature is known as "per-monitor high-DPI support." It persists and has been further refined in Windows 10. If an application does not opt in (i.e., is…
Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
44
votes
4 answers

Why does the Win32-API have so many custom types?

I'm new to the Win32 API and the many new types begin to confuse me. Some functions take 1-2 ints and 3 UINTS as arguments. Why can't they just use ints? What are UINTS? Then, there are those other types: DWORD LPCWSTR LPBOOL Again, I think…
sub
  • 2,653
  • 3
  • 27
  • 29
44
votes
10 answers

Building libcurl with SSL support on Windows

I'm using libcurl in a Win32 C++ application. I have the curllib.vcproj project added to my solution and set my other projects to depend on it. How do I build it with SSL support enabled?
sharkin
  • 12,162
  • 24
  • 86
  • 122
44
votes
14 answers

How do I recursively create a folder in Win32?

I'm trying to create a function that takes the name of a directory (C:\foo\bar, or ..\foo\bar\..\baz, or \\someserver\foo\bar), and creates directories as necessary so that the whole path is created. I am attempting a pretty naive implementation of…
pauldoo
  • 18,087
  • 20
  • 94
  • 116
44
votes
11 answers

Symlinks on windows?

Does anyone know of a way to make/read symbolic links across versions of win32 from Python? Ideally there should be a minimum amount of platform specific code, as I need my app to be cross platform.
Harkonnen Jama
44
votes
5 answers

How can I get the child windows of a window given its HWND?

I have the handle for a given window. How can I enumerate its child windows?
Yuriy Faktorovich
  • 67,283
  • 14
  • 105
  • 142
44
votes
4 answers

Window application flash like orange on taskbar when minimize

I have a window application. When I minimize the window application on taskbar to work on another application. We hava a facility to send messages from one window application to another window application. So my first win application is minimized…
Hardik
  • 449
  • 1
  • 4
  • 3
43
votes
3 answers

Interrupt (NOT prevent from starting) screensaver

I am trying to programmatically interrupt the screensaver by moving the cursor like this: win32api.SetCursorPos((random.choice(range(100)),random.choice(range(100)))) And it fails with the message: pywintypes.error: (0, 'SetCursorPos', 'No error…
mortpiedra
  • 687
  • 4
  • 13
43
votes
5 answers

How to detect Windows 10 light/dark mode in Win32 application?

A bit of context: Sciter (pure win32 application) is already capable to render UWP alike UIs: in dark mode: in light mode: Windows 10.1803 introduces Dark/Light switch in Settings applet as seen here for example. Question: how do I determine…
c-smile
  • 26,734
  • 7
  • 59
  • 86
43
votes
1 answer

WinAPI: Create a window with a specified client area size

I was wondering how can I create a window using Win32 API with a specific client area size. When trying to create a window using the following piece of code, the entire window is 640x480, with the window's chrome taking some of the client area: HWND…
GeReV
  • 3,195
  • 7
  • 32
  • 44
43
votes
13 answers

Are there any downsides to using UPX to compress a Windows executable?

I've used UPX before to reduce the size of my Windows executables, but I must admit that I am naive to any negative side effects this could have. What's the downside to all of this packing/unpacking? Are there scenarios in which anyone would…
Mick
  • 13,248
  • 9
  • 69
  • 119
43
votes
2 answers

Skip window from being captured

I have created an AIR application which has two windows. First one is main window(spark Windowed Application) and the second one is a component(spark window). I am using Java to capture the Desktop screen with Flex-Java Bridge Flerry. Here is the…
Vishnu
  • 11,614
  • 6
  • 51
  • 90