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
10
votes
2 answers

Array size error x64 process

I was checking how big of an array can I create on a X64 application, my understanding was that I can create arrays bigger than 2^31 on X64 process but I'm getting a compilation error on VS2010 compiler, below code const size_t ARRSIZE =…
Coder777
  • 985
  • 2
  • 9
  • 15
10
votes
3 answers

Function pointers for winapi functions (stdcall/cdecl)

Please could someone give me a few tips for creating function pointers for MS winapi functions? I'm trying to create a pointer for DefWindowProc (DefWindowProcA/DefWindowProcW) but getting this error: LRESULT (*dwp)(HWND, UINT, WPARAM, LPARAM) =…
Nick Bolton
  • 38,276
  • 70
  • 174
  • 242
10
votes
2 answers

C++: reading memory of another process

I'd like to have a function that allows me to read the memory of another process. I was thinking about something like this (pseudo code): staticAddress = 0x026E0DC4 processId = GetProcessIdByName(processName) processHandle =…
Forivin
  • 14,780
  • 27
  • 106
  • 199
10
votes
3 answers

Cannot open include file: 'VersionHelpers.h': No such file or directory

I'm trying to use IsWindows7SP1OrGreater function, declared in VersionHelpers.h header. And I get: 'VersionHelpers.h': No such file or directory although I can open this header from Visual Studio, it is found by syntax checker correctly. What's…
Violet Giraffe
  • 32,368
  • 48
  • 194
  • 335
10
votes
5 answers

Drawing in a Win32 Console on C++?

What is the best way to draw things in the Console Window on the Win 32 platform using C++? I know that you can draw simple art using symbols but is there a way of doing something more complex like circles or even bitmaps?
LolJohny
10
votes
3 answers

Reset cursor in WM_SETCURSOR handler properly

INTRODUCTION AND RELEVANT INFORMATION: I have made an application that needs to change the look of a cursor into hand when mouse hovers above the static control, but resets it to a normal cursor otherwise. My initial application was in full screen…
AlwaysLearningNewStuff
  • 2,939
  • 3
  • 31
  • 84
10
votes
3 answers

How to lock pages in memory using WinAPI?

I need to prevent application's memory pages from being swapped out of RAM on Windows. Is there a WinAPI function equivalent of POSIX mlockall() to achieve that?
Alex B
  • 82,554
  • 44
  • 203
  • 280
10
votes
1 answer

Waitable timers or a timer queue? Pros and cons of each?

I've got a Windows service that needs to do certain things periodically. Should I use waitable timer objects or timer queues? What are the pros and cons of the two approaches? Is this a false dichotomy? Is there a third way?
Roger Lipscombe
  • 89,048
  • 55
  • 235
  • 380
10
votes
2 answers

Win32 ::SetForegroundWindow() not working all the time

I'm working on a messenging tool. The messaging window is part of a whole application. I need the window to go to the front when there are some messages coming. I'am using this code : if( m_hwnd == NULL || !::IsWindow(m_hwnd) ) return…
samitriani
  • 103
  • 1
  • 1
  • 4
10
votes
4 answers

What is the purpose of the cbSize member in Win32API structs

I frequently encounter some definitions for Win32API structures (but not limited to it) that have a cbSize member as in the following example. typedef struct _TEST { int cbSize; // other members follow } TEST, *PTEST; And then we use it…
Jorge Ferreira
  • 96,051
  • 25
  • 122
  • 132
10
votes
1 answer

Why RegisterClass fails with ERROR_NOT_ENOUGH_MEMORY?

Shortly, my question is, why can WinAPI RegisterClass fail with ERROR_NOT_ENOUGH_MEMORY, when there is a lot of memory free, and what can I do to prevent it? Background: I'm developing an application (WinSCP FTP/SFTP client) that many people use for…
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
10
votes
3 answers

Need clarification for converting paths into long Unicode paths or the ones starting with \\?\

First off, let me ask a rhetoric question -- Microsoft, why making us prepend paths with \\?\ to allow them to be 32,767 characters long? Why not just use them as-is and extend the size of the internal buffers on APIs? Sorry, I'm just venting my…
c00000fd
  • 20,994
  • 29
  • 177
  • 400
10
votes
5 answers

How do I idiomatically convert a BOOL to a bool?

The header comes with its own BOOL type. Peeking at the implementation, it seems FALSE is just a macro for 0, and TRUE is just a macro for 1, but I'm not sure this is specified. What is the idiomatic way to convert a BOOL to a bool? I…
fredoverflow
  • 256,549
  • 94
  • 388
  • 662
10
votes
1 answer

Make shortcut in start menu with innosetup

I made an installer using the ISTool wizard and everything is fine. Under my program name in the start menu, I have MyApp MyApp Help Now, I want to add 2 more entries that are identical to the first (MyApp) but that passes a command line argument to…
Memb
  • 309
  • 1
  • 3
  • 14
10
votes
4 answers

Is "const LPVOID" equivalent to "void * const"?

And if so, why some Win32 headers use it? For instance: BOOL APIENTRY VerQueryValueA( const LPVOID pBlock, LPSTR lpSubBlock, LPVOID * lplpBuffer, PUINT puLen ); A bit more elaboration: If the API never uses references (or any other…
EFraim
  • 12,811
  • 4
  • 46
  • 62
1 2 3
99
100