Skip to main content
OverflowAI is here! AI power for your Stack Overflow for Teams knowledge community. Learn more

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
3 answers
2k views

Executing a shell command OS-independently

The goal of the code is to convert a Graphviz DOT file to an SVG file, and it achieves this by creating a child process and executing the "dot" command. ...
Harith's user avatar
  • 6,696
1 vote
1 answer
87 views

A Windows localhost key logger in C++ with WinAPI

Now I have this repository. It's a key logger logging all the keyboard events possible. Note that some programs do not "leak" the keyboard events outside of their GUI. For example, Notepad++ ...
coderodde's user avatar
  • 28.4k
2 votes
1 answer
105 views

ReadDirectoryChangesW Improvements

I'm currently using the ReadDirectoryChangesW Function from the Windows API to build a Directory Watcher. The Watcher should monitor a folder for newly added files. ...
Kevin's user avatar
  • 147
0 votes
1 answer
80 views

wtpdmt - Windows thread preemption duration measurement tool (C++)

I have this repository. The idea is that the user may measure for how long the thread is preempted with given priority class/thread priority. CommandLineParser.h: <...
coderodde's user avatar
  • 28.4k
2 votes
1 answer
64 views

Windows: Programmatically uninstall the NumberPad from ASUS ZenBook

Now I have this funny program. I bought an ASUS ZenBook which includes NumberPad. The downside of it is that it turns on with a slightest touch on its upper right corner so that I start write numeric ...
coderodde's user avatar
  • 28.4k
2 votes
1 answer
455 views

Sending and receiving files in C win32 using a socket

I have a piece of code to send and receive files on Windows with C. Is this the right way to do it? And am I guaranteed that the full file will be sent and received? Receiving function: ...
Y K's user avatar
  • 83
2 votes
2 answers
193 views

A C++ WinAPI program for changing the process priority classes via PIDs - take 2

After improving the previous post, I came up with the following program: ...
coderodde's user avatar
  • 28.4k
4 votes
1 answer
208 views

A C++ WinAPI program for changing the process priority classes via PIDs

(See the next iteration .) I have this program (call it, for example, prioset.exe), that asks for two command line arguments: (1) the target process PID, (2) a ...
coderodde's user avatar
  • 28.4k
1 vote
1 answer
122 views

Code for setting all child controls to the default message font on Windows

If you aren't aware, if you hand-code a GUI with the Windows API you will find your controls look quite ugly by default due to their font. Running this code: ...
Govind Parmar's user avatar
6 votes
1 answer
2k views

Proper way to send and receive buffer in Winsock

I have a piece of code to send and receive buffers. Is this the right way to do it? And am I guaranteed that the full buffer will be sent and received? receiving function: ...
Y K's user avatar
  • 83
2 votes
1 answer
197 views

Program to check if a window is opened or not during some time interval

I'm trying to write a program that will check if a window is opened or not, during a given time. I was able to do that, but now I'm trying to make my code look cleaner. I don't like how I implement ...
Minh Hoang's user avatar
6 votes
3 answers
1k views

Safe Windows API Timers for Excel

Update Feb 2023 This solution is no longer maintained here or on GitHub, mainly because I do not need a timer solution anymore. As seen below, the only purpose of this approach was to get a reliable, ...
Cristian Buse's user avatar
1 vote
2 answers
349 views

A small C WinAPI program moving the cursor in a circle

So the program below will move the mouse cursor in a circle all 360 degrees for 2,5 seconds (after 2,5 seconds, the program exits and the user can use his/her cursor normally). ...
coderodde's user avatar
  • 28.4k
1 vote
1 answer
187 views

A C WinAPI program for showing the color of the screen pixel pointed to by mouse cursor with clipboard support - follow up

(See the previous question.) Now I have incorporated some suggestions by Barmak Shemirani. See what I have: ...
coderodde's user avatar
  • 28.4k
4 votes
2 answers
275 views

A C WinAPI program for showing the color of the screen pixel pointed to by mouse cursor with clipboard support

(See the follow-up question.) I have this program that shows a small window and that window shows a rectangle whose color is the same as the color of the pixel under the mouse cursor. Note that it ...
coderodde's user avatar
  • 28.4k
2 votes
1 answer
132 views

Windows 10 wallpaper-scroller script with Gif support

Intro: Hello, I'm a python beginner. I haven't had anyone use my code or anything. I want to improve and become a "professional python developer". I thank you for taking the time to help me ...
Valthalin's user avatar
  • 121
