Simple maybe, but confusing at first.

This is a discussion on Simple maybe, but confusing at first. within the A Brief History of Cprogramming.com forums, part of the Community Boards category; With NOTHING in the function main() or WinMain(), make your program display a window, or, just message box....

  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,262
    #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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,551
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  6. #6
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    University of Waterloo
    Posts
    1,903
    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,262
    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, 03:42 PM
  5. Simple Compile Time Problem - HELP!
    By kamikazeecows in forum Windows Programming
    Replies: 2
    Last Post: 12-02-2001, 12:30 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21