PDA

View Full Version : Simple maybe, but confusing at first.



Queatrix
09-17-2006, 11:06 AM
With NOTHING in the function main() or WinMain(), make your program display a window, or, just message box. :D

maxorator
09-17-2006, 11:09 AM
Make an empty program and then hex edit it randomly so you get some kind of error :p

twomers
09-17-2006, 11:14 AM
#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 :p

Queatrix
09-17-2006, 11:19 AM
>> Heh, don't even have to hexedit it. Just open it with
>> notepad or something, and write your name somewhere
:p

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

Salem
09-17-2006, 11:32 AM
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

jverkoey
09-17-2006, 11:34 AM
#include <windows.h>

class MsgBox
{
public:
MsgBox() { MessageBox(NULL,TEXT("Hello!"),TEXT("Rock!"),MB_OK); }
};

MsgBox mb;

int main()
{
}

*shakes his fist at salem*

Queatrix
09-17-2006, 11:43 AM
>> 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.

twomers
09-17-2006, 11:54 AM
I always found this one interesting

class parent
{
private:

public:
parent()
{
cout<< "CONSTRUCTOR!";
}
};

parent dsfdf;
int main( void )
{
return 0;
}