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 7649543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:59:34+00:00 2026-05-31T10:59:34+00:00

For my informatics studies I have to write a Space Invaders Clone using Windows

  • 0

For my informatics studies I have to write a Space Invaders Clone using Windows API.

One of our tasks is to write and display a Highscore list which works very well.
If you have lost all credits you should be able to write your name into the highscore list (if you have enough points).
Windows API has no easy possibility to get a text input so I wrote an own version that works not as I want it to.
I use pName to write the name and save it into an array called “Name”.
This array is used to save the Highscore and the name together into the Highscore.txt.
The Saving progress is working fine so far.

But my problem now is:
I’m able to write letters but they’re sorted automatically.
So if i input: asdf
it is sorted: adfs

I can’t see any code that does something like that so where’s my fault?

Thank you guys!
Greets Michael

bool HighScore::EnterName(HDC hdc)
{

    #define VK_A 0x41 
    #define VK_B 0x42
    #define VK_C 0x43
    #define VK_D 0x44
    #define VK_E 0x45
    #define VK_F 0x46 
    #define VK_G 0x47
    #define VK_H 0x48
    #define VK_I 0x49
    #define VK_J 0x4A
    #define VK_K 0x4B
    #define VK_L 0x4C 
    #define VK_M 0x4D
    #define VK_N 0x4E
    #define VK_O 0x4F
    #define VK_P 0x50
    #define VK_Q 0x51
    #define VK_R 0x52
    #define VK_S 0x53
    #define VK_T 0x54 
    #define VK_U 0x55
    #define VK_V 0x56
    #define VK_W 0x57
    #define VK_X 0x58
    #define VK_Y 0x59
    #define VK_Z 0x5A


        string pName;

            if(GetKeyState(VK_A)) pName.append("A"); if(GetKeyState(VK_B)) pName.append("B");
            if(GetKeyState(VK_C)) pName.append("C"); if(GetKeyState(VK_D)) pName.append("D");
            if(GetKeyState(VK_E)) pName.append("E"); if(GetKeyState(VK_F)) pName.append("F");
            if(GetKeyState(VK_G)) pName.append("G"); if(GetKeyState(VK_H)) pName.append("H");
            if(GetKeyState(VK_I)) pName.append("I"); if(GetKeyState(VK_J)) pName.append("J");
            if(GetKeyState(VK_K)) pName.append("K"); if(GetKeyState(VK_L)) pName.append("L");
            if(GetKeyState(VK_M)) pName.append("M"); if(GetKeyState(VK_N)) pName.append("N");
            if(GetKeyState(VK_O)) pName.append("O"); if(GetKeyState(VK_P)) pName.append("P");
            if(GetKeyState(VK_Q)) pName.append("Q"); if(GetKeyState(VK_R)) pName.append("R");
            if(GetKeyState(VK_S)) pName.append("S"); if(GetKeyState(VK_T)) pName.append("T");
            if(GetKeyState(VK_U)) pName.append("U"); if(GetKeyState(VK_V)) pName.append("V");
            if(GetKeyState(VK_W)) pName.append("W"); if(GetKeyState(VK_X)) pName.append("X");
            if(GetKeyState(VK_Y)) pName.append("Y"); if(GetKeyState(VK_Z)) pName.append("Z");

            TextOut(hdc, 20, 200, "TRAGE DEINEN NAMEN EIN",22);

            if(GetAsyncKeyState(VK_BACK)) pName.erase(pName.begin() + pName.length()-1);

            sprintf(Name,"%s", pName.c_str());
            TextOut(hdc, 50,250,Name, strlen(Name));

            return true;
}
  • 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-05-31T10:59:36+00:00Added an answer on May 31, 2026 at 10:59 am

    I found a soultion that was pretty easy.
    I made a big fault that I couldn’t see after hours of programming:
    I initiate my string pName again ang again from the beginning. So I moved it to my constructor and now it all works fine.
    To get a better sensibility, you have to change

    (GetKeyState(VK_LETTER))

    to

    (HIWORD(GetAsyncKeyState(VK_LETTER)))
    

    Now it works much better!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Rails 2. I have resources nested like this: - university_categories - universities
There is one controversy I see in using Web APIs (RESTful service) to access
Our build process uses Visual Studios 2003 link.exe for linking. On one machine we're
I'm trying to write an SQL query that will gather certain data in one
Environment: Windows XP. Visual Studios 2010. Language - C++. I have run into the
In informatics theory I hear and read about high-level and low-level languages all time.
Information: I have a site that has a design on index.php, and then you
Does Information Hiding mean I should minimize the number of properties my classes have?
Some information on A/B split-testing: http://startuplessonslearned.blogspot.com/2008/09/one-line-split-test-or-how-to-ab-all.html http://www.37signals.com/svn/posts/1525-writing-decisions-headline-tests-on-the-highrise-signup-page I could do this in a Rails
Background Information: Ultimately, I would like to write an emulator of a real machine

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.