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

Is it possible to eliminate flickering entirely when resizing a window?

Normally, even when using double buffering, when resizing a window, it seems that it's inevitable that the flickering will happen. Step 1, the original window. Step 2, the window is resized, but the extra area hasn't been painted. Step 3, the…
EFanZh
  • 2,357
  • 3
  • 30
  • 63
11
votes
2 answers

How to Lock Windows (like "Windows + L") from .NET?

You can lock a Windows PC by pressing Windows + L. How can I lock a Windows PC using VB.NET or C#? A short example would be helpful.
Augis
  • 1,903
  • 1
  • 16
  • 21
11
votes
1 answer

Does anybody know what means ShellHook message HSHELL_RUDEAPPACTIVATED?

I am writing application which establishes shell hooks to get shell events (I am using C# if it matters). I am using this example: http://msbob.spaces.live.com/blog/cns!DAFD19BC5D669D8F!132.entry Hook is working fine but I do not receive message on…
koldovsky
  • 335
  • 1
  • 8
11
votes
2 answers

Default value for VK_CONTROL/VK_MENU/VK_SHIFT

We have 2 CTRL/ALT/SHIFT buttons on our keyboard. But there are VK_CONTROL/VK_LCONTROL/VK_RCONTROL available in the win api. So which value is default for the VK_CONTROL? VK_LCONTROL (left) or VK_RCONTROL (right)? Or maybe it choses value depending…
tobi
  • 1,944
  • 6
  • 29
  • 48
11
votes
3 answers

How can I get monitors numbers from Screen Resolution dialog in win7 programmatically?

When you press Identify button in Screen Resolution dialog then Windows shows you big white monitor numbers on each monitor. It was easy to find them programmatically together with monitor coordinates in Windows XP (with EnumDisplayDevices) but on…
boqapt
  • 1,726
  • 2
  • 22
  • 31
11
votes
1 answer

Are LoadLibrary, FreeLibrary and GetModuleHandle Win32 functions thread safe?

I'm working on a web service that interacts with a native DLL and I use LoadLibrary/GetModuleHandle/FreeLIbrary and GetProcAddress to dynamically load/unload the DLL because it is not very stable. public class NativeMethods { …
oscarkuo
  • 10,431
  • 6
  • 49
  • 62
11
votes
7 answers

High-level HTTP client library for native C/C++ in Win32

Are there no "high-level" HTTP libraries for native C/C++ in Win32 or am I just looking in the wrong places? By "high-level" I mean an API that lets me do HTTP web requests/responses in C++ with "about the same" abstraction level as the .NET…
Guido Domenici
  • 5,146
  • 2
  • 28
  • 38
11
votes
2 answers

Referencing GUIDs

I'm trying to capture an event and reference a GUID to see which event it is. The code is below: DWORD WINAPI AvisionEventProc(LPVOID lpParam){ //HANDLE hEvent = * (HANDLE *) lpParam; // This thread's read event STINOTIFY pStiNotify; …
Neil Benn
  • 904
  • 1
  • 12
  • 31
11
votes
1 answer

Getting the cluster size of a hard drive (through code)

I need to find the cluster size of the users hard drive, through C or C++. The hard drive uses NTFS (though I'd appreciate knowing how it's done on other file systems as well). I guess what I need is some combination of win32 API calls, but I don't…
larspars
  • 1,640
  • 1
  • 15
  • 30
11
votes
5 answers

Figuring which printer name corresponds to which device ID

My goal is to open a printer connected via USB using the CreateFile (and then issue some WriteFiles and ReadFiles). If the printer was an LPT one, I would simply do CreateFile("LPT1:", ...). But for USB printers, there is a special device path that…
GSerg
  • 76,472
  • 17
  • 159
  • 346
11
votes
5 answers

C++ - How to screen-capture, except for some windows

Situation: I have a software that performs screen sharing over the Internet, where one user acts as a presenter, and other users act as viewers/attendees. Besides the presentation windows, the presenter also has a set of NON-SHARING-WINDOWS that…
Sucata Mihnea
  • 349
  • 1
  • 5
  • 15
11
votes
1 answer

How to have LogonUser not use cached credentials?

i am using LogonUser to validate a user's set of domain credentials. LogonUser(accountName, domain, password, LOGON32_LOGON_NETWORK, LOGON32_PROVIDER_WINNT50, ref token); With disturbing results: LogonType Current Password …
Ian Boyd
  • 246,734
  • 253
  • 869
  • 1,219
11
votes
4 answers

SendInput() Keyboard letters C/C++

I am trying to use SendInput() to send a sentence to another application (Notepad) and then send it hitting the Enter Key. Any code snippets? Or help
Quiet1
10
votes
10 answers

How to use C++ standard smart pointers with Windows HANDLEs?

I was wondering if there is a way to use unique_ptr with Windows HANDLEs? I was thinking to replace the std::default_delete with specific handle_trats that calls CloseHandle. The problem is that HANDLE is defined as void* unique_ptr won't…
devdimi
  • 2,432
  • 19
  • 18
10
votes
3 answers

Applying low-level keyboard hooks with Python and SetWindowsHookExA

So I'm trying to figure out how to register a global keyboard hook using Python. From what I have read, it seems to be okay to not have the callback in a DLL. If you use WH_KEYBOARD_LL. I can't confirm that for sure but I find it encouraging that I…
Tim Wakeham
  • 1,029
  • 1
  • 8
  • 12