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
40
votes
6 answers

Win32: full-screen and hiding taskbar

I have a window, which I SetWindowPos(window, HWND_TOP, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), SWP_FRAMECHANGED); It covers the whole screen, ok, but it takes a while (0.5 sec) to cover the taskbar as well. Is there a…
Lars Kanto
  • 685
  • 2
  • 10
  • 15
40
votes
2 answers

What are the differences between BringWindowToTop, SetForegroundwindow, SetWindowPos etc.?

BringWindowToTop, SetForegroundWindow, SwitchToThisWindow, SetWindowPos, ShowWindow all are described as showing and activating a window. What are the real differences between them? When and why would BringWindowToTop be preferred to…
Chris Becke
  • 34,244
  • 12
  • 79
  • 148
40
votes
3 answers

How do I add a manifest to an executable using mt.exe?

I'm trying to use mt.exe from the Windows SDK to add a manifest to an executable file that doesn't have one, using the following command line: C:\winsdk61>mt.exe -nologo -manifest "r:\shared\hl.exe.manifest"…
Colen
  • 13,428
  • 21
  • 78
  • 107
40
votes
1 answer

Code analysis says Inconsistent annotation for 'wWinMain' : this instance has no annotations

I'm writing some simple win32 stuff and I'm using the following wWinMain int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow) VS2012 express code analysis says C28251 Inconsistent…
EddieV223
  • 5,085
  • 11
  • 36
  • 38
40
votes
15 answers

Setting the initial directory of an SaveFileDialog?

I'd like a SaveFileDialog with the following behavior: The first time you open it, it goes to "My Documents". Afterwards, it goes to the last selected folder. What's the best way to accomplish this? If I don't set the InitialDirectory, it goes to…
tom greene
  • 5,361
  • 9
  • 39
  • 52
39
votes
6 answers

detecting idle time using python

How do I detect if the system is idle on Windows using Python (i.e. no keyboard or mouse activity). This has already been asked before, but there doesn't seem to be a GetLastInputInfo in the pywin32 module.
Badri
  • 2,212
  • 3
  • 25
  • 26
39
votes
6 answers

Can a Win32 console application detect if it has been run from the explorer or not?

I have to create a console application which needs certain parameters. If they are missing or wrong I print out an error message. Now the problem: If someone starts the program from the explorer by double-clicking the console window disappears…
Daniel Rikowski
  • 71,375
  • 57
  • 251
  • 329
39
votes
7 answers

System Error. Code: 8. Not enough storage is available to process this command

We have a few Win32 applications (coded in Delphi 2006) where sometimes the user gets an error message saying "System Error. Code: 8. Not enough storage is available to process this command.". From the stacktrace it looks like it is always during…
Marius
  • 2,494
  • 6
  • 31
  • 41
39
votes
4 answers

Windows API: ANSI and Wide-Character Strings -- Is it UTF8 or ASCII? UTF-16 or UCS-2 LE?

I'm not quite pro with encodings, but here's what I think I know (though it may be wrong): ASCII is a 7-bit, fixed-length encoding, with the characters you can find in ASCII charts. UTF8 is an 8-bit, variable-length encoding. All characters can be…
user541686
  • 205,094
  • 128
  • 528
  • 886
39
votes
14 answers

Show touch keyboard (TabTip.exe) in Windows 10 Anniversary edition

In Windows 8 and Windows 10 before Anniversary update it was possible to show touch keyboard by starting C:\Program Files\Common Files\microsoft shared\ink\TabTip.exe It no longer works in Windows 10 Anniversary update; the TabTip.exe process is…
EugeneK
  • 2,164
  • 1
  • 16
  • 21
39
votes
2 answers

LocalAlloc Vs GlobalAlloc Vs malloc Vs new

I have searched for this on various links, but still the doubt persist. I do not understand the difference between LocalAlloc vs GlobalAlloc vs malloc vs new for memory allocation. I have gone through this link of MSDN: Comparing Memory Allocation…
User1234
  • 1,543
  • 4
  • 22
  • 32
39
votes
4 answers

Add browser action button in internet explorer BHO

So. I'm working on a BHO in IE and I want to add a browser action like this: In internet explorer it would look something like The only tutorials and docs I've found were on creating toolbar items. None mentioned this option. I know this is…
Benjamin Gruenbaum
  • 270,886
  • 87
  • 504
  • 504
39
votes
6 answers

Wiggling the mouse

OK. This is a bit of a vanity app, but I had a situation today at work where I was in a training class and the machine was set to lock every 10 minutes. Well, if the trainers got excited about talking - as opposed to changing slides - the machine…
Bruce the Hoon
  • 1,666
  • 3
  • 18
  • 21
39
votes
2 answers

Find process id by window's handle

I have a problem with getting a specific PID of a process, the problem with this process is that it's a hidden process, it's not showing on task manager / PowerShell, completely hidden. What I have so far is the main window handle of this process,…
Amit Shadadi
  • 617
  • 2
  • 7
  • 20
39
votes
3 answers

How to copy string to clipboard in C?

The SetClipboardData function requires a HANDLE reference; I'm having trouble converting my string for use in the function. Here is my code: char* output = "Test"; HLOCAL hMem = LocalAlloc( LHND,1024); char* cptr = (char*) LocalLock(hMem); memcpy(…
unknown