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
7 answers

Win32: Registry entries required to register an ActiveX control?

i need write the code that runs when DllRegisterServer is called. i.e. when someone calls: regsvr32 myActiveX.ocx i'm trying to find the definitive list of required registry entries (rather than just what i can cobble together by spellunking…
Ian Boyd
  • 246,734
  • 253
  • 869
  • 1,219
11
votes
5 answers

How do I GetModuleFileName() if I only have a window handle (hWnd)?

I'm trying to get the name of the executable of a window that is outside my C# 2.0 application. My app currently gets a window handle (hWnd) using the GetForegroundWindow() call from "user32.dll". From the digging that I've been able to do, I think…
Pretzel
  • 8,141
  • 16
  • 59
  • 84
11
votes
5 answers

Form.Release + NIL

if Form.Release is called after using the form, it will free all related memory but not set the form variable to nil. if not assigned (Form1) then begin Application.CreateForm(Tform1, Form1); try // Do something finally …
Holgerwa
  • 3,430
  • 9
  • 42
  • 50
11
votes
5 answers

What are alternatives to Win32 PulseEvent() function?

The documentation for the Win32 API PulseEvent() function (kernel32.dll) states that this function is “… unreliable and should not be used by new applications. Instead, use condition variables”. However, condition variables cannot be used across…
Bill
  • 2,381
  • 4
  • 21
  • 24
11
votes
2 answers

Add drop shadow to ListView (Icon mode)?

If you look at the thumbnail images in Windows Explorer you'll notice that they have a drop shadow, is this effect associated with the ListView control or does Windows Explorer does some extra coding to accomplish this effect? Edit: So it turned…
user4182981
11
votes
2 answers

Creating a python win32 service

I am currently trying to create a win32 service using pywin32. My main point of reference has been this tutorial: http://code.activestate.com/recipes/551780/ What i don't understand is the initialization process, since the Daemon is never…
UberJumper
  • 20,245
  • 19
  • 69
  • 87
11
votes
1 answer

What is the PIXELFORMATDESCRIPTOR parameter in SetPixelFormat() used for?

Usually when setting up OpenGL contexts, I've simply filled out a PIXELFORMATDESCRIPTOR structure with the necessary information and called ChoosePixelFormat(), followed by a call to SetPixelFormat() with the returned matching pixelformat from…
Mads Elvheim
11
votes
1 answer

check what run-time static library or dll uses

is there a tool in windows SDK to ckeck what CRT a library uses? for example I have a *.lib file, how do check if it's compiled with /MDd flag or /MT? also how to check the same for dll or exe? can this be done with dumpbin?
codekiddy
  • 5,897
  • 9
  • 50
  • 80
11
votes
3 answers

C++ WINAPI: How to kill child processes when the calling (parent) process is forcefully terminated?

Could anyone kindly tell me how to kill child processes when the calling (parent) process is forcefully terminated? By the way, I am not able to change the source code of child application. I have checked the existing thread in StackOverflow and it…
user3692418
  • 335
  • 2
  • 7
11
votes
3 answers

Show tooltip on invalid input in edit control

I have subclassed edit control to accept only floating numbers. I would like to pop a tooltip when user makes an invalid input. The behavior I target is like the one edit control with ES_NUMBER has : So far I was able to implement tracking tooltip…
AlwaysLearningNewStuff
  • 2,939
  • 3
  • 31
  • 84
11
votes
2 answers

Programmatically rotate monitor

I'm working on making a utility script that does a whole bunch of things. One of the things I want to do is to rotate a display; I have multiple monitors, and I want the main one to rotate. I know this sort of thing usually works through win32api…
wnnmaw
  • 5,444
  • 3
  • 38
  • 63
11
votes
2 answers

How do I get the dimensions (resolution) of each display?

I need help on how to retrieve the resolutions of my screens, as shown in the image below. I found this documentation and it was really helpful. Here's the code that I tried, based on those docs: int numberOfScreens =…
benjtupas
  • 610
  • 9
  • 25
11
votes
3 answers

Any API to prevent Windows 8 from going into connected standby mode?

I need to disable connected standby mode until my Desktop application has finished. The desired behavior should be similar to what happens when I connect to that machine via Remote Desktop. That is, the screen is switched off, but the system doesn't…
avo
  • 10,101
  • 13
  • 53
  • 81
11
votes
2 answers

Is it safe to initialize MS HANDLE to nullptr?

I know using nullptr is more "typed". It can distinguish pointer type and 0 and works well in function overloading and template specialization. So I am not sure whether it is safe to replace the NULL to nullptr in my old Win32 project in every…
Chen OT
  • 3,486
  • 2
  • 24
  • 46
11
votes
3 answers

Creating context menu for win32 API

I am trying to create context menu for win32 application using case WM_RBUTTONDOWN: { HMENU hPopupMenu = CreatePopupMenu(); InsertMenu(hPopupMenu, 0, MF_BYPOSITION | MF_STRING, ID_CLOSE, (LPCWSTR)"Exit"); InsertMenu(hPopupMenu, 0,…
Xinus
  • 29,617
  • 32
  • 119
  • 165