Thread: Simple maybe, but confusing at first.

  1. #1
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342

    Talking Simple maybe, but confusing at first.

    With NOTHING in the function main() or WinMain(), make your program display a window, or, just message box.

  2. #2
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    Make an empty program and then hex edit it randomly so you get some kind of error

  3. #3
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,273
    #define something silly.

    #define main(){ main(){display a window, or, just message box.

    int main(){}

    Heh, don't even have to hexedit it. Just open it with notepad or something, and write your name somewhere

  4. #4
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    >> Heh, don't even have to hexedit it. Just open it with
    >> notepad or something, and write your name somewhere


    Actually, I meant by your program, not by the OS's confusion.
    And not with a #define either.

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Code:
    class foo {
      int *p;
      public:
        foo() {
          p = 0; *p = 0;
        }
    };
    foo bar;
    int main ( ) { return 0; }
    I get a nice "would you like to tell Microsoft about this problem" message popup
    Do whatever you like in the constructor for your globals to avoid writing any code in main
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  6. #6
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    New York
    Posts
    1,905
    Code:
    #include <windows.h>
    
    class MsgBox
    {
    public:
      MsgBox() { MessageBox(NULL,TEXT("Hello!"),TEXT("Rock!"),MB_OK); }
    };
    
    MsgBox mb;
    
    int main()
    {
    }
    *shakes his fist at salem*

  7. #7
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    >> Do whatever you like in the constructor for
    >> your globals to avoid writing any code in main

    Yes, that's exactly what I was thinking of.

  8. #8
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,273
    I always found this one interesting
    Code:
    class parent
    {
    private:
    
    public:
    	parent()
    	{
    		cout<< "CONSTRUCTOR!";
    	}
    };
    
    parent dsfdf;
    int main( void )
    {
        return 0;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  2. Simple simple program
    By Ryback in forum C++ Programming
    Replies: 10
    Last Post: 09-09-2004, 05:48 AM
  3. what SHOULD be a painfully simple API call...
    By Citizen Bleys in forum Windows Programming
    Replies: 3
    Last Post: 09-17-2003, 03:20 PM
  4. A VERY simple program is confusing me..HELP PLEASE!
    By BBain80 in forum C++ Programming
    Replies: 3
    Last Post: 02-27-2002, 04:42 PM
  5. Simple Compile Time Problem - HELP!
    By kamikazeecows in forum Windows Programming
    Replies: 2
    Last Post: 12-02-2001, 01:30 PM