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

Is there any benefit to use multiple heaps for memory management purposes?

I am a student of a system software faculty. Now I'm developing a memory manager for Windows. Here's my simple implementation of malloc() and free(): HANDLE heap = HeapCreate(0, 0, 0); void* hmalloc(size_t size) { return HeapAlloc(heap, 0,…
Netherwire
  • 2,669
  • 3
  • 31
  • 54
11
votes
5 answers

Faster method of reading screen pixel in Python than PIL?

Currently I'm using a pixel reader via AutoItv3 to perform some actions in a program that is running direct X; A game. Right now the program works fine but as an exercise I've been rewriting it in python. Right now I can do: import ImageGrab #…
ThantiK
  • 1,582
  • 4
  • 17
  • 31
11
votes
7 answers

C++: What's the simplest way to read and write BMP files using C++ on Windows?

I would like to load a BMP file, do some operations on it in memory, and output a new BMP file using C++ on Windows (Win32 native). I am aware of ImageMagick and it's C++ binding Magick++, but I think it's an overkill for this project since I am…
Eugene Yokota
  • 94,654
  • 45
  • 215
  • 319
11
votes
2 answers

how to use DrawText() to write text in a given window whose handle is known?

I want to know how to write text on a particular window starting at a given location in the window using the Windows API. For example if the coordinates within the window where the text is to be written are (x,y) = (40,10) then what do I need to do…
Vicky
11
votes
4 answers

How can I get functionality similar to Spy++ in my C# app?

I'm interested in working on a plugin for Keepass, the open-source password manager. Right now, Keepass currently detects what password to copy/paste for you based off of the window title. This prevents Keepass from detecting the current password…
anon
11
votes
5 answers

Win32: How to custom draw an Edit control?

i need to implement the functionality of EM_SETCUEBANNER, where a text hint appears inside an Edit control: The catch is that i cannot use version 6 of the Common Controls, which is what is required to get the Microsoft supplied implementation of a…
Ian Boyd
  • 246,734
  • 253
  • 869
  • 1,219
11
votes
6 answers

Win32: How to get the process/thread that owns a mutex?

I'm working an application of which only one instance must exist at any given time. There are several possibilities to accomplish this: Check running processes for one matching our EXE's name (unreliable) Find the main window (unreliable, and I…
Thomas
  • 174,939
  • 50
  • 355
  • 478
11
votes
1 answer

C1189: #error : "No Target Architecture"

I have the following error when compiling : c:\program files (x86)\windows kits\8.0\include\um\winnt.h(146): fatal error C1189: #error : "No Target Architecture" Anyway I do not use Windows Kit in my project (or I didn't see it was included). And…
user2764048
  • 121
  • 1
  • 2
  • 7
11
votes
1 answer

Maximum and minimum window sizes in WINAPI

I've found some more questions on StackOverflow about my topic. One of them is here. I have also read the Microsoft Documentation about MINMAXINFO and the message associated with this structure. I simply can't make it work... Here is what I've tried…
Victor
  • 13,914
  • 19
  • 78
  • 147
11
votes
3 answers

SendInput() not equal to pressing key manually on keyboard in C++?

I wanted to write a c++ code to emulate pressing a keyboard key "A": // Set up a generic keyboard event. ip.type = INPUT_KEYBOARD; ip.ki.wScan = 0; // hardware scan code for key ip.ki.time = 0; ip.ki.dwExtraInfo = 0; // Press the "..."…
PolGraphic
  • 3,233
  • 11
  • 51
  • 108
11
votes
3 answers

How to use GetWindowRect

Consider the following code: LPRECT lpRect; GetWindowRect(hwnd, lpRect); I don't know how to get information from lpRect; please advise.
user2662326
  • 159
  • 1
  • 1
  • 7
11
votes
1 answer

Understanding AttachThreadInput - detaching lose focus

i got a little problem fully understanding AttachThreadInput. I know it's "connecting" the message queue of 2 threads, which (what i want to do) allows me for example to force my window (winforms) in foreground. Which I can do with this…
Visions
  • 919
  • 1
  • 7
  • 17
11
votes
3 answers

How do I pump window messages in a nodejs addon?

In a Windows nodejs addon, I've created a window for the purpose of receiving messages. Handle MakeMessageWindow(const Arguments &args) { // exposed to JS ... CreateWindow(L"ClassName", NULL, 0, 0, 0, 0, 0, HWND_MESSAGE, 0, 0, 0); …
josh3736
  • 139,160
  • 33
  • 216
  • 263
11
votes
1 answer

How to add picture box in win32 API using visual c++

I have a Window (win32 API) Application in visual c++. I am not using MFC. I have to add a picutre box to my application and Change the image of this picture box periodically. Can any one help me out in achieving the above task? Thanks in advance.
Ravi shankar
  • 2,450
  • 1
  • 25
  • 34
11
votes
7 answers

DeleteFile fails on recently closed file

I have a single threaded program (C++, Win32, NTFS) which first creates a quite long temporary file, closes it, opens for read, reads, closes again and tries to delete using DeleteFile(). Usually it goes smoothly, but sometimes DeleteFile() fails,…
Dmitry Shkolnik
  • 323
  • 1
  • 3
  • 12