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
37
votes
3 answers

How to create virtual webcam in Windows 10?

I would like to take video from a webcam, render some text on the frames and do some motion tracking and pass it on to a virtual webcam so it can be streamed easily. I found some answers on stackoverflow suggesting that I should use DirectShow.…
Lukáš Neoproud
  • 872
  • 3
  • 10
  • 20
37
votes
3 answers

categories and standard/system error codes

C++11 introduced the header containing a generic system to handle error codes. An std::error_code is a tuple containing an int, the error code, and a reference to an std::error_category, which defines the error domain and handling of…
moatPylon
  • 2,103
  • 1
  • 15
  • 22
37
votes
3 answers

Calling Win32 API method from Java

I need to call some methods in Wininet.dll from a Java program. I can find plenty of tutorials on how to call a new DLL that I create from Java, but I can't seem to find any tutorials on how to call an already existing DLL from Java. I know this…
Paul Reiners
  • 8,576
  • 33
  • 117
  • 202
37
votes
1 answer

Path prefixes \??\ and \\?\

What is the difference between paths prefixed with \??\ and those prefixed with \\?\ At Windows 7 CMD-Line DIR gives: \??\Volume{00000000-0000-0000-0000-000000000000}\…
loco
  • 475
  • 1
  • 4
  • 8
37
votes
6 answers

Equivalent of gettimeofday() for Windows

Does anyone know an equivalent function of the gettimeofday() function in Windows environment? I am comparing a code execution time in Linux vs Windows. I am using MS Visual Studio 2010 and it keeps saying, identifier "gettimeofday" is undefined.
Benny
  • 5,218
  • 5
  • 24
  • 28
36
votes
7 answers

Should DWORD map to int or uint?

When translating the Windows API (including data types) into P/Invoke, should I replace DWORD with int or uint? It's normally unsigned, but I see people using int everywhere instead (is it just because of the CLS warning? even the .NET Framework…
user541686
  • 205,094
  • 128
  • 528
  • 886
36
votes
5 answers

How do I use MultiByteToWideChar?

I want to convert a normal string to a wstring. For this, I am trying to use the Windows API function MultiByteToWideChar. But it does not work for me. Here is what I have done: string x = "This is c++ not java"; wstring…
Suhail Gupta
  • 22,386
  • 64
  • 200
  • 328
36
votes
4 answers

Gracefully Exit Explorer (Programmatically)

How do you gracefully close Explorer programmatically? By that I mean, how do you invoke this function programmatically: Edit: Typo in the picture, it should say "Ctrl-Shift-Right-Click" instead of "Shift-Click".
user541686
  • 205,094
  • 128
  • 528
  • 886
36
votes
2 answers

Conversion of wchar_t* to string

How can I convert an wchar_t* array to an std::string varStr in win32 console.
AnasShoaib90
  • 629
  • 2
  • 7
  • 14
36
votes
4 answers

Enumerate windows like alt-tab does

I'm creating an alt-tab replacement for Vista but I have some problems listing all active programs. I'm using EnumWindows to get a list of Windows, but this list is huge. It contains about 400 items when I only have 10 windows open. It seems to be a…
taby
36
votes
9 answers

RSA encryption library for C++

I am developing a Win32 application and I would like to use an RSA encryption library. Which library would you recommend?
Zombies
  • 25,039
  • 43
  • 140
  • 225
35
votes
7 answers

Win32: Bring a window to top

I have a Windows program which has two 2 windows in it: hwnd (main interface) hwnd2 (toplevel window, no parent, created by hwnd) When I double click on hwnd, I need hwnd2 to pop up and show some data, so I use this function to bring hwnd2 to…
KenC
35
votes
3 answers

How to kill processes by name? (Win32 API)

Basically, I have a program which will be launched more than once. So, there will be two or more processes launched of the program. I want to use the Win32 API and kill/terminate all the processes with a specific name. I have seen examples of…
dikidera
  • 2,004
  • 6
  • 29
  • 36
35
votes
2 answers

Is there a Windows equivalent to fdopen for HANDLEs?

In Unix, if you have a file descriptor (e.g. from a socket, pipe, or inherited from your parent process), you can open a buffered I/O FILE* stream on it with fdopen(3). Is there an equivalent on Windows for HANDLEs? If you have a HANDLE that was…
Adam Rosenfield
  • 390,455
  • 97
  • 512
  • 589
35
votes
3 answers

Compile error in 'winbase.h'

I get the following error with a Windows file when compiling winbase.h. Not sure why I get a syntax error and the compiler shows many more: 1> c:\program files\microsoft sdks\windows\v6.0a\include\winbase.h(238) : error C2146: syntax error :…
jdl
  • 6,151
  • 19
  • 83
  • 132