Hii guys (:
I've been programming in c/c++ for about 6 - 8 month now, mostly game stuff, which might be why i'm asking this newbie question ^^
I got tired of playing around with SDL and Opengl efter a while, and i thought to myself "What do you want to achive with programming?", and i guess my answer was "it all"
But right now i'm making my own little kinda cmd chat, right now just for localhost.
My problem is getting the keystrokes converted to strings/words, so that it does not just buffer a single letter at the time, but submit the whole word or sesntence. i just deleted my whole project and started from scratch so this is all my code so far;
#include <iostream>
#include <windows.h>
#include <Winuser.h>
#include <time.h>
using namespace std;
int main()
{
TCHAR pcName [250];
TCHAR userName [250];
DWORD pcSize = 20;
DWORD userSize = 20;
SYSTEMTIME st;
GetLocalTime(&st);
if(!GetComputerName(pcName,&pcSize))
{
cout << "Size: " << pcSize << "\tError Code: " << GetLastError() << std::endl;
}
if(!GetUserName(userName,&userSize))
{
cout << "Size: " << userSize << "\tError Code: " << GetLastError() << std::endl;
}
cout << "(";
cout << st.wDay;
cout << "/";
cout << st.wMonth;
cout << "/";
cout << st.wYear;
cout << " - ";
cout << st.wHour;
if((int)st.wMinute < 10)
{
cout << ":0";
} else
cout << ":";
cout << st.wMinute;
cout << ":";
cout << st.wSecond;
cout << ")";
cout << " -> ";
cout << pcName;
cout << " -> ";
cout << userName << endl;
system ("PAUSE");
return 0;
}
And in the other runs/tests i'v been using GetAsyncKeyState() to detect the keystrokes. Anybody have any lessons to teach me?
Thanks a lot on advantage. Sincerly Wunder..