Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [winapi]

The Win32 API is the core set of application programming interfaces (APIs) available in the Microsoft Windows operating systems. This tag is for questions about developing native Windows applications using the Win32 API.

8
votes
0answers
166 views
+50

Windows keylogger in C++

Windows keylogger in C++ Known issues: Not implementing rule of five Having to use hack to use member variables, out_, in static method Pressing caps-lock won't ...
2
votes
0answers
44 views

VBA Array Functions: insert element, remove element

An extension to array functions I am building for my snake game. This one allows you to remove / insert particular elements. API CALLS ...
5
votes
1answer
69 views

Error handling function (Win32/C)

I have written the following function to be a general "error logging" solution for my Windows API projects. Basically, given a Windows system error code (a la ...
2
votes
0answers
85 views

VBA array functions: push, pop, shift, unshift

I want to write my snake game procedurally, using as much windows call as I can so as to practice. Looking into GetAsyncKeyState to capture keyboard inputs and play sound functions. Also making a ...
0
votes
0answers
27 views

Mutex implementation using Windows APC

I just wrote this now and didn't test it much. This isn't a replacement for std::mutex, but for something like fun. I may develop it to make it shared across processes by storing the counters in a ...
6
votes
1answer
86 views

Enumerating processes without enumerating flaws of the API

This arose out of the incident where it was realized that WMI could not be expected to be reliable across all various computers. The next thing I looked at was API which was positively awful to work ...
3
votes
0answers
92 views

WaitForSingleObject with windows messages processing

Is this reliable, or have I missed something? I want a drop-in replacement for WaitForSingleObject (sans the return type, I like HRESULT much better than any other ...
5
votes
3answers
152 views

A WinAPI C++ program for printing the master boot record of the hard drive

I have rolled this program for reading the MBR: ...
3
votes
3answers
237 views

C++ upgradable RW lock implementation

I am using VS 2017 with C++ 17 standard set on Windows OS. What I'm missing in couple of heavily threaded projects is synchronizing mechanism that can be atomically upgraded from shared to exclusive ...
-1
votes
1answer
140 views

Scanning the subnet by ip range

By applying the get_name and get_mac functions to the specified IP address, it is possible to estimate the network availability ...
4
votes
2answers
293 views

Get module entry by name from external program via WinAPI

I'm asking myself if there's any better/shorter way of getting a module entry by its name from an external process. This is the code I have so far: ...
4
votes
0answers
126 views

Recreated Microsoft's Console Registry Tool's query functionality in C++ (REG.exe)

I decided to try and recreate Microsoft's REG.exe query functionality."Reg.exe" is Microsoft's Console Registry Tool. I used Microsoft's documentation of "reg query" to recreate it's functionality ...
7
votes
0answers
885 views

Using multiple console windows for output

In my current project I found the need to concurrently track the progress of multiple concurrent components, and having all of them output their (debug) information into a single console window made ...
2
votes
0answers
103 views

WinAPI 32 wrapper in C

This is a piece of code using this wrapper to create a simple window and handle some of it's events in Windows environment. ...
1
vote
3answers
137 views

Send command and get response from Windows CMD prompt silently - follow-up

This post is an updated version of the original post, with the code examples below reflecting changes in response to very detailed inputs from user @pacmaninbw. The updated source examples below also ...
7
votes
1answer
1k views

Snake game for Windows console, avoiding flicker from system(“cls”)

I just completed my own implementation of the classic snake using what I consider to be unique methods. Rather than having a map be cleared over and over again using ...
1
vote
1answer
216 views

HTTP download with dynamic reallocation and retries

This code is for downloading a file via winhttp lib, It's invoked by StartDownload function which tries to download n times before returning false if maximum tries ...
1
vote
0answers
106 views

Exposing LocalDB API to VBA

SQL Server has had LocalDB since 2012. The main primary purpose for the LocalDb is to support developers without requiring a full install and running a service. However, a LocalDb can be also used in ...
2
votes
1answer
303 views

Two-layer RAII to support a critical section

For the code, if one considers using RAII to encapsulate CriticalSection (global scope), two RAII layers are needed: ...
3
votes
1answer
249 views

Protected Pointer: a unique_ptr wrapper that auto encrypts and decrypts data in memory

When dealing with sensitive data, it should be protected from modification and unauthorized viewing as much as possible. This is what this ProtectedPtr class aims to do: encrypt your data when you ...
3
votes
0answers
31 views

Rewriting the GnuWin32 Touch Command with the Win32 API

There are essentially two options for Windows users accustomed to the *nix command-line functionality; you have to either download a framework like Cygwin/Msys or use the GnuWin32 packages (of which I ...
2
votes
0answers
94 views

Changing window buffer and size in C with WinAPI

I wrote a code to change window buffer and size in a console app with C. Background: I had trouble with changing window buffer and size in C with WinAPI. Simply calling system("mode con cols=XX lines=...
2
votes
2answers
240 views

Clipboard util made in WinAPI

I've made a small click-to-copy clipboard util in WinAPI that doesn't steal focus, stays on top of all windows, can be dragged and simulates Ctrl+V keystrokes if needed. What can be improved and are ...
1
vote
1answer
543 views

Implementation of IPC circular buffer

For a school assignment we had to implement IPC between two processes using File Maps with some specific requirements. The relevant requirements are: ComLib will send a null-terminated (C-style) ...
5
votes
1answer
97 views

C++ password generator with WinAPI clipboard function

I made a simple password generator with a copy-to-clipboard functionality implemented via WinAPI calls. Here is the code: ...
2
votes
1answer
292 views

Creating a unique ID for an application on runtime

This seems to work on some version of windows and acts weird on others. This is unstable and redundant. How can I improve this in a way that it has the same expected behavior through every windows ...
5
votes
1answer
177 views

Conway's Game of Life in Win32/GDI

I've implemented Conway's Game of Life using the raw Windows API and GDI as an exercise. I'm wondering if there is room for improvement, though. Beware, large amount of code following: CGOL.h: <...
8
votes
1answer
401 views

Send command and get response from Windows CMD prompt silently

The need: I needed a method to programmatically send commands to the Windows 7 CMD prompt, and return the response without seeing a console popup in multiple applications. The design: The ...
2
votes
1answer
222 views

Memory management for fetching a list of drive letters on Windows

I'm using the WinAPI GetLogicalDriveStrings() function that requires a LPWSTR and am wondering if there is a safer way to do ...
3
votes
0answers
178 views

Repainting real-time data during a modal loop in a Windows dialog

The following code will start a timer to continue drawing real-time data (that has been pre-buffered, to be swapped in the gui as fast as it can) to the window during repositioning or inside a menu ...
1
vote
0answers
84 views

Compact a file of 'Compound binary file format'

I am working on a modelling application written in C++ and MFC. The generated model is saved as a compound file. For various reasons, I need to compact the compound file therefore I decided to write a ...
10
votes
1answer
3k views

Windows Keylogger

I am newbie (here and in C/C++ - WinAPI) so I want to ask you, what you think about my Windows Keylogger in C++? I've worked on it a few days. Features of keylogger for now: Self-copying to C:\ ...
3
votes
2answers
3k views

Safely handling memory allocation across DLL boundaries in Windows

I know that, in Windows, memory must be deallocated in the same module that allocated it. I have 2 DLLs built with different C++ compilers (VS 6 and VS 2015). In the VS 2015 module, I have an ...
4
votes
2answers
123 views

File chunk buffer for Windows programs

The purpose of the ChunkBuffer code below is to designate a "chunk" from a given input file and to loop that chunk (if needed). Its operation is similar to the ...
5
votes
1answer
132 views

Win32/C: Notepad wrapper that automatically converts Unix line endings to Windows line endings

At my work we're dealing with a lot of PHP files written by a third-party company and sometimes we want to "quickly look at" these files in Notepad rather than having to open up a full IDE. The ...
4
votes
1answer
668 views

Task-Based Overlapped IO In .NET

I've been working wrapping the Windows API's Overlapped methods in the more usable Task based approach. There isn't much information out there on doing this, so I've been flying blind apart from a few ...
4
votes
2answers
3k views

Minesweeper C++

This is my improvement of a minesweeper game I took from the internet, which I am quite proud of. Nevertheless I am willing to hear your opinions, suggestions, and comments. ...
1
vote
2answers
41 views

Code in patched Cygwin for calculating path to command interpreter

I'm working on a fork of Cygwin for native Windows development. In this commit, I'm trying to improve the security of code that spawns cmd.exe, used by functions ...
4
votes
0answers
652 views

Custom hotkey like AutoHotkey

I'm making a hotkey program to aid me using PC faster. By saying hotkey here, I mean any combination of two or more keys in the keyboard. For example, if I press G, hold it then press M, I have ...
3
votes
1answer
1k views

Handling GetTickCount() overflow in timeouts

This is code which must run on XP, so no GetTickCount64, and which should correctly handle the value wrapping around after 49 days. Can it be improved? ...
1
vote
0answers
3k views

OpenCV-based wrapper for Windows screen capture

I have written a ScreenVideoCapture class that implements an interface for capturing frames from a specified monitor connected to the PC. It uses OpenCV structures (...
6
votes
2answers
1k views

Change list separator, parse file, restore list separator to original value

Following up on @Vogel612's friendly advice from the vba-rubberducking chat room, I am posting my working code for open review. Thanks also to @Mat'sMug for the ...
1
vote
1answer
369 views

Fixed time step game loop

I'm writing a Direct2D game in c++ / WinAPI. I need to render things 60 times every a second using fixed time step. ...
2
votes
1answer
4k views

Implementing a memory scanner in python

I'm trying to implement a memory scanner in python. The problem is, it's too slow. What it does it gets a number from the command line and compares it to every address, then writes it to an output ...
5
votes
2answers
107 views

LifeSaver: Hides and manipulates windows

[ This app is now on github !! ] This is a small program I wrote to hide/show different windows on my Windows PC. This is named LifeSaver because it did save my ...
2
votes
1answer
3k views

getProcID and getProcessHandle functions

I made two functions: one to get process id and the other to get a handle with all access to that process using the process id. I'm looking for help with making these easy to use on all types of ...
2
votes
2answers
248 views
15
votes
5answers
242 views

Step by Step, ooh HotKey

Still hooked on Windows, I refactored the hook into a number of interfaces, and I wanted to support 2-step hotkeys, so I started with defining an IHook that can be ...
24
votes
2answers
4k views

Hooked on Windows

The code that was just added to Rubberduck will allow us to set up hotkeys for our features, so that next release, Ctrl+Shift+R brings up the refactor/rename dialog, for example. The requirements ...
1
vote
1answer
1k views

Double buffering Gdiplus and GDI

I have this working code and was wondering how I can optimize it. Is there anything I can declare globally so it does not need to be be created over and over? This function is called around 30 times a ...