Thread: Could do with help combining two working programs.

  1. #1
    edd of all trades
    Join Date
    Feb 2006
    Location
    Stafford, England
    Posts
    24

    Could do with help combining two working programs.

    Hello again, I've been messing around, which is my preferred way of learning. For my first program I'm making a small practical joke to play on some friends. I'm almost done, but could do with a little hand, so any help would be greatly appreciated.

    What the program does is pretend to steal some form of account details, even though it blatantly doesn't. As a said, it's just a little joke.
    I've made 2 programs that both work, and wanted to combine them into one program, but that's where I'm having difficulty. Here are the two programs:
    Code:
    #include <windows.h>
    #include <iostream>
    #include <fstream>
    using namespace std;
    
    int main()
    
    {
    cout<<"Obtaining information";
    Sleep(400);
    cout<<".";
    Sleep(400);
    cout<<".";
    Sleep(400);
    cout<<".";
    Sleep(800);
    cout<<"\nCreating pass_dump.txt";
    Sleep(400);
    ofstream a_file ("pass_dump.txt");
    a_file<<"Relax! You really think I'd /*edited out*/ my friends over?";
    a_file.close();
    cout<<"\npass_dump.txt has been created.\nAttempting to send";
    Sleep(400);
    cout<<".";
    Sleep(400);
    cout<<".";
    Sleep(400);
    cout<<".";
    Sleep(2000);
    cout<<"\npass_dump.txt successfully sent to /*edited out*/@hotmail.com";
    }
    Code:
    #include <windows.h>
    int APIENTRY WinMain(HINSTANCE hInstance,
                         HINSTANCE hPrevInstance,
                         LPSTR     lpCmdLine,
                         int       nCmdShow)
    {
     	
    	MessageBox(0, "Never trust a dodgy .exe! You just got pwned, fool.", "\"eddwills pwnz u\"", 0);
    	return 0;
    }
    (Excuse the leet speak.)
    I took the messagebox from the tutorials, which have been pretty darn good to me so far, but I'm having troubles getting them both to run as one program. I just want the messagebox to appear after the stuff in cmd.

    Also, is there a way to state where a file is created? I'd quite like that "pass_dump.txt" to be on the user's desktop, but it's not too important.

    Thanks again, Edd.

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    Code:
    #include <windows.h>
    #include <iostream>
    #include <fstream>
    using namespace std;
    
    int main()
    
    {
    cout<<"Obtaining information";
    Sleep(400);
    cout<<".";
    Sleep(400);
    cout<<".";
    Sleep(400);
    cout<<".";
    Sleep(800);
    cout<<"\nCreating pass_dump.txt";
    Sleep(400);
    ofstream a_file ("pass_dump.txt");
    a_file<<"Relax! You really think I'd /*edited out*/ my friends over?";
    a_file.close();
    cout<<"\npass_dump.txt has been created.\nAttempting to send";
    Sleep(400);
    cout<<".";
    Sleep(400);
    cout<<".";
    Sleep(400);
    cout<<".";
    Sleep(2000);
    cout<<"\npass_dump.txt successfully sent to /*edited out*/@hotmail.com";
    MessageBox(0, "Never trust a dodgy .exe! You just got pwned, fool.", "\"eddwills pwnz u\"", 0);
    }

  3. #3
    edd of all trades
    Join Date
    Feb 2006
    Location
    Stafford, England
    Posts
    24
    Whaaaat it was that simple? Haha, thanks! Maybe one day I'll understand what all the other stuff means, but it obviously isnt necessary for this. Brilliant stuff! Thanks a lot.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Got any tutorials or programs?? Send them to my web site!
    By robmil29 in forum C++ Programming
    Replies: 6
    Last Post: 09-27-2004, 11:38 AM
  2. POSIX/DOS programs?
    By nickname_changed in forum C++ Programming
    Replies: 1
    Last Post: 02-28-2003, 05:42 AM
  3. executing c++ programs on the web
    By gulti01 in forum C++ Programming
    Replies: 4
    Last Post: 08-12-2002, 03:12 AM
  4. Release MFC Programs & Dynamic MFC DLL :: MFC
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 05-18-2002, 06:42 PM
  5. Programs Communicating
    By Drek in forum C++ Programming
    Replies: 1
    Last Post: 01-26-2002, 04:47 PM