3 votes
0 answers
388 views

Evaluate performance of DLL calls from VBA

While playing with a VBA project involving Windows APIs, I have noticed some odd behavior: API calls under Excel 2016/VBA7/x64 appeared to be much slower than under Excel 2002/VBA6/x32. Since I ...
PChemGuy's user avatar
  • 425
1 vote
1 answer
497 views

Win32 UI with tabs and buttons

I am making a UI library for the fun of it, and decided to use move semantics instead of pointers with new/delete. Everything is working, but I am not satisfied. Given this code: ...
Shigoto Shoujin's user avatar
3 votes
1 answer
804 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 ...
TinMan's user avatar
  • 4,133
1 vote
1 answer
174 views

C++ winapi scale2x algorithm. Is it well implemented?

taking into account the scale2x algorithm for scaling an image to 2x. Im using winapi in an Emulator. When tha scale2x algorithm is used i don't see too much difference in the image scaled2x as it ...
Lucas 's user avatar
  • 111
2 votes
1 answer
428 views

Win32 Snake game

I made a trival snake game below to practice my C++ and Win32 programming skills. ...
Jimmy Yang's user avatar
1 vote
1 answer
37 views

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

(See the previous version here.) What's new get_last_err_msg renamed to MyGetLastErrorMessage The caller to ...
coderodde's user avatar
  • 28.4k
1 vote
2 answers
2k views

Simple Win32 API Calculator in C

I've been learning C as my first language and recently I decided to learn how to create Win32 apps written in C. I Quickly realized, though, that my biggest challenge wasn't writing the Win32 app ...
rieger60's user avatar
2 votes
1 answer
639 views

Getting hard-drive serial number on Windows

The point is to get the serial number of one of the hard drives on Windows. My code is based on an example from MSDN. I tried to make it an exception-safe, self-contained function. It works, to the ...
Aykhan Hagverdili's user avatar
2 votes
0 answers
792 views

Reading stdout and stderr of a sub process using Win32, Overlapped I/O

I'm writing C++ Windows code that will start a process, then read its stdout and stderr, separately, into buffers. If I try to just read the streams one at a time it may hang if the child process is ...
user11693's user avatar
4 votes
1 answer
138 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, ...
mdx's user avatar
  • 143
9 votes
1 answer
2k 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 ...
KyleL's user avatar
  • 191
5 votes
1 answer
242 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: ...
coderodde's user avatar
  • 28.4k
2 votes
1 answer
87 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 ...
coderodde's user avatar
  • 28.4k
4 votes
0 answers
106 views

Reduce size of minesweeper program to fit in qr code

I saw a guy who fit snake in a qr code and I wanted to do the same thing but with minesweeper. The maximum amount of data a qr code can hold is 3kb. My c program, without any compiler magic, takes up ...
TryingMyBest's user avatar
5 votes
1 answer
107 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): ...
coderodde's user avatar
  • 28.4k
4 votes
0 answers
128 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 ...
Da man's user avatar
  • 41
4 votes
2 answers
213 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 ...
SuperKogito's user avatar
1 vote
1 answer
96 views

Internally Safe Filesystem

win_xept.hpp - a basic windows api exception ...
user avatar
4 votes
1 answer
580 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 ...
user10191234's user avatar
3 votes
1 answer
132 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 ...
user10191234's user avatar
4 votes
0 answers
2k 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 ...
Edge's user avatar
  • 149
2 votes
1 answer
681 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 ...
dev65's user avatar
  • 313
2 votes
1 answer
109 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): <...
Emptypyho's user avatar
2 votes
1 answer
1k 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 ...
1221's user avatar
  • 23
3 votes
0 answers
59 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 ...
rickmanalexander's user avatar
4 votes
1 answer
114 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 ...
Joel Gray's user avatar
11 votes
1 answer
491 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 ...
weno's user avatar
  • 209
4 votes
1 answer
1k 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 ...
rickmanalexander's user avatar
0 votes
1 answer
2k 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 <...
Dalibor Trampota's user avatar
2 votes
1 answer
661 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 ...
learnAsWeGo's user avatar
3 votes
1 answer
10k 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....
Unknown-reader's user avatar
6 votes
1 answer
221 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 ...
Nadpher's user avatar
  • 889
5 votes
2 answers
208 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 "...
weno's user avatar
  • 209
13 votes
1 answer
2k 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 ...
user644361's user avatar