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

SetProcessDPIAware seems not to work under windows 10

I am trying to get the real screen resolution (in pixels) in a windows C++ app. When the windows dpi setting is changed, I get the virtual (adjusted) resolution instead of the real one. I have tried using SetProcessDPIAware, SetProcessDpiAwareness…
Alphonsos_Pangas
  • 514
  • 1
  • 3
  • 13
11
votes
3 answers

How to map Win32 types to C# types when using P/Invoke?

I am trying to do something like this in C#. I found out how to call Win32 methods from C# using P/Invoke from this link. However I met some difficulties in implementing P/Invoke. For example, one of the methods that I would like to access is…
Louis Rhys
  • 34,517
  • 56
  • 153
  • 221
11
votes
2 answers

What is the maximum length of a window title passed to SetWindowText?

The SetWindowText function's documentation does not set a limit on the length of the string that may be used as a window title. In the documentation for WM_SETTEXT (the message sent by calling SetWindowText), it is noted that the return value of…
Archimaredes
  • 1,397
  • 12
  • 26
11
votes
1 answer

Getting text from a control in another application, using MATLAB

[ - Introduction - ] I have software (Altair) that interfaces with some measurement equipment. A limited set of functionalities of this software is exposed as an API, made available to me by the manufacturer in the form of its MATLAB implementation…
Dev-iL
  • 23,742
  • 7
  • 57
  • 99
11
votes
3 answers

What does this line of C/C++ preprocessor mean?

This is Line 519 of WinNT.h (BUILD Version: 0091) #define DECLARE_HANDLE(name) struct name##__{int unused;}; typedef struct name##__ *name Why do we need a pointer to an struct with a single int member with a weird name called unused? And will we…
David Weng
  • 4,165
  • 12
  • 42
  • 51
11
votes
3 answers

How to get an accurate 1ms Timer Tick under WinXP

I try to call a function every 1 ms. The problem is, I like to do this with windows. So I tried the multimediatimer API. Multimediatimer API Source idTimer = timeSetEvent( 1, 0, TimerProc, 0, …
schoetbi
  • 12,009
  • 10
  • 54
  • 72
11
votes
1 answer

Win32 named pipes and message size limits - is the old 64K limit still applicable?

Win32 used to have a message size limit of 64K for message-mode pipes, as witnessed by the remnants of KB article Q119218 PRB: Named Pipe Write() Limited to 64K. The "applies to" section lists only "Microsoft Win32 Application Programming Interface"…
DarthGizka
  • 4,347
  • 1
  • 24
  • 36
11
votes
5 answers

How can I make the Win32 API window more modern looking?

I ordered Programming Windows Fifth Edition a few days ago, and started working with it. I'm starting to learn the win32 api, however, I got a question. The windows do not look modern winxp/win vista/win 7 style at all. How do I fix this? It…
Machiel
  • 1,495
  • 12
  • 15
11
votes
5 answers

Changing HWND Window Procedure in runtime

I'm working in an IDE which creates a hwnd and its respective WndProc LRESULT CALLBACK. I need to change the WndProc to a custom one. I've read that SetWindowLong would do the job, but I can't find any working example. For example: HWND hwnd; //My…
ProtectedVoid
  • 1,293
  • 3
  • 17
  • 42
11
votes
5 answers

Unresolved external symbols in compiling 32 bit application in Windows 64

So I am trying to compile legacy app from 32 bit to 64 bit.. I re-compiled all of the libs it used and made it look into WIN SDK6.0A x64 bit for libs.. I am using: Visual Studio Professional Edition 2008 Visual C++ dotNet Framework 3.5 SP1 Windows…
grobartn
  • 3,510
  • 11
  • 40
  • 52
11
votes
4 answers

How would you convert a std::string to BSTR*?

How would you convert a std::string to BSTR*? STDMETHODIMP CMyRESTApp::rest(BSTR data, BSTR* restr) { RESTClient restclient; RESTClient::response resp = restclient.get(data); Log("Response Status code: %s", resp.code); …
xkm
  • 271
  • 2
  • 4
  • 11
11
votes
10 answers

What is the relationship between C and the Windows API?

I looked at some other questions on SO and its not clear if c is built on top of, under, or alongside the WINAPI. Like for example could someone write something in pure c that was able to open a window, or would they need to use the windows api? I…
xaler7
  • 155
  • 1
  • 8
11
votes
2 answers

Debug Break on Win32 Api functions

I would like to have a break on the SetTimer function in order to see which components register what timers with what values. Is this possible?
ronag
  • 49,529
  • 25
  • 126
  • 221
11
votes
3 answers

How is a SendMessage from a different thread executed?

When we send a message, "if the specified window was created by the calling thread, the window procedure is called immediately as a subroutine". But "if the specified window was created by a different thread, the system switches to that thread and…
lornova
  • 6,667
  • 9
  • 47
  • 74
11
votes
2 answers

What is the altered search path (LOAD_WITH_ALTERED_SEARCH_PATH) in LoadLibraryEx()

The documentation for LoadLibraryEx() doesn't actually explain what the altered search path is. In the table entry for the LOAD_WITH_ALTERED_SEARCH_PATH flag it says "see the Remarks section", but in the Remarks section it only says that this flag…
sashoalm
  • 75,001
  • 122
  • 434
  • 781