Skip to main content
GameDev.net gamedev.net
🔒 Locked

OMG C++

Started by nes8bit Sep 26, 2002 at 2:23 AM 94 replies 1.3k views
Original Post
nes8bit
nes8bit
Whee! I''m learning C++ #include <windows.h> WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd){ HWND lHandle; MSG MyMessage; WNDCLASS w={0,DefWindowProc,0,0,hInstance,0,0,0,0,"test"}; RegisterClass(&w); lHandle = CreateWindow("test","test",0x14CF0000,10,10,100,100,0,0,hInstance,0); while(MyMessage.message!=18) { PeekMessage(&MyMessage, 0, 0, 0, 1); Sleep(1); } DestroyWindow(lHandle); return 0; } uhh...what do I do next?
klems
klems
Wouldn''t it be easier to use the supplied WM_* defines (while(MyMessage.message!=WM_CLOSE) instead of
while(MyMessage.message!=18))?




Three shall be the number thou shall count, and the number of the counting shall be three...

nes8bit
nes8bit
Actually, that part I stole from Pouya''s tetris clone and it doesn''t even work for me anyway. >_<

Yeah, not the best example of code to look at ^_^
bishop_pass
bishop_pass
quote:
Original post by nes8bit
Whee! I''m learning C++

Dawn of a new era...

_______________________________
"To understand the horse you'll find that you're going to be working on yourself. The horse will give you the answers and he will question you to see if you are sure or not."
- Ray Hunt, in
TrickyWoo
TrickyWoo
:|
www.matazone.co.uk/kitty1.html
nes8bit
nes8bit
I''m trying to pick up on Pouya''s style too...It''s just so frickin hard to read and write with. How the hell can anyone tell me that C++ code is easier and more structured than VB code...

#include <windows.h>
WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd){HWND lHandle;MSG MyMessage;WNDCLASS w={0,DefWindowProc,0,0,hInstance,0,0,0,0,"test"};RegisterClass(&w);lHandle = CreateWindow("test","test",0x14CF0000,10,10,100,100,0,0,hInstance,0);while(MyMessage.message!=18) {PeekMessage(&MyMessage, 0, 0, 0, 1);Sleep(1);}DestroyWindow(lHandle);return 0;}
Beer Hunter
Beer Hunter
quote:
Original post by nes8bit
uhh...what do I do next?
Perhaps you could try out a resource editor and the CreateDialog / DialogBox calls.
bishop_pass
bishop_pass
Why don''t you write some command line progs before you venture into the ugly world of Windows code?
_______________________________
"To understand the horse you'll find that you're going to be working on yourself. The horse will give you the answers and he will question you to see if you are sure or not."
- Ray Hunt, in
nes8bit
nes8bit
That''s what I''ve been writing, but it bothers me. I''ve been playing with Windows API for so long that I need to at least learn how to create a window.

And uhh...I don''t feel like playing with MFC.
DrunkenBastard
DrunkenBastard
Remember the only thing you should bring over from vb is the use of goto. Now you''ll probably hear a lot of C++ people bash the goto, but that''s just because it''s sort of an insider secret. I don''t mind telling you because I got kicked out of the SSCPPPG(Super Secret C++ Programmers Group), a subdivision of the Illuminiti, for a certain incedient with the presidents wife. Ya that''s right Fuck the SSCPPPG. Now your little secret is out. What ya gonna do now bitches. And another thing they don''t want you to know is
Oh wait theres a knock at the door. brb
** Drunken bastard gets hauled away in a black van **

------------------------------
p.s. excuse me english. im from L.A.
nes8bit
nes8bit
That''s has to be the worst advice I''ve ever had thrown at me. O_O



Someone tell me he''s joking!
bishop_pass
bishop_pass
Why don''t you write a maximum flow algorithm for the purpose of determining the minimum vertex cut of a graph?
_______________________________
"To understand the horse you'll find that you're going to be working on yourself. The horse will give you the answers and he will question you to see if you are sure or not."
- Ray Hunt, in
bishop_pass
bishop_pass
quote:
Original post by nes8bit
I wouldn''t even know how to do that in VB

Perfect! No chance of translating bad habits!

_______________________________
"To understand the horse you'll find that you're going to be working on yourself. The horse will give you the answers and he will question you to see if you are sure or not."
- Ray Hunt, in
Liquid Darkness
Liquid Darkness
Yeah, nes and I are taking the same C++ class. He thinks that learning C++ from pouya''s tetris clone is a GOOD idea...


O____________________O

all I can say is... Go jump off a cliff!
=-=-=-=-=-=-=-=-=-=-=-=-----I am a signature virus. Please add me to your signature so that I may multiply.
Kazan
Kazan
Hehe, pouya may be a good coder but I don''t think you should follow his code. I seem to remember seeing some of his code that went:



string O_O = "O";
char >_< = ''_'';

for(blah blah something)
{
O_O += >_<;
}

O_O += ''O'';



Or something like that

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.