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.

Filter by
Sorted by
Tagged with
9
votes
1answer
152 views
+100

Small C project: recording mouse/keyboard bot software

This is, kind of, my first programming project. It's a small project to complete first year's university programming course. The program allows the user to record his mouse/keyboard/cursor ...
4
votes
1answer
82 views

Windows API Declarations For Compatibility

This is an extension of my Reusable Progress Indicator post. I realised that I needed to add additional compiler constants for compatibility of the Windows API functions used in the ...
0
votes
1answer
82 views

Simple “Connect 4” game

I made this easy game to improve my C++. The functions like NoFlicker and ShowCursor are copied from the Internet, but I made <...
2
votes
1answer
57 views

Excel - Visual Basic For Applications - Mastermind Game

For those who are unfamiliar with the game: https://en.wikipedia.org/wiki/Mastermind_(board_game) A link to the workbook: https://github.com/Evanml2030/Excel-Mastermind Had trouble getting the ...
3
votes
0answers
87 views

Simple C++ Console Snake Game

I'm a beginner programmer and i'm looking for interesting projects to improve my low skills. I decided to spend one evening on simple snake game in console. I made it with the help of YouTube tutorial....
6
votes
1answer
87 views

Tic Tac Toe console game in C++ (w/graphic)

I have finished a simple Tic Tac Toe game, and I'd like if anyone was to give advice to how I could improve my code. main.cpp ...
5
votes
2answers
133 views

First C program: records keyboard/mouse and simulates the recording afterwards

This is my first program ever made in C. Before that I programmed just a little bit in C++ (didn't touch OOP so I did only structural programming). This is my second "project" ever made, the first "...
10
votes
0answers
213 views

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
56 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. https://github.com/Evanml2030/Excel-ArrayFunctions API CALLS ...
5
votes
1answer
70 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
138 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
35 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
90 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
134 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
183 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
322 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 ...
0
votes
1answer
172 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
487 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
145 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
1k 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
106 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
149 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
267 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
114 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
352 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
318 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
33 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
132 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
283 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
618 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
104 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
337 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
189 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
462 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
261 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 ...
2
votes
0answers
202 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
91 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
4k 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
4k 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
127 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
136 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
730 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
3answers
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
42 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
773 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
4k 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
2k 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
383 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. ...