Hello, I'm a Freshman in college that's going to majoring in Electrical and Computer Engineering. Right now I'm taking a C++ class and I'm looking to do something funny to a friend of mine. I have been searching the web for some "fake viruses" and whatnot to to play around with him for fun. I joined here in hopes of getting more help on this and other C++ questions.

I found this code and I'm looking to add a little more to it.

#include <windows.h>
int main()
{
    int BlockInput;
  const int TIMES = 50;

  Beep(50, 2000);
  
  MessageBox (NULL, "'X' Releases Your Information to http://www.perpiratz.net/ \n'Ok' Inserts a Trojan Virus \n \n Hávè á ñícè ¡Yôí! \n(-:þ " , "C:\\CBU NETWORK DIRECTORY..." ,0);
  
  for (int i = 0; i < TIMES; i++, Sleep(200))
    SetCursorPos(900, 900);

  Beep(70, 2000);
  
}

No I'm not trying to do anything malicious or harmful to his computer. I'm just looking to have fun.

Is there a way that I can loop a MessageBox depending on which answer he clicks on? And is there a way that I can disable his Alt-key on the keyboard?

Thanks!

P.S.
If you have any other suggestions for things to add into the program that would be funny then that will be cool also.

Recommended Answers

All 13 Replies

Grow up! I am 14 years old and I don't do shit like that! There is much more fun stuff in programming than fake-viruses!

PS: how can he click anything if you keep his mouse locked up in one place??

Couldn't not answer a question.
In case you will use this knowledge for something good & productive:
Message box returns int value. You can check it with some of the windows #defines.
For example:

int whichone = MessageBox(NULL, TEXT("Will you stop doing immature stuff?"), TEXT("Confirm"), MB_YESNO);
    switch(whichone) {
    case IDYES: {
        cout << "Right choice";
        break;
    }
    case IDOK: {
        cout << "No Ok button. This is impossible xD";
        break;
    }
    case IDNO: {
        cout << "Grow up";
        break;
    }

    case IDABORT:
        cout << "No abort button either";
        break;

    case IDCANCEL: {
        cout << "Cancel";
        break;
    }
    case IDIGNORE: {
        cout << "IGNORE";
        break;
    }


    case IDRETRY: {
        cout << "Try again";
        break;
    }

    }
commented: Does it really matter? Giving negative rep for a post helping a user is childish. -1

Well I'm glad that you are more mature than me. Maybe you will get farther in life than I ever will. Congrats.

Yes I do know that there many more things to do with programming than make "fake-viruses." That's reason I'm majoring in it. -.-

Yes you can still click with the mouse. You can edit the "const int TIMES = #" to change how many times he would have to move his mouse. You can just log off the user to stop it early. (reason for why I asked how to disable the alt-key.

commented: :) +4

No, I am not saying I am more mature then you. I am just saying people may not take you as a serious programmer if you do pranks like that. But I guess it can be a good experience, and you can learn something new :)
For the Alt-question: I am not really good at Windows programming, (I program mostly for Linux), but I found this on Google. But this can be a bit too complicated since you are probably a beginner with Windows programming stuff. The .DLL has a function called CtrlAltDel_Enable_Disable() and it says this on the top

/*****************************************************************
 * Enable/Disable Ctrl+Alt+Del and Ctrl+Shift+Esc key sequences. *
 * TRUE=Enable, FALSE=Disable                                    *
 * (Win 2K).                                                     *
 *****************************************************************/
