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.

0
votes
1answer
14 views

Problem capturing mouse left button while using WM_NCHITTEST

case WM_NCHITTEST: { LRESULT hit = DefWindowProc( hWnd, uMsg, wParam, lParam ); if ( hit == HTCLIENT ) { hit = HTCAPTION; SendNotifyMessageA( hWnd, ...
0
votes
0answers
19 views

Should context-menu handlers be implemented separately or together

I'm implementing a shell extension context-menu handler, and the things it will add to the context menu will differ depending on the context--i.e., what type of file or folder the user has right-...
0
votes
1answer
20 views

How to register multiple shell extension handlers

I'm creating a single project that contains multiple shell extension handlers. For example, there's a class for a context-menu handler, a class for a property-system handler, a class for a drag-and-...
0
votes
0answers
21 views

How to use function GetDlgItemInt assembly?

In TASM for Win32, I have this code: ;------- Edit1 Create ---------------- push L 0 push [hInstEdit1] push idEdit1 push [newhwnd] push L 20 push L 200 push L 50 push L 130 ...
0
votes
0answers
24 views

MS Detours - DetourAttach fails

Feeling stupid here but why is this code giving me a syntax error in Visual Studio when trying to compile it? DetourAttach(&(PVOID&)true_create_file, create_file); The compiler complains ...
0
votes
0answers
48 views

How can I change the style of a control (CListBox) initialized with DDX_Control, before DDX_Control is called

I'm modifying an existing project and a dialog has controls I am subclassing to theme differently in some cases (in other cases I will leave it entirely alone). By the time DDX_Control() is called ...
1
vote
0answers
20 views

Prevent desktop sharing of a particular c# winforms or detect desktop sharing

While developing an examination software I have a requirement to prevent desktop sharing through applications like TeamViewer, AnyDesk, Ammyy Admin etc or at least detection of it. Our examination ...
0
votes
1answer
77 views

Restore minimized window of another, suspended application

I am trying to restore a minimized, suspended UWP application from another application, but I cant manage to find a workable solution. Using .NET Core 2.2 and win32 API via PInvoke I have tried ...
0
votes
1answer
28 views

Why is SEH considered “asynchronous”?

A few of the articles / answers I read on SEH (Structured Exception Handling) consider it to be 'asynchronous'. It is my understanding that the whole handling part of these exceptions occurs on the ...
0
votes
1answer
49 views

How to check whether the needed Windows API function is available on the system where an application is running?

I want to use some Windows API functions specific to the latest Windows 10 versions. E.g. functions like CreatePseudoConsole() supporting Windows Pseudo Console (ConPTY) were introduced only in ...
0
votes
0answers
17 views

How to detect if a window is “docked” on the desktop?

When a user presses, for example, Windows-RightArrow the window gets resized to the half of monitor's width and to its full height, and then gets "docked" to the right half of the monitor (ref). The ...
0
votes
1answer
55 views

Transactional SHFileOperation

Can I make the function call SHFileOperation a transactional one? I mean, I want to move/copy/delete few files using this function and want to ensure that entire file operation either fully succeeds ...
2
votes
1answer
73 views

Random number generator crashing in assembly

Found this code here on stackoverflow, I understood how it works and tried implementing it. It crashes at the INT 1AH instruction and I don't know why. When I run it in ollydbg, it stops at the same ...
2
votes
0answers
53 views

CComPtr deconstructor causes Read Access Violation

I wrote following C++/Win32 program to save a screenshot in jpeg format. #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <winuser.h> #include <strsafe.h> #include <...
-4
votes
0answers
62 views

How do i allow 2 loops to run at the same time? Info below [on hold]

I need help with the following. Console Application. In main() I run a do loop: do { if (GetAsyncKeyState(VK_NUMPAD1)) { H.Read1 = !H.Read1; Sleep(250); } ...
0
votes
0answers
60 views

Longpolling with WinAPI's InternetReadFile()

I'm writing a cross platform app. I need to get data from a longpoll url. On Mac/Linux I can use curl, curl_easy_perform() takes care of everything automatically. On Windows I have to use native api....
-1
votes
1answer
50 views

Value to pass to WIN32 API Function MonitorFromWindow as DWORD

The function calling the API in vba: Private Declare PtrSafe Function MonitorFromWindow Lib "user32" (ByVal HWND As Long, ByVal DWORD As Long) As HMONITOR I have tried to pass 0 as dword, Debug....
-1
votes
1answer
50 views

Having an issue sharing process IDs and handles between functions [duplicate]

Ive been working on making a memory reader / writer for awhile now and ive ran into some problems. I made a simple Memory.h / Memory.cpp to handle memory calls. I have my Main.cpp calling a "...
2
votes
0answers
52 views

How to track screens through time? [duplicate]

I'm trying to create a software that will provide statistics on my mouse usage(basically a glorified mouse hook). To know which display the mouse is currently sitting on, i can get a MONITORINFOEX ...
0
votes
2answers
92 views

Windows title bar icon

I have a problem with setting the titlebar icon for my application. I have been trying to figure this out, Googling what is wrong, for 2 days already, without any success. MainWindow.cpp: #include "...
1
vote
1answer
48 views

Using DirectX from subprocess executed by windows service

I need to execute ffmpeg process from windows service and capture it's standard output. It works fine until I use hardware acceleration. Because accessing DirectX from windows service is restricted, ...
0
votes
1answer
37 views

why Macro function,ListView_GetSelectedColumn(),doesn't work? it returns nothing

I am trying to get the selected column index of the ListView control, but the macro function ListView_GetSelectedColumn returns ZERO, no matter how I click. a = ListView_GetSelectedCount(lpNmhdr->...
0
votes
1answer
61 views

Programmatically get list of installed application executables (Windows10, C#)

I want to get a list of applications that are installed and executable on Windows 10 -- i.e. executables of applications a user can launch (UWP and non-UWP). For UWP apps, I want to get its ...
-3
votes
1answer
51 views

How to set up a dialog box that allows users to input data?

I am doing a school project and i want to set it up so when the user presses a button a dialog box pops up and allows users to input data. How should I implement this? I use resedit if that matters.
-2
votes
1answer
45 views

How to change the window color to red in assembly?

In TASM for Win32, I have this code: mov [wc.clsHbrBackground], COLOR_WINDOW + 1 I need to change the color of the window to red. How can I do that?
-2
votes
2answers
59 views

GetWindowRect returns wrong value if the window is near bottom right

I am trying to get a windows position by it's handle. Then I want to draw a cross at the windows 0, 0 position like so (notepad is near the top-left of the display): but if I move notepad near the ...
-2
votes
1answer
49 views

How to make a correct call to GetModuleFileName with UnicodeStrings

GetModuleFileName is not returning the program file name of a Windows service. I have already defined the variables as AnsiString and UnicodeString, but it seems that there is something related to ...
2
votes
1answer
62 views

How to apply masking for mouse cursor while writing in to icon(.ico)

I using GetCursorInfo to capture cursor but while saving the cursor as icon getting some black rectangle over on icon. For windows default cursors are fine but few custom cursor I facing this issue ...
-1
votes
1answer
56 views

How to fix 'file keeps the original location and after being copied doesnt copy extension'?

I am trying to create a program which copy itself while it is running to new location without keeping the orignal file location . once it is copied I got the file without extension , but how can I ...
1
vote
1answer
114 views

Why invoking class method from DLL requires virtual specifier?

I have weird issue while trying to call a method from loaded DLL. Lets start with simple Log class with method Write taking const char* argument. class ENGINE_API Log { private: const char* ...
0
votes
1answer
54 views

Issue with ADsOpenObject() remote connection and the WinNT provider

I have a problem getting an IADsContainer object from ADsOpenObject() by using the WinNT provider from a service on a remote machine. I've been able to get the code working in the following scenarios ...
1
vote
1answer
43 views

MFC assertion to work in global destructors

I'm writing an MFC GUI app with Visual Studio 2017. And I was naturally using its ASSERT/VERIFY macros to do some debugger code checks. But unfortunately those do not work in global destructors. For ...
0
votes
2answers
35 views

win32api.GetAsyncKeyState(0x01) returns -32768 instead of 1 when pressed

I tried using win32api today, and it said only that GetAsyncKeyState would return 1 if the key is pressed or 0 if not. But when i ran it with the left mouse button it returned -32768? I found this ...
-3
votes
1answer
62 views

Console application fails to create child process when executed at startup

Basically I have a console application that opens another .exe. That console application works properly when I normally double click on it. I added the application in regedit: Computer\...
-1
votes
1answer
47 views

ModuleNotFoundError: No module named 'win32api'

This is the error received: Traceback (most recent call last): File "C:/Users/Joe Martin/AppData/Local/Programs/Python/Python37/test.py", line 12, in <module> import win32com.client ...
1
vote
1answer
101 views
+100

How can I handle DLL errors in VBA?

The API delceration Private Declare Function CallWindowProc Lib "user32.dll" Alias "CallWindowProcA" ( _ ByVal lpPrevWndFunc As Long, _ ByVal HWnd As ...
-2
votes
0answers
39 views

WinAPI and C++: How to make a Windows Service that waits for and connects to Named Pipe? [on hold]

Was hoping someone could demonstrate how to make a simple Windows Service that listens for a Named Pipe and, when detecting it, connects to it. Or perhaps link to a guide? I'm very new to WinAPI and ...
-2
votes
1answer
86 views

Need to know windows API to get a callback when my application is activated

I have a wxWidgets windows application, I am launching annother application upon click a certain button on my appication, This new launched application behaves like to modal window and my application ...
1
vote
1answer
62 views

Credential Provider 'SetComboBoxSelectedValue' not called with appended field

I am running SampleWrapExistingCredentialProvider from VistaCredentialProviderSamples and there is a function called 'SetComboBoxSelectedValue' in CSampleCredential.cpp file. This function is called ...
0
votes
0answers
68 views

Bypass UAC to allow Drag & Drop from an unelevated source onto our elevated application

There are several sources explaining the UAC thing that prevents dragging and dropping files from the explorer onto your elevated application, but none of them covers a WPF example. The problem is ...
1
vote
1answer
65 views

How can I display a bitmap (array with color values) in a window using Window API?

I want move a buffer of color values to a window using BitBlt, only the window shows up empty. When I compile and run the code from How can I load a bitmap inside my window? (with my own example .bmp ...
0
votes
2answers
75 views

How to read a multi-line text file

I'm trying to read a text file and output its content into a struct. (I'm trying to output the contents first, instead of going for the structs right away). I've tried to read a file, but it doesn't ...
1
vote
1answer
43 views

DrawText on Windows Title Bar no longer works [duplicate]

In order to write some text at the right hand end of the title bar, my program catches WM_NCPAINT, gets the device context, calculates the position to write the text and then calls DrawText. This code ...
2
votes
1answer
77 views
+100

Retrieve state of Windows 10 Power mode slider

Is there any API to retrieve a state of Windows 10 Power mode slider? I was looking at Windows.System.Power namespace. But PowerManager class seem to provide only an immediate state of the power ...
-1
votes
1answer
98 views

LoadLibrary() fails when called from plugin but works in test program

I'm working on a plugin for Autodesk 3ds Max 2017. As per Max's documentation, the plugin is compiled inside VS 2017 using the VS 2015 toolset against the 10.0.10586.0 Windows SDK. When the plugin is ...
2
votes
1answer
57 views

How to increase Length of a ComboBox item in MFC

I have created a Dialog application using MFC. I have an CComboBox in it, I am able to enter an URL of Length 60 characters. But when the length increases , I am unable to enter.
0
votes
1answer
52 views

Find all combinations that add upto given number using parallel threads

The problem is to find a way to reach the same result as already reached in the code below but to use a custom amount of threads, use critical section and semaphore, so to parallelize the below code ...
0
votes
1answer
46 views

Inserting icon into context menu using shell extension

I'm making a Windows shell extension, using pywin32, and I'm adding a right-click context menu item via QueryContextMenu. I'm attempting to insert a system icon from imageres.dll along with it. I'm ...
-3
votes
0answers
42 views

How to fix a failure with the creation of a window in WinApi? [duplicate]

The description of a window successfully registrates but creation of the window fails. I've already tried changing type of a text, using CreateWindowEx instead but nothing changes. It seems a ...
0
votes
1answer
48 views

Windows 10 alternative authentication

Let's say I want to implement alternative (not local and not AD) identity and authentication for Windows 10. So that my system allows to List/search available users and groups through regular API/GUI ...

http://mssss.yulina-kosm.ru