Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C++ (http://www.go4expert.com/forums/cpp/)
-   -   Make The Program Run At Startup - need help - C++ (http://www.go4expert.com/forums/program-run-startup-help-cpp-t25005/)

Scripting 16Feb2011 19:10

Make The Program Run At Startup - need help - C++
 
Hey guys, I'm gonna make a joke on the teacher of mine :D. I'm gonna send her an E-mail with a exe file, which has to have ICON of Microsoft power point, and it's function is to mess up the mouse cursor, so she won't be able to use that mouse, and i need that program to add itself to the registry (or somewhere else) to make it run at startup.


And I have already made Cursor messing up code, but i'm having problems with that adding it to the registry. I need Ur HELP !!!

BTW. I also don't know how to add an ICON to that program.

And I Use C++


Here is the code of mine ( to mess up the mouse cursor):
Code:

#include <windows.h>
#include <ctime>

int rnd(int, int);

int main() {
  srand((unsigned)time(0)); // seed random
 
  /* I have added some explanation for U aneesh :D */
  /* Get the screen resolution */
  int SCR_WIDTH =      GetSystemMetrics(SM_CXSCREEN) - 1;
  int SCR_HEIGHT =  GetSystemMetrics(SM_CYSCREEN) - 1;

  int xspeed, yspeed;
  int x = SCR_WIDTH / 2, y = SCR_HEIGHT /2; // start in middle of screen

  for(int g = 0; g < 100; g++) { // do program 100 times and then quit

      /*  random x and y speed between -10 and 10
        minus x will make it go left, plus x right
        minus y up and plus y down */
      xspeed = rnd(-10, 10);
      yspeed = rnd(-10, 10);

      for(int i = 0; i < 10; i++) {       
        x += xspeed;
        y += yspeed;       
        SetCursorPos(x, y);

        /* Check for hitting the side of screen */
        if(x >= SCR_WIDTH) {
            xspeed = -xspeed; // convert plus to minus or minus to plus
        } else if(x <= 0) {
            xspeed = -xspeed;
        } else if(y >= SCR_HEIGHT) {
            yspeed = -yspeed;
        } else if(y <= 0) {
            yspeed = -yspeed;
        }

        Sleep(10);
      }
  }

  return 0;
}

int rnd(int min, int max) {
  return rand() % (max - min) + min;
}


jimblumberg 16Feb2011 19:17

Re: Make The Program Run At Startup - need help - C++
 
You really don't expect help on Malware do you?

Jim

shabbir 16Feb2011 20:13

Re: Make The Program Run At Startup - need help - C++
 
The help that you need is not for malware. To have anything run at startup you need to make entries in Registry at

[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Curr entVersion\Run]

Scripting 17Feb2011 01:55

Re: Make The Program Run At Startup - need help - C++
 
Yeah, I know that I have to make registry entry, but I expected someone will tell me how to :(

I mean, i want that program to add itself to that registry when I run it (BTW. It's for scientific purposes :) )


And I have in registry folders - [Run, Run-, RunOnce], so which do I have to choose?

jimblumberg 17Feb2011 06:21

Re: Make The Program Run At Startup - need help - C++
 
[quote=shabbir;79423]The help that you need is not for malware. To have anything run at startup you need to make entries in Registry at

Quote:

I'm gonna send her an E-mail with a exe file, which has to have ICON of Microsoft power point, and it's function is to mess up the mouse cursor, so she won't be able to use that mouse, and i need that program to add itself to the registry (or somewhere else) to make it run at startup.
If this description is not malware then what is?

Jim

shabbir 17Feb2011 07:33

Re: Make The Program Run At Startup - need help - C++
 
[QUOTE=jimblumberg;79449]
Quote:

Originally Posted by shabbir (Post 79423)
The help that you need is not for malware. To have anything run at startup you need to make entries in Registry at



If this description is not malware then what is?

Jim

What I meant is Putting anything in startup is not malware. He was generous to tell what his exe does but if you don't know then it can be any application running in background.

jimblumberg 18Feb2011 01:43

Re: Make The Program Run At Startup - need help - C++
 
But the fact remains the OP did tell us what his program is to do. And by telling him anything you will helping in the manufacture of malware. Shouldn't you as an administrator of this web site try to prevent this? Shouldn't you be at least closing this thread, if not taking actions against the OP, to send a message that this site does not condone malware of any kind?

Jim

shabbir 18Feb2011 06:59

Re: Make The Program Run At Startup - need help - C++
 
See this. http://www.pctools.com/guides/registry/detail/109/

What I am explaining is pretty much what is in that article. Use of that can be done in either way.

Scripting 18Feb2011 21:05

Re: Make The Program Run At Startup - need help - C++
 
Quote:

Originally Posted by shabbir (Post 79504)
See this. http://www.pctools.com/guides/registry/detail/109/

What I am explaining is pretty much what is in that article. Use of that can be done in either way.

Thx Shabbir, I regard highly your help, but I know everything about simply regystry, but I need to understand EDITING REGISTRY in C++, E.g Use RegOpenKeyEx(), RegGetValue(), RegSetKeyValue(), RegCloseKey() etc.

shabbir 18Feb2011 21:49

Re: Make The Program Run At Startup - need help - C++
 
Yes those functions can help


All times are GMT +5.5. The time now is 03:42.