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
1 answer

Bug when resizing borderless window with SDL2

I'm trying to make an application with a borderless window in SDL2. I've implemented moving and resizing via drag. Moving works perfectly fine. Resizing by dragging the bottom and right borders also works fine. Resizing by dragging the top and left…
DormoTheNord
  • 999
  • 1
  • 9
  • 20
11
votes
1 answer

C++ Win32api, creating a dialog box without resource

I'm new to win32api programming. I would like to know how to create a dialog box within a non-gui program (without any resource created). I've seen some examples with that CreateIndirect function. Is it the best method? Any other way? Thanks!
huff
  • 1,954
  • 2
  • 28
  • 49
11
votes
3 answers

Console.Write() will hang in WPF, but works in Console application

Please read the answer by Scott Chamberlain to see why is it related to WINAPI. Create a new WPF application in Visual Studio and change the code in MainWindow.xaml.cs as below. Run the application. The code will hang on second call to…
Roman Byshko
  • 8,591
  • 7
  • 35
  • 57
11
votes
2 answers

Correspondence between ProcMon and CreateFile disposition options

Process Monitor shows disposition option for CreateFile operation as "Open", "OpenIf", "Overwrite", "OverwriteIf" (may be something else). How does the options which contain "If" differ from those that do not? And to which CreateFile WinAPI function…
user10101
  • 1,704
  • 2
  • 20
  • 49
11
votes
3 answers

How to get friendly device name from DEV_BROADCAST_DEVICEINTERFACE and Device Instance ID

I've registered a window with RegisterDeviceNotification and can successfully recieve DEV_BROADCAST_DEVICEINTERFACE messages. However, the dbcc_name field in the returned struct is always empty. The struct I have is defined as…
snicker
  • 6,080
  • 6
  • 43
  • 49
11
votes
4 answers

Passing a string to an already running instance of an application

I have an application that detects if there is another instance of the app running and exits if one is found. This part seems to work reliably. My app takes a command-line argument that I would like to pass to the already running instance. I have…
lukeck
  • 4,528
  • 3
  • 27
  • 29
11
votes
5 answers

Is it necessary to explicitly stop all threads prior to exiting a Win32 application?

I have a Win32 native VC++ application that upon entering WinMain() starts a separate thread, then does some useful job while that other thread is running, then simply exits WinMain() - the other thread is not explicitly stopped. This blog post says…
sharptooth
  • 167,383
  • 100
  • 513
  • 979
11
votes
3 answers

SetStdHandle has no effect on cout/printf

The title says it all. When I run the following code: HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE); HANDLE hFile = CreateFile(TEXT("Foo.txt"), GENERIC_WRITE, FILE_READ_ACCESS | FILE_WRITE_ACCESS, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL,…
Duncan
  • 980
  • 6
  • 17
11
votes
5 answers

How to create timer in WinApi (C++)?

How to create timer in WinApi (C++)?
SomeUser
  • 1,976
  • 15
  • 42
  • 60
11
votes
1 answer

CoWaitForMultipleHandles API doesn't behave as documented

This was triggered by another question I was looking at. It might be too long to read, so please bear with me. Apparently, CoWaitForMultipleHandles does not behave as documented on MSDN. The code below (based upon the original question) is a console…
noseratio
  • 59,932
  • 34
  • 208
  • 486
11
votes
3 answers

keybd_event KEYEVENTF_EXTENDEDKEY explanation required

In documentation it says: KEYEVENTF_EXTENDEDKEY (0x0001): If specified, the scan code was preceded by a prefix byte having the value 0xE0 (224). Can someone explain what this means? What is the difference between this: keybd_event(RIGHT, 0, 0,…
mgulan
  • 795
  • 1
  • 14
  • 33
11
votes
1 answer

Is it possible to remove touch messages (WM_POINTERDOWN etc.) that an application receives?

I have successfully installed a WH_GETMESSAGE hook with SetWindowsHookEx and I can see the WM_POINTERDOWN, WM_POINTERUP etc. messages that the application receives. (It is a 32 bit desktop application running on Windows 8.1.) Now, I not only want to…
wmeyer
  • 3,426
  • 1
  • 18
  • 26
11
votes
3 answers

Get folder path from Explorer window

I have a pointer to an opened Explorer Window and i want to know its full path. For Example: int hWnd = FindWindow(null, "Directory"); But now, how to obtain the directory full path like "C:\Users\mm\Documents\Directory"
mmarques
  • 625
  • 3
  • 9
  • 27
11
votes
2 answers

Why does Windows draw its own min-max-close buttons, even if the WM_NCPAINT is correctly(?) reimplemented?

As we can see from this screenshot I took: http://www.picpaste.com/pics/skinned_window.1386408792.png for some strange reason Windows draws its own (un-styled) minimize/maximize/close button in the titlebar on top of my skinned titlebar (yellow…
Marco Pagliaricci
  • 1,366
  • 17
  • 31
11
votes
1 answer

How do I utilize the functionality of a multi-monitor setup without physical hardware?

I've spent the past few days researching whether its possible to use the Windows API (Preferably Windows 8) to develop an application that can utilize the features in a multiple physical monitor configuration, from a single physical monitor. As far…
S.Richmond
  • 11,412
  • 6
  • 39
  • 57