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
4
votes
1answer
32 views

Trivial string-reverser in MASM64

I've been learning MASM64 over the last few days and written a simple demo, so I can get feedback on my understanding of x64 assembly programming. It's really basic: it asks the user for their name, ...
9
votes
1answer
86 views

Audio visualizer in C++

I have completed my first attempt of a simple music visualizer app for windows in C++ using SDL. It takes system audio and outputs the soundwave in real-time. I'd appreciate some feedback on how I can ...
5
votes
1answer
134 views

A simple C WinAPI program for terminating processes via process image names - folllow-up 2

(See also the previous follow-up.) Now, I seem to improve my program partially via the answer in my previous follow-up. It goes like this: ...
2
votes
1answer
57 views

A simple C WinAPI program for terminating processes via process image names - follow-up

(See the previous (i.e. first) version of this tool.) (See the next follow-up.) After taking into consideration all the advice by Martin R, I ended up with the following tool for terminating all the ...
5
votes
1answer
77 views

A simple C WinAPI program for terminating processes via process image names

(Also, see the next iteration.) I have this small program for terminating processes via their respective process image names (.exe files): ...
4
votes
0answers
57 views

Basic snake game in C

I wanted to learn C and Win32 so I thought the best way to start would be to create a simple game to get familiar with the language, so I made Snake. The games works perfectly except for sometimes ...
4
votes
2answers
80 views

Lowering the CPU usage when capturing and dividing screenshots into blocks using GDI+

I am trying to capture the screen content of each monitor I have and divide each captured bitmap into small blocks (wxh=128x128). I managed to do this using the GDI+ API, but my implementation (on ...
1
vote
0answers
23 views

Wrapper function that returns cached value from WinAPI call [closed]

I am writing myself a little wrapper and I decided to cache values that shouldn't change (often or at all) for returning to the user, I'm coming from the premise that the WinAPI call is more expensive ...
1
vote
1answer
71 views

Internally Safe Filesystem

win_xept.hpp - a basic windows api exception ...
4
votes
1answer
72 views

Compare folders and find common files

I found this Powershell command useful in comparing folders and find common and different files. Since I really like C and C++, I've decided to create a program to do that. It will get all files in 2 ...
3
votes
1answer
92 views

Check mp4 integrity in c++

I have a big collection of MP4 files and an unstable internet connection so I use this batch file to check for the files integrity. Having posted this primitive code and received valuable reviews, I ...
3
votes
0answers
133 views

Taking a screenshot of a particular window

I've got a function which takes a screenshot of a particular window. It's important that the screenshot works whether the window is focused/covered by other windows or not, hence why I've used ...
1
vote
1answer
103 views

Scoped thread using modern C++

I wrote this simple scoped thread to use it as a class member to ensure the the thread running on a class method doesn't continue running after the class has been destructed. Also to spawn threads ...
2
votes
1answer
49 views

Recursively find files of certain types and log their paths (C++)

I've written a function that takes a list of extensions and recursively finds files of those types, and logs their paths to a text file. Usage example (finding image files in a home directory): <...
2
votes
1answer
151 views

filesystem create a folder

I got a mixture of two languages ​​C and C ++ The code finds the folder my documents and creates additional folders in it when the program starts, I found no other way to implement this better. I ...
3
votes
0answers
42 views

Network connection monitor

I was recently in need of a class that checks if a computer has a valid internet connection, so I wrote one; however, I feel that there is a better way to do so and I just don't have the knowledge ...
4
votes
1answer
53 views

This program reads from serial port, Saves this to a text file, increments file name each time it is run

I want to condense it and get rid of any noob programming errors. The code works fine but I know it's not as elegant as it could be and I really want to improve. Your advice would be brilliant! I've ...
11
votes
1answer
250 views

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
229 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
486 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
226 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
232 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
120 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
138 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 "...
13
votes
1answer
645 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
85 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 ...
7
votes
0answers
110 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
648 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 ...
6
votes
1answer
98 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
256 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
486 views

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

I have rolled this program for reading the MBR: ...
4
votes
3answers
842 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
237 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
840 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
171 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
2k 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
115 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. ...
2
votes
3answers
237 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
2k 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
424 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
137 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 ...
3
votes
2answers
523 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
521 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
35 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
230 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
404 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
827 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
113 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
415 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
222 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: <...