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.

38350 questions
125
votes
9 answers

How to convert std::string to LPCWSTR in C++ (Unicode)

I'm looking for a method, or a code snippet for converting std::string to LPCWSTR
Toran Billups
  • 27,715
  • 39
  • 150
  • 262
122
votes
8 answers

Find out what process registered a global hotkey? (Windows API)

As far as I've been able to find out, Windows doesn't offer an API function to tell what application has registered a global hotkey (via RegisterHotkey). I can only find out that a hotkey is registered if RegisterHotkey returns false, but not who…
Marek Jedliński
  • 6,528
  • 9
  • 44
  • 55
121
votes
4 answers

Where to find the win32api module for Python?

I need to download it for Python 2.7, but can't seem to find it...
rectangletangle
  • 42,965
  • 86
  • 186
  • 264
120
votes
8 answers

How can a Metro app in Windows 8 communicate with a backend desktop app on the same machine?

In a situation where you have the UI frontend built using the new Metro style of apps for windows 8, and would like it to communicate with a .NET application running on the desktop on the same local machine (e.g. a windows service app). What forms…
dodgy_coder
  • 11,717
  • 10
  • 47
  • 63
120
votes
16 answers

Where can I find my .emacs file for Emacs running on Windows?

I tried looking for the .emacs file for my Windows installation for Emacs, but I could not find it. Does it have the same filename under Windows as in Unix? Do I have to create it myself? If so, under what specific directory does it go?
Ray
  • 169,974
  • 95
  • 213
  • 200
118
votes
12 answers

Check whether a path is valid

I am just wondering: I am looking for a way to validate if a given path is valid. (Note: I do not want to check if a file is existing! I only want to proof the validity of the path - So if a file could possibly exists at the location). Problem is, I…
Tobias Boschek
  • 1,972
  • 2
  • 17
  • 21
115
votes
8 answers

Adding external library into Qt Creator project

How can I add external library into a project built by Qt Creator RC1 (version 0.9.2)? For example, the win32 function EnumProcesses() requires Psapi.lib to be added in the project to build.
Donotalo
  • 11,954
  • 23
  • 75
  • 111
108
votes
4 answers

Exporting functions from a DLL with dllexport

I'd like a simple example of exporting a function from a C++ Windows DLL. I'd like to see the header, the .cpp file, and the .def file (if absolutely required). I'd like the exported name to be undecorated. I'd like to use the most standard calling…
Aardvark
  • 8,228
  • 7
  • 43
  • 63
107
votes
6 answers

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…
Matt Gutting
  • 1,071
  • 2
  • 8
  • 3
105
votes
15 answers

Generating a unique machine id

I need to write a function that generates an id that is unique for a given machine running a Windows OS. Currently, I'm using WMI to query various hardware parameters and concatenate them together and hash them to derive the unique id. My question…
HS.
  • 14,004
  • 8
  • 36
  • 46
104
votes
9 answers

How to make an OpenGL rendering context with transparent background?

Rendering contexts usually have a solid color on the background (black or whatever, see the image below): I'm wondering if it's possible to setup a window, with no decorations AND with the transparent background, while allowing me to render OpenGL…
karlphillip
  • 87,606
  • 33
  • 227
  • 395
104
votes
10 answers

How do I print to the debug output window in a Win32 app?

I've got a win32 project that I've loaded into Visual Studio 2005. I'd like to be able to print things to the Visual Studio output window, but I can't for the life of me work out how. I've tried 'printf' and 'cout <<' but my messages stay stubbornly…
izb
  • 45,586
  • 39
  • 110
  • 165
103
votes
8 answers

How to write hello world in assembler under Windows?

I wanted to write something basic in assembly under Windows, I'm using NASM, but I can't get anything working. How to write and compile hello world without the help of C functions on Windows?
feiroox
  • 2,801
  • 7
  • 29
  • 30
100
votes
10 answers

Is gettimeofday() guaranteed to be of microsecond resolution?

I am porting a game, that was originally written for the Win32 API, to Linux (well, porting the OS X port of the Win32 port to Linux). I have implemented QueryPerformanceCounter by giving the uSeconds since the process start up: BOOL…
Bernard
  • 43,502
  • 18
  • 52
  • 69
96
votes
8 answers

How to read a value from the Windows registry

Given the key for some registry value (e.g. HKEY_LOCAL_MACHINE\blah\blah\blah\foo) how can I: Safely determine that such a key exists. Programmatically (i.e. with code) get its value. I have absolutely no intention of writing anything back to the…
nolandda
  • 2,044
  • 2
  • 16
  • 19