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.
40,416
questions
0
votes
1
answer
42
views
How to tell if the screen is about to be locked in windows using c++?
I'm an intern working on a problem in which I need to prevent the screen to be locked if certain conditions are met. So as my tutor instructed, I may try to write some codes that continuously check if ...
-1
votes
0
answers
17
views
PostMessage NumPad ignore BloqNum state
I'm writting some code for a game, that when sending NUMPAD_9 when BloqNum is disabled it will walk in diagonal direction to north east (NUMPAD3 southeast, NUM1 southw, NUM7 nw)
After checking with ...
1
vote
0
answers
45
views
FindWindowEx random failures getting child window handle
I have a VB.NET 4.6.1 desktop app that has been using FindWindow and FindWindowEx for over 2 years with no issue to locate a MDI child window and capture the window caption text, it has worked ...
0
votes
0
answers
10
views
Python How to Close WScript.Shell
I am looking for a way to close "WScript.Shell". I am using win32com.client module.
Anybody knows the answer? Because the lack of documentation is hilarious about it.
-1
votes
0
answers
43
views
How to use RAWMOUSE structure in winuser.h (from window app dev)?
I want to create a heat map of my mouse. In FPS games, the mouse gets locked and using its coordinate on the screen will not show any valuable data. So I am looking at getting the raw delta values of ...
0
votes
1
answer
39
views
Win32 Application failure
My application compiles successfully in visual studio 2019 but when i try to compile this code in Code::Blocks (Mingw64) it fails.
First, i had this error message twice:
error: cannot convert 'const ...
0
votes
0
answers
34
views
CNG SSL Provider Functions - how are they called?
I've been studying the various cryptographic APIs on Windows, and the flow that Windows goes through when an application creates an SSL connection.
One of the APIs I've come across are the CNG SSL ...
0
votes
0
answers
28
views
Win Automation - Unable to read the UI Elements for Whatapps (Window App)
I am learning the automation via UI Automation (UIA) recently, I noticed some window applications like Whatapps is hitting the error STATE_SYSTEM_BUSY (under LegacyIAccessible.State) when using Window ...
1
vote
0
answers
92
views
CryptQueryObject / CryptDecryptMessage extremely slow for large files/blobs
I am trying to decrypt a p7m attachment using CryptQueryObject / CryptDecryptMessage functions. For large files (30Mb) each call can take up to 30 seconds to execute. Outlook itself has no problem ...
-1
votes
1
answer
41
views
What means the window message 0xc029? (WinAPI)
I'm using RegisterShellHookWindow to detect user interaction on windows.
In my WndProc I get the message code: 0xC029.
I looked in WinUser.h but nothing.
What means this message code?
Help
0
votes
1
answer
62
views
How to get process name in an injected dll?
I have this basic internal dll:
#include "pch.h"
DWORD WINAPI HackThread(HMODULE hModule)
{
uintptr_t moduleBase = (uintptr_t)GetModuleHandle(L"Mainmodule123.exe");
...
0
votes
0
answers
34
views
C++ Redirecting WndProc in class failing
I'm trying to create a simple custom objects that handles window registration and creation. The problem I have is that I can't get the window to use RealWndProc as a window procedure.
The code for ...
1
vote
0
answers
72
views
Why use while loop to create and close MessageBox will take more and more memory?
Environment
Windows 10, IDE : Visual Studio 2022 .
Question
I just run a very simple code as follow.
#include"Windows.h"
int main(){
while (true) {
MessageBox(NULL, L"hello ...
0
votes
0
answers
23
views
Python mouseclick not working inside subroutine
Question: Why would a win32api mouse click work in the main block but fail in a subroutine?
I'm working on a python script that copies an id from an Excel spreadsheet and pastes it into a 3rd party ...
0
votes
0
answers
39
views
Handle special keystrokes from Process
I'm trying to spin up a cmd as a part of another application. To achieve that I'm using the Process class.
var psi = ProcessStartInfo () {
FileName = $"{Environment.SystemDirectory}\\cmd....
0
votes
0
answers
30
views
How to check if a window is showing [duplicate]
I want to get a window's clip box so I can detect if the whole window is displayed.
package: win32gui
I know that IsWindowVisible() from the Windows API will return true if a window is NOT minimized, ...
0
votes
1
answer
18
views
netsh.exe error on initializing NDI with custom console
I have an application that works with NDI. But when I initialize it, error occurs: window with title "netsh.exe - Application Error" and error description - "The application was unable ...
0
votes
3
answers
102
views
How to wait for a thread created in DLLmain to finish?
I create a new thread in Dllmain() by the CreateThread() API, which does not involve thread synchronization, it is only a separate thread.
Dllmain() invokes WaitForSingleObject(funcThread, INFINITE); ...
2
votes
0
answers
81
views
stream video into a standalone C++ desktop app
I have a native C++ Windows app that needs to display videos from a streaming server. It's a private server, but similar to YouTube -- upload a video, it converts(?) the video, then gives you HTML ...
-1
votes
0
answers
35
views
Save web pages as PDF Files and can't get past VBA Compile Error for Type Mismatch
I have very little experience in programming languages, but I found this block of code from myengineeringworld.com that would allow me to save web pages as PDF files. However when I try to run it the ...
-1
votes
0
answers
66
views
EXCEPTION_ACCESS_VIOLATION on Hollowed Process
I am trying to write my own process hollowing program.
It's a method that consists of running a generic process in suspended mode (like calc.exe), and rerouting this process's primary thread's ...
1
vote
0
answers
77
views
GCC can't find headers on Windows
I'm new in winAPI and I was learning how code programs with some special functions and such, so I downloaded the Windows's SDK.
Problem is, GCC decided to put the blind glasses and say:
Documents_path....
1
vote
0
answers
46
views
How to align window to windows' taskbar
I'm trying to position my Win32 API window alongside (e.g. left-sided vertical) taskbar. My display has 2560x1600 resolution and 144 DPI. I had some problems with DPI-aware apps previously, so maybe I ...
0
votes
0
answers
46
views
How to log username of the user trying to stop a service in windows
I have made the service to not stop when using services.msc or cmd or task manager by changing descriptors of the service and restricting access, but I want to log details of user who tries to stop ...
-2
votes
1
answer
67
views
Win32 GDI color palette transparency bug
This question could be considered more of a bug report on an unsightly and time-wasting issue I've recently encountered while using Win32/GDI:
That is, loading a bitmap image into static control (a ...
-1
votes
0
answers
77
views
Win32 WaitOnAddress causing crash on start
I'm trying to use WaitOnAddress() for the first time, after reading it performs significantly better than wait objects. I'm on Windows 10, I've linked against synchronisation.h and it builds fine. ...
1
vote
1
answer
51
views
winapi to read or copy NTUSER.DAT (locked file)
I am trying to load NTUSER.DAT of logged-in local user in registry hive to read their keys from my program running as admin (it has got SeDebugPrivilege, SeBackupPrivilege, etc).
It works when the ...
0
votes
0
answers
50
views
Is this a correct way to set the control fonts to the default message font on modern Windows API?
Some background: I asked this question on CodeReview, where I've gotten good answers on things like this in the past, but haven't seem to have gotten an answer yet. I suppose if this question is valid ...
0
votes
2
answers
39
views
__stdcall in function paramater [duplicate]
does anybody know if is possible to add __stdcall (CALLBACK) in function parameter like this?:
void Function(LRESULT CALLBACK (*f)(HWND, UINT, WPARAM, LPARAM));
It gives me following error:
a calling ...
3
votes
0
answers
35
views
Not receiving WM_MOUSEWHEEL message [closed]
I am not receiving the WM_MOUSEWHEEL (0x020E) message.
I have a simple example I programmed on C++:
#include <Windows.h>
LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM ...
0
votes
1
answer
46
views
Figure out which desktop is active at the moment from the Win service
I have a Win service running under the SYSTEM account. In case the user logs out from the system, the service should detect this and restart particular application on the logon desktop (and stop ...
0
votes
0
answers
51
views
Get Username string from RPC binding handle
How can one get a client's Username given an RPC_BINDING_HANDLE without side effects?
I know that I can call RpcImpersonateClient to impersonate a client on server's thread and then get SID which ...
0
votes
0
answers
35
views
Disable Layout Scaling WinUI 3.0
How do I do the equivalent of UWP XAML UI's ApplicationViewScaling.TrySetDisableLayoutScaling(true) in a WinUI 3.0 Desktop application?
-1
votes
0
answers
42
views
Win32 Console API `SetConsoleScreenBufferSize` Function Not Working Properly
I just started using the Win32 API Console functions, and when I run the code below, the output in the command prompt is cut off by the input statement.
#include <stdio.h>
#include <windows.h&...
0
votes
1
answer
47
views
Getting Bluetooth LMP version via Powershell
I have taken a look at CIM_NetworkAdapter, Get-NetAdapterAdvancedProperty CIM_LogicalDevice, Win32_PnPDevice and more.
How can I go about grabbing the LMP version of a Bluetooth adapter from its "...
0
votes
0
answers
28
views
I tried to use Win32 package to read text on dart and use stream, but I encountered a little difficulty
I try dart Win32 package, which provides FFI to support the Win32 API for operating c/cpp
https://pub.dev/packages/win32
but I wanted him to read a long string of words and know where he read them, ...
-3
votes
2
answers
77
views
What is the official status of Windows' UMS API?
Windows 7 added an API set called UMS which allowed you to reclaim threads from user mode, and implement custom scheduling logic.
Starting with Windows 11 this feature does not appear to work. This ...
-1
votes
1
answer
49
views
Clear console input after GetKeyState()
I have a console login-system for creating a username after pressing '1'. But whenever i press that key, the pressed key shows up in the console input. I want to get rid of that.
#include <Windows....
-2
votes
0
answers
89
views
Finding HWND by name of a External Console Application
I am trying to find the HWND by name of a external console application.
Anyways I tried using GetConsoleTitle() and FindWindow(0, char variable) but this only gets the Visual Studio console name and ...
1
vote
0
answers
112
views
How to detect that application is in gdi scaling mode
I use GetThreadDpiAwarenessContext and then AreDpiAwarenessContextsEqual to detect if an application is in gdi scaling mode:
AContext := GetThreadDpiAwarenessContext;
Result := ...
-1
votes
0
answers
61
views
How does UuidCreateSequential guarantee unique guids?
According to https://docs.microsoft.com/en-us/windows/win32/api/rpcdce/nf-rpcdce-uuidcreatesequential:
Computers with ethernet/token ring addresses generate UUIDs that are
guaranteed to be globally ...
-1
votes
0
answers
71
views
How can I avoid NTDLL making worker threads?
I am working on a Windows service application using VS Community Edition 2019 and C++. For realtime reasons, I want to keep the number of threads as low as possible. Regrettably, ntdll.dll is creating ...
-6
votes
0
answers
106
views
SendMessage(...) when used for clicking isn't working
I was trying to simulate a mouse click using SendMessage(), but it seems like its doing nothing.
My code
LPCWSTR Bloons = L"testpng.png - Paint";
HWND bloonsWindow = FindWindow(NULL, Bloons)...
-1
votes
1
answer
68
views
Why does this minimal HTTP test server fail half of the time?
I'm trying to write a minimal HTTP server on Windows and see the response in Chrome with http://127.0.0.1/5000. The following code works sometimes ("Hello World"), but the request fails half ...
0
votes
0
answers
43
views
Win32 Button doesn't properly display in a Direct2D Window
I have a Direct2D program, and my goal is to have a Win32 button rendered with the Direct2D window.
I was able to compile the program fine, but the problem is that the button only shows when I click ...
0
votes
1
answer
46
views
How to Link an additional c .lib file when making a cython library
I am attempting to make a simple python library that calls LogonUser to see if the plaintext password provided matches the password of the username provided, but when I compile, it gives me this error
...
0
votes
1
answer
61
views
What WINAPI responsible to detect keyboard state when 'parsing' WM_CHAR?
For example, if you press 2 on your keyboard at the notepad it generates WM_CHAR with x charCode, if you hold shift and press 2 it generates y charCode.
What WINAPI is responsible for detecting the ...
0
votes
0
answers
49
views
Adding props (tags/ keywords) to a folder using only ctypes in Python 3
I'm trying to add tag to a folder using Windows API, and I've stumbled upon this article.
According in this article,
to create an ANSI simple property set, you would call IPropertySetStorage::Create ...
-1
votes
0
answers
44
views
How a GUI application can detect if its window is shared on zoom meeting as screen sharing on Windows Operating System?
Suppose I have a GUI application created using win32 api or using .net framework.
How can this application detect that its window is shared over zoom call as screen sharing?
0
votes
0
answers
35
views
Dealing with cursor masks
I'm trying to get the data (byte[]) of the current mouse cursor, but one type of cursor (known as MaskedColor) needs special treatment.
http://elektronotdienst-nuernberg.de/bugs/cursor.html
It's the ...