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
50
votes
4 answers

How to check if directory exist using C++ and winAPI

How do I check whether a directory exists using C++ and windows API?
MaSmi
  • 567
  • 1
  • 4
  • 5
50
votes
2 answers

Which Font is the default for MFC Dialog Controls?

The picture below (enlarged, so you better see the differences) shows Font differences between dynamically created Edit controls (the upper two examples) and Edit Controls created from the Dialog Editor (the lower example). How can I make the font…
Christian Ammer
  • 7,464
  • 6
  • 51
  • 108
50
votes
2 answers

Privileges/owner issue when writing in C:\ProgramData\

As pointed out in Writing config file in C:\Program Files (x86)\MyApp\myapp.cfg, vs. Administrator privilege, it is not a good idea to write a config file in C:\Program Files (x86)\MyApp\myapp.cfg. Instead of this, my software now saves its data in…
Basj
  • 41,386
  • 99
  • 383
  • 673
50
votes
5 answers

#define NOMINMAX using std::min/max

i recently added: #define NOMINMAX #include #include to my main.cpp in order to use std::max( x , x ); // x is just a placeholder and not actual anything std::min( x , x ); but i can't use std::max()/std::min() in other…
NaturalDemon
  • 934
  • 1
  • 9
  • 21
49
votes
2 answers

IntPtr, SafeHandle and HandleRef - Explained

Without pointing me to MSDN, could someone give a concise, clear explanation of the purpose of each of these and when to use them. (IntPtr, SafeHandle and HandleRef)
user62572
  • 1,388
  • 2
  • 15
  • 24
49
votes
8 answers

How to detect the current screen resolution?

How do I from Winapi (in C or C++) detect the current screen resolution? Some background: I want to start a new OpenGL fullscreen window, but want it open with the same horizontal and vertical size which the desktop already is set to. (Now when…
Prof. Falken
  • 24,226
  • 19
  • 100
  • 173
49
votes
9 answers

MSBuild on CI Server can't find AL.exe

I'm having a problem on my TeamCity CI build server where during compilation I get the following error: C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(2342, 9): error MSB3086: Task could not find "AL.exe" using the…
Tim Long
  • 13,508
  • 19
  • 79
  • 147
48
votes
4 answers

Best way to do non-flickering, segmented graphics updates in Delphi?

I thought I could just throw this out there and just ask: I have seen Delphi controls that are flawless in terms of graphical effects. Meaning: no flickering, sectioned updates (only redraw the section of a control that is marked as dirty) and…
Jon Lennart Aasenden
  • 3,920
  • 2
  • 29
  • 44
48
votes
10 answers

C++ #include is not found

When I compile my C++ program in Visual Studio Express it says that it can't find atlbase.h. Am I missing some SDK or something?
Ramilol
  • 3,394
  • 11
  • 52
  • 84
48
votes
1 answer

What is NetFx in the Windows SDK?

What is NetFx, in the context of the Windows SDK? What differentiates NetFx tools from the tools in the regular SDK bin directory? I noticed that the version of sgen.exe in C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\ was built against .NET…
sourcenouveau
  • 29,356
  • 35
  • 146
  • 243
47
votes
6 answers

Bringing Window to the Front in C# using Win32 API

I am writing an application that needs to bring window of an external app to the foreground, and not necessarily steal focus (there is a setting the user can toggle to steal/not steal focus). What is the best way to go about this using the win32…
adeel825
  • 5,677
  • 12
  • 40
  • 44
46
votes
2 answers

Rendering controls on glass: Solution found, needs double-buffering/perfecting

I (finally!) found a way of rendering Windows.Forms controls on glass that doesn't seem to have any major drawback nor any big implementation time. It's inspired by this article from Coded, which basically explains how to natively override the…
Lazlo
  • 8,518
  • 14
  • 77
  • 116
46
votes
12 answers

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?
Jason
  • 16,739
  • 23
  • 87
  • 137
46
votes
6 answers

How to gracefully terminate a process?

I want to terminate a number of processes, but I want to give each process the chance to save its data, ask the user about saving a file and even ignore the close request. So TerminateProcess is out of the question, because it kills the process…
Daniel Rikowski
  • 71,375
  • 57
  • 251
  • 329
46
votes
3 answers

How can a Windows service application be written in Haskell?

I've been struggling to write a Windows service application in Haskell. Background A service application is executed by the Windows Service Control Manager. Upon launching it makes a blocking call to StartServiceCtrlDispatcher which is supplied with…
Michael Steele
  • 15,512
  • 2
  • 23
  • 24