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

Color Management: Monitor profile changed notification for Windows?

The Short Version: I’m looking for the Windows API equivalent of the Cocoa – windowDidChangeBackingProperties: notification in the NSWindowDelegate protocol which is called when a window’s colorspace changes (when it’s moved to another monitor or…
Cutterpillow
  • 1,717
  • 13
  • 32
10
votes
2 answers

Tough question on WPF, Win32, MFC

Let's suppose you're an IT student with a basic knowledge of C++ and C#. Let's suppose that you want to design apps that: need to deliver some performance like archivers, cryptographic algorithms, codecs make use of some system calls have a…
Mack
  • 783
  • 1
  • 8
  • 13
10
votes
1 answer

Convert HANDLE to Handle

I want to create a annonymous pipe on windows using the CreatePipe of the WinAPI via the FFI. This will give me a HANDLE (type from the Win32 haskell package), but I'd like to get an ordinary haskell Handle such that I can use the standard haskell…
bennofs
  • 11,873
  • 1
  • 38
  • 62
10
votes
1 answer

Is it possible to determine the fonts Windows chooses for font-linking?

Suppose you have a string with text in two or more scripts. When you use a GDI function like TextOut, (modern versions of) Windows will do "font-linking". That is, GDI will draw what it can with your selected font and draw the rest in an…
Adrian McCarthy
  • 45,555
  • 16
  • 123
  • 175
10
votes
7 answers

Writing to the middle of the file (without overwriting data)

In windows is it possible through an API to write to the middle of a file without overwriting any data and without having to rewrite everything after that? If it's possible then I believe it will obviously fragment the file; how many times can I do…
Andreas Bonini
  • 44,018
  • 30
  • 122
  • 156
10
votes
2 answers

How to detect a client disconnect using a named pipe client/server?

I'm learning about named pipes and was playing with the named pipe client and server examples from the MSDN doc: Named Pipe Server Named Pipe Client I modified the client so I can type in messages to the console and have them sent to the server…
Robert Groves
  • 7,574
  • 6
  • 38
  • 50
10
votes
2 answers

How to "safely" delete folder into Recycle Bin

I'm looking for a way to put a folder (with subfolders) into a Recycle Bin with these conditions: It must be done silently -- without any Windows UI. The folder must never be permanently deleted. If it can't be put into Recycle Bin, I'd expect the…
c00000fd
  • 20,994
  • 29
  • 177
  • 400
10
votes
3 answers

How to detect on C++ is windows 32 or 64 bit?

How to detect on C++ is windows 32 or 64 bit? I see a lot of examples in .Net but I need C++. Also IsWow64Process() dosen't works for me, becouse "If the process is running under 32-bit Windows, the value is set to FALSE. If the process is a 64-bit…
Ted
  • 1,682
  • 3
  • 25
  • 52
10
votes
1 answer

How to read the function parameters from call stack frames programmatically in Windows?

I was trying to walk through the call stack frames and extract some information from them. I am able to extract the file names, line numbers, and function names by using StackWalk64 , SymGetSymFromAddr64, and SymGetLineFromAddr64 APIs from…
stanleyli
  • 1,427
  • 1
  • 11
  • 28
10
votes
4 answers

How can I save HICON to an .ico file?

I am extracting an icon from .exe/.dll and want to save it in an .ico file. What is the best way to do this? I have tried to use ::OleCreatePictureIndirect() and then IPicture->SaveAsFile(). It works but transparent parts of the icon are painted…
MichaelY
  • 101
  • 1
  • 1
  • 3
10
votes
1 answer

How can I detect if a hard drive is spinning (under Windows)?

How can I programatically determine if a hard drive is currently spinning or not (Windows 7 or later)? I tried GetDevicePowerState() but it always returns TRUE (always 1, not another non-zero value) for drives that I know are currently not spinning…
Not Submitted
  • 653
  • 1
  • 7
  • 13
10
votes
4 answers

How to know if the user is using multiple monitors

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
Raphael
  • 7,972
  • 14
  • 62
  • 83
10
votes
6 answers

How to show a window that acts like a popup menu?

When window A is show, I want to show another none-modal popup window B, but: I don't want window A to become inactive due to window B becomes the front window; I want that when window B is focused, I pull down a combo box control on window A with…
Edwin Yip
  • 4,089
  • 4
  • 40
  • 86
10
votes
3 answers

How Do I Create a System.Drawing.Icon with Multiple Sizes/Images?

I would like to create a single System.Drawing.Icon programmatically from 32x32, 16x16 Bitmaps. Is this possible? If I load an icon with - Icon myIcon = new Icon(@"C:\myIcon.ico"); ...it can contain multiple images.
Damien
  • 1,463
  • 1
  • 18
  • 30
10
votes
1 answer

Windows XP memory management without pagefile - what are the consequences wrt. to heap fragmentation?

I've been looking into a rather elusive bug that we see in an application on a Windows XP embedded system. We've narrowed the bug down to a pointer that should be pointing to a block of memory, instead pointing to NULL. Since the memory is…
Matt C
  • 233
  • 1
  • 9