int DLL_EXP_IMP WINAPI CtrlAltDel_Enable_Disable(BOOL bEnableDisable)
{

so this probably works only for Win2000. Unfortunately, I do not have access to a Windows machine right now, so I cannot test it.

No I'm not trying to do anything malicious or harmful to his computer. I'm just looking to have fun.

Fake viruses tend not to go over well as pranks. I've heard stories of students suspended or expelled for benign but seemingly malicious software. My suggestion would be to take a page from the early hackers and be a little more creative in your fun.

Well I'm glad that you are more mature than me. Maybe you will get farther in life than I ever will. Congrats.

Yes I do know that there many more things to do with programming than make "fake-viruses." That's reason I'm majoring in it. -.-

Yes you can still click with the mouse. You can edit the "const int TIMES = #" to change how many times he would have to move his mouse. You can just log off the user to stop it early. (reason for why I asked how to disable the alt-key.

Don't listen to the "kid." He just puts on a different persona when he is on these forums to make him seem mature. I am also a freshman in college and fake viruses are fun to play with. Well, on topic, you can add the following code to perform a loop:

for (;;){

So your code should now look like this:

#include <cstdlib>
#include <iostream>
#include <windows.h>

using namespace std;

int main(int argc, char *argv[])
{
     int BlockInput;
     const int TIMES = 50;
 
    Beep(50, 2000);
    for (;;){
    MessageBox (NULL, "'X' Releases Your Information to http://www.perpiratz.net/ \n'Ok' Inserts a Trojan Virus \n \n Hávè á ñícè ¡Yôí! \n(-:þ " , "C:\\CBU NETWORK DIRECTORY..." ,0);
}
    for (int i = 0; i < TIMES; i++, Sleep(200))
    SetCursorPos(900, 900);
 
    Beep(70, 2000);
    system("PAUSE");
    return EXIT_SUCCESS;
}

This loops the MessageBox to perfection ;)

Also, to disable keys, from what I have had experience with, you would have to edit the registry which I would not recommend.

Hope this helps and just try to ignore the little kids on the web because we all know they will not make it with the attitude they have.

commented: Sure I am immature, but not unlike you. Why don't you listen to Narue if I am so immature? :) -1
commented: Because he's more immature than you... -4

Grow up! I am 14 years old and I don't do shit like that! There is much more fun stuff in programming than fake-viruses!

PS: how can he click anything if you keep his mouse locked up in one place??

I am in no way diminishing your coding knowledge nor am I saying making fake viruses is "fun" per say but if that is what he wants to do then by all means just help him out and move on.

Well, I did help him out because I am here to help with programming, not to judge people. But I do not see why my age should keep me from having, and expressing my own opinions. Narue basically said the same thing as me, but you do criticize her because she is more grown up and have more rep then you. And if the only excuse you have not to listen to me is "I am a little kid", then you are just pathetic.

Ok well thanks for all the help. I have no problem with whoever helps with me or anyone. As long as help is being done. So I will try it out.

I was afraid that the only way that I would be able to disable keys in C++ would involve me editting the registry. So I'm not going to do it.

With this going bad, the guy, who is also a ECE major, I do this to knows I have done this kind of stuff before, tricks, and he finds it very amusing. :)

This is also a way that I like learning how things. I guess you can call it reverse engineering or trial and error. And I will probably be asking for some C++ Homework help sometime in the future. So thanks guys! :)

Well, I did help him out because I am here to help with programming, not to judge people. But I do not see why my age should keep me from having, and expressing my own opinions. Narue basically said the same thing as me, but you do criticize her because she is more grown up and have more rep then you. And if the only excuse you have not to listen to me is "I am a little kid", then you are just pathetic.

That is not my excuse at all. I was just stating that your "overactive" attitude gets in the way of how you need to treat other people. I know she has more posts and rep than I but I have been on here since August 23rd, or somewhere in there, and I already have 135+ posts. I have been contributing to the site as much as possible and if the post count determines the knowledge or the credibility of a user then I do not see why anyone would join the community Dani has created for us.

I personally love the site because it is all about what I like to do and what I am doing as a profession so that is why I am on the site as much as I have time to be. I just hate to see when someone posts just to criticize another user.

I just hate to see when someone posts just to criticize another user.

Well, ironically, all you did in the last 2 post was criticize me. OP's question was answered so lets end this thread.

Quote from your negative rep:

Does it really matter? Giving negative rep for a post helping a user is childish.

You did exactly the same :D I guess acting childish is so beast, that you have to copy "the kid". ;)

... but I have been on here since August 23rd, or somewhere in there, and I already have 135+ posts. I have been contributing to the site as much as possible and if the post count determines the knowledge or the credibility of a user...

It does not. I've seen members rack up more posts in 1 week than you have in 2 months. 99% of their posts were crap, error filled, and just bad advice.

Not saying your posts are bad, just saying post count means nothing specific -- other than pointing out who has a life and who doesn't :icon_wink:

It does not. I've seen members rack up more posts in 1 week than you have in 2 months. 99% of their posts were crap, error filled, and just bad advice.

Not saying your posts are bad, just saying post count means nothing specific -- other than pointing out who has a life and who doesn't :icon_wink:

I know it doesn't. I guess the way it came across was confusing. :P

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.