43,277
questions
-1
votes
0
answers
18
views
Sending commands to background window with python
I want to send a command to the background window with python, but this command should be as if I were manually pressing the 1 key on the keyboard. I use win32api.keybd_event(key_code, win32api....
0
votes
0
answers
23
views
How to access locally saved credential data of a user from the SYSTEM context?
I am building an application that requires deletion of saved credentials (Web credentials, windows credentials saved within credential manager) of a user. My process is running in the SYSTEM context.
...
1
vote
0
answers
54
views
powershell's "get-netadapter" replacement using C/C++ APIs
I need to obtain the network adapter GUID given the connection name as shown by Windows network manager. Powershell's get-netadapter does the job, but I'd like to do it in C/C++. I know that thare are ...
0
votes
0
answers
45
views
SetWindowDisplayAffinity causes window to be black in screen recorders
I am using DLL injection to execute SetWindowDisplayAffinity on other processes. I use WDA_EXCLUDEFROMCAPTURE to fully hide the windows in screen recorders.
It works fine at first. But if I hide the ...
0
votes
0
answers
37
views
Using Windows API to "turn on/off" a selected monitor
My main goal is to imitate the "Show only on 1/2" setting from Windows.
I'm trying to use ChangeDisplaySettingsEx to turn a specific monitor on and off. Setting dmPelsWidth and dmPelsHeight ...
1
vote
0
answers
37
views
How to increase speed when itererating over all controls of a window using UIA?
Whats the best practice or options to speed up the search when you are iterating the entire control list of a window?
I have tried creating a property condition to find only the items that are not ...
0
votes
0
answers
84
views
Turbo explorer Delphi KeyPressed and ReadKey replacement
Just tried to receive some information about the keyboard when I noticed CRT is not delivered with Turbo Delphi Explorer... It is shipped under conio.h with Turbo C++ Explorer, but not with Delphi ...
-1
votes
1
answer
71
views
How to use DeviceCapabilities() DC_BINNAMES in C++/CLI
How to use DeviceCapabilities() DC_BINNAMES in C++/CLI ?
LPTSTR sizeBuf = ...
DeviceCapabilities(printerName.c_str(), NULL, DC_BINNAMES, sizeBuf, NULL);
for (int i = 0; i < nCount; i++) std::wcout &...
0
votes
1
answer
99
views
Precise key press event handling in console
I am coding this console app that updates the console every 500 millisecond. while it does that I want to set up a few key press actions. But using the following method is not precise and it misses a ...
0
votes
1
answer
65
views
How to get notified only when a text box is edited by the user in C++ Win 32 API?
I am building a C++ app with Win32 api interface
I have a text box that changes programmatically and user can also set the value in text box. I want to get a notification in WM_COMMAND only when it is ...
-1
votes
0
answers
49
views
can not see the EDIT control but can use it If I use ID2D1DeviceContext to clear the window?
I can create EDIT in winapi and If I want to draw something the EDIT will be covered?
If I delete swapChain->Present1(1, 0, ¶meters); it will be ok.
(if I just use ID2D1HwndRenderTarget to ...
-3
votes
0
answers
51
views
Can't open Registry key, RegOpenKeyEx returns ERROR_NO_MORE_FILES
I'm working on a C++ function to check if a registry path exists. It handles different root keys (like HKEY_LOCAL_MACHINE and HKEY_CURRENT_USER) and uses RegOpenKeyEx() to open the path.
The following ...
1
vote
0
answers
83
views
Why does my code crash when I call TTGetEmbeddedFontInfo?
My goal is to obtain the filename of the font selected in an HDC without using DirectWrite.
To do so, I thought I could use TTGetEmbeddedFontInfo() because the doc says:
Pointer to a TTLOADINFO ...
4
votes
0
answers
97
views
Enumerate display output connectors on graphics adapter
I'm trying to enumerate and display information about the display output ports on a GPU.
E.g., on my GPU:
> Connector 0: HDMI
> Connector 1: DisplayPort
> Connector 2: DisplayPort
> ...
0
votes
1
answer
43
views
How to screenshot a Zoom window?
I have a requirement in my app to programmatically screenshot a Zoom window. I implemented this using standard Windows API calls:
Hdc hdcWindow = GetWindowDC(hwnd);
Hdc hdcMemDC = CreateCompatibleDC(...
1
vote
1
answer
45
views
Windows Speech recognition APIs
I have noticed that in Windows 10 and 11, you can press Win+H to start a "Voice Typing" feature. You speak to a microphone and the widget sends keystrokes to whatever window has the focus. ...
1
vote
2
answers
86
views
How to enumerate files on a specific folder using Windows shell apis?
Im trying to enumerate all files on a given path and also get their properties.
On my implementation below, i dont understand whats happening, it looks like it somehow is using the computer desktop ...
0
votes
1
answer
36
views
IME Text box failing in Windows 11 (MSVC on Win32)
In an older Win32 non-unicode app, I've got a text editor that handles IME in the following messages -
WM_IME_COMPOSITION:
...
if (lParam & GCS_RESULTSTR) // flag to say the IME character has ...
2
votes
1
answer
94
views
FPS drop in maximized/fullscreen window using DirectX12
I'm using a Direct2D(flip model) for rendering of two images. The config of my swap chain is standard except it's using 3 buffers, no VSync, 2 frames queue of Present(0, 0). And I noticed that in a ...
1
vote
0
answers
70
views
Borderless C++ window doesn't trigger Windows 11's docking panel
I recently created a window with C++ and the Win32 API. I want to make a custom titlebar for it (I overrode WM_NCHITTEST to be able to drag it anywhere):
#include <windows.h>
LRESULT CALLBACK ...
0
votes
0
answers
43
views
Undefined references to SDL symbols? [duplicate]
I am trying to create a project in the C89 language using the SDL2 library:
#include <SDL2/SDL.h>
#include <stdio.h>
int main(int argc, char* argv[]) {
// Initialize SDL
if (...
1
vote
1
answer
41
views
Non-Modal WPF control hosted in MFC Dialog does not receive keyboard input
To modernize an older C++/CLI MFC-based application we are trying to replace an old dialog with a new one written in C#/WPF. To host the WPF control inside a CDialog we have followed this guide ...
0
votes
0
answers
58
views
Undefined Reference WinMain@16 in Makefile [duplicate]
I have a makefile here to build a graphics engine altho i keep getting this one undefined reference which i can't seem to figure out.
Take a look and tell me what you think.
I have a main function in ...
-3
votes
0
answers
50
views
Win7 driver development, how to get the process name through process pid or EProcess?
I am trying to write a windows driver to protect the process from being killed by the task manager. The program can be used normally using the win10 wdk. When using the win7 WDK, the compilation fails ...
0
votes
1
answer
41
views
Taskbar Color Reverts When Changing Color Using SetWindowCompositionAttribute in WinUI3
I am encountering an issue with the taskbar color on Windows. When I change the taskbar color using the SetWindowCompositionAttribute method, the color initially changes as expected. However, as soon ...
0
votes
0
answers
99
views
WaitForSingleObject Returns Right Away When Called On Sleeping Thread
I have a thread that sleeps for long periods of time and when it comes time to shut it down I set an atomic variable that both the main program and the thread have access to and call ...
-1
votes
0
answers
122
views
Programmatically trigger the "This app can't run on this PC" error
I'm trying to understand how the "This app can't run on this PC" error is handled in Windows from an API perspective. This is the error message that appears when trying to run an ...
1
vote
1
answer
90
views
OpenGL window is unresponsive, fully white, and closes itself after a few seconds
I'm running this on Visual Studio 2022, with the Win32 (x86) platform. The same bug occurs on x64, though, I've tested it.
I have found no errors in my code, but still I've tried adding compile error ...
2
votes
1
answer
74
views
Adding task using Interface 1.0 Win32 API doesn't show up in the Task schedular GUI
I was trying to run the sample program, taken from the Microsoft docs. Seems the is being created (.job file found in the C:\Windows\Tasks) but it is not listed on Task schedular GUI.
Is this related ...
1
vote
0
answers
70
views
Why LowLevelMouseProc get negative values when moving the cursor quickly
I wrote a simple program to get the mouse position using win32api. But I found that sometimes negative values appear. Why is that?
import ctypes
import ctypes.wintypes
import sys
user32 = ctypes....
0
votes
0
answers
25
views
ITaskScheduler::NewWorkItem returns E_ACCESSDENIED while attempting to create task under same name
According to the Microsoft docs, the error code ERROR_FILE_EXISTS should be returned when attempting to create a task that already exists. However, when I run the sample program to create a task more ...
0
votes
0
answers
40
views
Event trace consumer throwing error on ProcessTrace api
Working on creating a tool to log kernel events to get better understanding of ETW.
I used the below MS sample to create a kernel logger session and added the opentrace/processtrace/closetrace apis in ...
-2
votes
2
answers
82
views
How to make a function of MessageBox with Windows API
I want to make a reusable function that I can reuse whenever I want to use a MessageBox but in the code below, there is an error saying:
identifier "Lmessage" is undefined
identifier "...
-1
votes
0
answers
67
views
How to turn pinned taskbar icons to grey? [closed]
I wanted to get the windows applications pinned on my taskbar to grey colour, except for those which are currently running. With help of ChatGPT, I tried autoit scripting using registry writing, I ...
2
votes
2
answers
127
views
PID of notepad.exe in taskmanager different from pi.dwProcessId
I'm new to C and am working with the Win32 API to create a process with CreateProcessW(). This is my first C program. It opens notepad.exe and outputs the process ID using dwProcessId. But the PID ...
2
votes
1
answer
81
views
Trying to read resources of an external executable file C++
I'm trying to read resources of an external executable. I'm using Resource Tuner application and it gives me such a result:
std::filesystem::path exeSignalPath{ LR"__(c:\Users\user\AppData\Local\...
1
vote
0
answers
31
views
Best way to intercept write IRPs to \driver\volmgr devices, without using UpperFilter registry?
Assume you want to intercept IRP_MJ_WRITE IRPs sent to \driver\volmgr, in particular, the device for the root partition (for example C:), and you want to monitor any writes to starting sector of this ...
0
votes
0
answers
44
views
How to access resources on a different Active Directory forest using Windows API + Token impersonation?
I have 2 Active Directory setups on my lab:
AD1.local
AD2.local
Both forests have trust relationship enabled.
I have a resource "X" on AD1 that is only accessible to the "Marketing&...
3
votes
0
answers
70
views
Get files from Clipboard, copied from the local machine in a remote session in VBA
In a RDP session using MS Access VBA, getting file paths from the clipboard with format CF_HDROP is not working when the files in the clipboard are copied from the local machine.
I can successfully ...
1
vote
0
answers
40
views
Automating using pywinauto throws not enough rights error even with admin access
I am working on some automation in windows with win32 api where I need to do a series of task when user clicks a button in my app. This series of tasks are always same and needs separate processing ...
-9
votes
0
answers
85
views
Terminal Error while running C code in vscode [duplicate]
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../libmingw32.a(main.o):(.text.startup+0xa0): undefined reference to `WinMain@16'
collect2.exe: error: ld returned 1 exit status
After successful setup of ...
-1
votes
1
answer
85
views
How to set PerMonitor DpiAwareness for .NET 8 Windows desktop application in WPF?
I found app.config file is not NET6 compatible.
So, AppContextSwitchOverrides … Switches like...
Switch.System.Windows.DoNotScaleForDpiChanges
are transferred from
"appname".config => &...
0
votes
0
answers
56
views
How can I screen capture under a blur overlay?
When using PyQt5 and YOLOv5 to detect humans and blur them with an overlay, a flickering issue arises. This happens because the screen capture picks up the overlay itself. The script then mistakenly ...
0
votes
0
answers
28
views
Send outlook email in python
I am trying to run a .py script with various emails in it that are designed to be sent at differing times of the day.
I am using the .DeferredDeliveryTime and the emails just get stuck in my outbox ...
0
votes
1
answer
58
views
How do I record videos with WinAPI for my console Emulator?
I have made a Nintendo Emulator and I want to record videos of what the player is playing. I know about FFmpeg, but I don't know how to set up it/use it. All I need is a .lib file that let me throw it ...
0
votes
0
answers
62
views
GetNameInfo win API does not resolve Chinese computer names on Windows 11?
I have a small lab based Active Directory environment with 3 devices.
They have the following OS installed.
DC running Windows Server 2022 hosting my AD server.
1.Endpoint running Windows 10 Pro (22H2 ...
4
votes
1
answer
173
views
Why is MapVirtualKey not returning the extended key flag?
I am trying to synthesize keystrokes via PostMessage() and I need to generate the corresponding lParam.
I am familiar with the KeyStrokeMessage struct.
Here's the code:
///-----------------------------...
1
vote
0
answers
59
views
VirtualAllocEx Returns Memory Marked as MEM_FREE/PAGE_NO_ACCESS
I am writing x64 assembly code to invoke VirtualAllocEx win32 API (as part of process injection lab, so I am injecting into explorer.exe) and seeing unusual (to me) behavior.
The documentation states ...
-1
votes
1
answer
73
views
Global keyboard shortcut with windows key on Windows with .NET 8
I am writing an app switcher inspired by Contexts kind of for fun, and got stuck on reacting to a global keyboard shortcut. I am using .NET 8 + Avalonia.
What I got so far:
using System;
using System....
0
votes
0
answers
65
views
Do binaries elevated with an UAC Bypass technique have the UAC Bypass as an ancestor process?
I've successfully elevated a binary (in this case, cmd.exe) using a UAC bypass technique, and I'm trying to determine if it's possible to trace the elevated binary back to the "elevator" ...