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
25
votes
2answers
5k 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 ...
16
votes
5answers
303 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 ...
15
votes
2answers
3k views

Win32 File API in VBA

Win32 File API Wrapper Based on a few fundamental frustrations with VBA (namely the lack of ability to work with files larger than 2GB, the lack of encapsulation of the file functions and the lack of ...
13
votes
1answer
1k 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 ...
11
votes
1answer
325 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 ...
10
votes
1answer
5k 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:\ ...
10
votes
1answer
1k views

Send command and get response from Windows CMD prompt silently

Note - The response to reviews in this post is here. The need: Simply stated: _popen() for Windows I needed a method to programmatically send commands to the ...
8
votes
1answer
631 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 ...
7
votes
1answer
2k views

Testing if TreeView's node is checked

I have recently answered a question on Stack Overflow where OP wanted to programmatically determine if TreeView's node is checked or not, among other things. My ...
7
votes
1answer
3k 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 ...
7
votes
1answer
3k 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 ...
7
votes
0answers
141 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 ...
6
votes
1answer
178 views

Porting ProcMonDebugOutput from C# to VBA

This code has one public method. ProcMonDebugOutput(). It will sent a string of text to Process Monitor that process monitor will display. I'm basically ported ...
6
votes
1answer
163 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 ...
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 ...
6
votes
3answers
3k views

Class to wrap Netapi32.dll functions

I have made a class for some Netapi32.dll functions in C#. I would like to know if there are any big problems with it or if there is some other function needed in general. Functions: ...
6
votes
1answer
4k views

WinAPI code for DNS queries

This is just some test code I'm doing to learn C++11. It compiles and runs consistently. But is anything wrong that will eventually (or under slightly different circumstances) fail? Besides ...
6
votes
1answer
159 views

Wormhole - a Windows shim app written in C with no stdlib

My application compiles and seems to work correctly, but this is my first C project so I welcome any criticism. I developed this in Pelles C with no standard lib. Efficiency and optimizations are more ...
6
votes
1answer
103 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 ...
5
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. ...
5
votes
3answers
2k views

WinInet C++ Wrapper

Because I don't like complex sequences of code for simple functions, I wrote a wrapper for http/https access in A++. Are there any bad programming practices I am using? Is there any functionality I ...
5
votes
2answers
2k views

Disk enumeration and file listing

I am writing C++ code to enumerate the whole HDD and drive listing. However, it takes more than 15 minutes to complete the disk enumeration of all drives (HDD capacity of 500GB) and compile the ...
5
votes
3answers
941 views

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

I have rolled this program for reading the MBR: ...
5
votes
2answers
152 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 "...
5
votes
1answer
264 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: <...
5
votes
1answer
80 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): ...
5
votes
1answer
137 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: ...
5
votes
2answers
7k 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 ...
5
votes
1answer
185 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: ...
5
votes
1answer
162 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
2answers
150 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 ...
4
votes
1answer
1k views

Window Creation Wrapper Class

This Question now has a follow-up here I don't think that there is any new technique in my code but in my opinion it's ok all in all (with a bit of magic). Maybe you can find something to improve or ...
4
votes
2answers
111 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 ...
4
votes
1answer
57 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 ...
4
votes
3answers
1k 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 ...
4
votes
1answer
88 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 ...
4
votes
1answer
463 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 ...
4
votes
2answers
1k 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
2answers
115 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 ...
4
votes
1answer
3k views

Asking Windows for real-time priority

This code snippet is about asking Windows for the highest possible execution priority. Basically, we have to ask for real-time priority class for the entire process, after which each thread has to ask ...
4
votes
1answer
55 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, ...
4
votes
1answer
1k 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
0answers
80 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
0answers
3k 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....
4
votes
0answers
185 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 ...
4
votes
0answers
892 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
97 views

Collecting all instances of an Office application (Excel, PowerPoint, Word)

A project of mine required me to search for certain workbooks in open instances of Excel. I found this article Code to get Excel, Word, PowerPoint from window handle which returns the applications ...
3
votes
2answers
622 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
158 views

Wrapping WinAPI FindNextVolume as std iterator

This is my first attempt at creating an STL-style iterator. Is this code ok? ...
3
votes
1answer
1k views

std::string/std::wstring template wrapper for Win32 API

I have not completed this but want to make my own template library for wrapping the Win32 API to make it compatible with std::string/std::wstring... Here's a sample of what I've worked with so far. ...