Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9073169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T18:21:12+00:00 2026-06-16T18:21:12+00:00

I am trying to make a tool in C++ that interacts with the OS

  • 0

I am trying to make a tool in C++ that interacts with the OS functions, but I’ve never did anything similar before, so I don’t even have a clue on where to search for an answer.

Here’s an overview example of what I would like to make :

Let’s say I have a number of text files stored in a folder. Every file has some text in it and a password (just string, no encryptions). What I want to do, is enter a key-word (eg “1”, or “2”, or whatever the key-word is) and then a password will be selected amongst the files. Now, I know how to do all this “simple” stuff, my problem comes next :

Once I find the password – let’s say the password will be stored in a String psw variable – I want to copy psw string into the “buffer” (or whatever that is) that my OS (let’s say Windows) uses for the function “copy” (Ctrl + C). This resulting in : the next time I hit Ctrl+V, psw will be pasted.

Example of use :
A user runs the .exe and a window opens. He then enters a key-word and a password is selected and added to the “buffer” that handles the “copy” function. The programm may terminate at this state, or wait for another password (we don’t care about it anymore). Now, let’s say the user creates a text file, hits Ctrl + V and a password is pasted into the text file, without any other interactions from the user-side inbetween.

And here’s are my questions :
Is this even possible or should I give up on the idea ?
If yes, I would appreciate any help, tutorial, or some pattern on where to search for this.

Thanks in advance !

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T18:21:14+00:00Added an answer on June 16, 2026 at 6:21 pm

    This is more of a “Windows” answer than it is a “C++” answer, but the code below will work in C or C++.

    On windows, you pragmatically “paste”strings into the clipboard via the Win32 API.

    void PasteString(const char* pszPhrase)
    {
        int len = strlen(pszPhrase);
        BOOL fResult = FALSE;
    
        fResult = OpenClipboard(GetDesktopWindow());
    
        if (fResult == FALSE)
        {
            return;
        }
    
        HGLOBAL hglob = GlobalAlloc(GHND, len+1);
        void* pGlobalMemory = GlobalLock(hglob);
    
        strcpy((char*)pGlobalMemory, pszPhrase);
    
        GlobalUnlock(hglob);
    
        EmptyClipboard();
        SetClipboardData(CF_TEXT, hglob);
        CloseClipboard();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to make a Java tool that will scan the structure of
I'm trying to make a tool that takes jpeg images (4 images) from a
I'm trying to make a tool that lets me design my GUIs in Interface
I am trying to make my design mobile friendly. What I have is that
I am trying to make a basic conversion tool that i will expand on
I'm trying to make a cropping tool that will look as follow: Original Image:
I'm trying to make a model reflection tool. I have come a long way
Here's the problem: I'm trying to make a small reporting tool. So... I have
I am trying to make a tool that allows me to choose a certain
I'm trying to put together a tool that will help me make work schedules.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.