Jump to content

  • Log In with Google      Sign In   
  • Create Account


Creating a WINDOW !!


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
21 replies to this topic

#1 Metal Typhoon   Members   -  Reputation: 122

Like
Likes
Like

Posted 29 June 2001 - 12:45 PM

Hi. Since i know c++ the basic already, I want to jump to windows programming. ok, i know it a little hard but can anyone tell me how to create a window using win32 API , and nto MFC ? one thing i think i'll have to include is windows.h right ? Oh if you don't want to write anything just tell me a web site so i can check it out. Thanks i really appreciate your help. One more time THANK YOU "The shortcut is not always the best way " Metal Typhoon Edited by - Metal Typhoon on June 29, 2001 8:03:46 PM

Sponsor:

#2 MiniZap   Members   -  Reputation: 122

Like
Likes
Like

Posted 29 June 2001 - 01:27 PM

You don''t know the basics or you would know how, if you had half a brain you know that you should go buy a book on windows programming for those answers. Your threads are so common and your questions so easily found in a book that you really are getting annoying. This forum is not your personal reference.

#3 Metal Typhoon   Members   -  Reputation: 122

Like
Likes
Like

Posted 29 June 2001 - 01:47 PM

K man! i won''t ask anymore !

"The shortcut is not always the best way "

Metal Typhoon

#4 Greg Rosenblatt   Members   -  Reputation: 219

Like
Likes
Like

Posted 29 June 2001 - 01:54 PM

I highly recommend this tutorial on Win32 by theForger.
This is exactly what you need if you''re going the non-MFC route.


"Don''t be afraid to dream, for out of such fragile things come miracles."

#5 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 29 June 2001 - 02:09 PM

quote:
Original post by MiniZap
You don''t know the basics or you would know how, if you had half a brain you know that you should go buy a book on windows programming for those answers. Your threads are so common and your questions so easily found in a book that you really are getting annoying. This forum is not your personal reference.


The thread is called for beginners that is the entire purpose of this forum. And some people don''t want to pay $50 for a beginners book.


#6 MiniZap   Members   -  Reputation: 122

Like
Likes
Like

Posted 29 June 2001 - 02:41 PM

As I said its for beginners not for people who need to buy some books. I bought a perfectly good newbie book for $35 and its my favorite one I own!

#7 Metal Typhoon   Members   -  Reputation: 122

Like
Likes
Like

Posted 29 June 2001 - 03:07 PM

quote:
Original post by Anonymous Poster
[quote]Original post by MiniZap
You don''t know the basics or you would know how, if you had half a brain you know that you should go buy a book on windows programming for those answers. Your threads are so common and your questions so easily found in a book that you really are getting annoying. This forum is not your personal reference.


The thread is called for beginners that is the entire purpose of this forum. And some people don''t want to pay $50 for a beginners book.


Thanks man ! Redleaf i''ll take a look at that k ! thank too !

"The shortcut is not always the best way "

Metal Typhoon

#8 Metal Typhoon   Members   -  Reputation: 122

Like
Likes
Like

Posted 29 June 2001 - 04:55 PM

What are the ways u can create a window ? I know that Win32 API is one, also MFC. Are those the only ones ?

"The shortcut is not always the best way "

Metal Typhoon

#9 deadlinegrunt   Members   -  Reputation: 123

Like
Likes
Like

Posted 29 June 2001 - 05:54 PM

quote:
What are the ways u can create a window ? I know that Win32 API is one, also MFC. Are those the only ones ?

Yes and no.

The win32api is the only way to create a window under Windows. MFC is a framework that abstracts the win32api . So by the MFC definition you technically can use various different frameworks like YACL , WCL , and BCL for example. They are alternative window frameworks you can use as well. Please note that these are not the only other options)
DirectX, OpenGL, SDL , etc all provide their own unique interfaces for creating windows as well. Some attach to win32api window you make, others create their own. The bigger question is what kind of window do you need? Are you just inquiring to obtain cleft knowledge on this subject or do you need to acomplish something in particular? In any event, the words in bold are easily looked up by just about any search engine on the net and can even yield detailed information about how to create a window...

YAP-YFIO
-deadlinegrunt

Edited by - deadlinegrunt on June 29, 2001 12:55:37 AM

#10 Metal Typhoon   Members   -  Reputation: 122

Like
Likes
Like

Posted 29 June 2001 - 06:29 PM

K i got u. I have one more question. If i want to use a OpenGL or DirectX stuffs do i have to create their own window, like i'm using OpenGl i have to create a OpenGl window ? or can i just create a window using win32 and then put openGL ?

"The shortcut is not always the best way "

Metal Typhoon

Edited by - Metal Typhoon on June 30, 2001 1:32:29 AM

#11 Verso   Members   -  Reputation: 122

Like
Likes
Like

Posted 29 June 2001 - 06:42 PM

OpenGL can be a lot easier when you first start because of the glut library - it will automatically create windows, switch screen modes, etc.

To answer the question... you create a window, and then ''put'' DX or GL to it.

#12 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 29 June 2001 - 06:46 PM

If you use GLUT, you don''t have to worry about any window code.
It takes care of all that for you. You just have to supply the
OGL code. If you do know C++ and you want to learn windows, I
really suggest that you go out and purchase a book. Tricks of
the Windows Game Programming Gurus by Andre LaMothe would be
excellent for you. It was my first book and I see it being a
useful reference years down the road. It is well worth the $50.

#13 Psylocybe   Members   -  Reputation: 130

Like
Likes
Like

Posted 29 June 2001 - 08:29 PM

Well... here is the code to simply initialize,create, and display a window that outputs the text "waaaaaaaaaaaaazup" using MFC and vc++ 6.0; make sure you check settings to: Use mfc in a shared dll , under project|settings menu; I definately suggest you buy a book there is alot of stuff to programming windows and you will need to apply a good deal of it programming games.

// hello.h

class CMyApp : public CWinApp
{
public:
virtual BOOL InitInstance ();
};

class CMainWindow : public CFrameWnd
{
public:
CMainWindow ();

protected:
afx_msg void OnPaint ();
DECLARE_MESSAGE_MAP ()
};
/////////////////////////////////////////////////////////////////

// hello.cpp

#include
#include "Hello.h"

CMyApp myApp;

BOOL CMyApp::InitInstance ()
{
m_pMainWnd = new CMainWindow;
m_pMainWnd->ShowWindow (m_nCmdShow);
m_pMainWnd->UpdateWindow ();
return TRUE;
}

BEGIN_MESSAGE_MAP (CMainWindow, CFrameWnd)
ON_WM_PAINT ()
END_MESSAGE_MAP ()

CMainWindow::CMainWindow ()
{
Create (NULL, _T ("waaaaaaaaazup"));
}

void CMainWindow::OnPaint ()
{
CPaintDC dc (this);

CRect rect;
GetClientRect (&rect);

dc.DrawText (_T ("Hello, MFC"), -1, &rect,
DT_SINGLELINE | DT_CENTER | DT_VCENTER);
}


#14 lower_case   Members   -  Reputation: 122

Like
Likes
Like

Posted 29 June 2001 - 08:55 PM

minizap, you're stupid.

he said he knows the basics of C++, c++ has nothing to do with creating a window you fool. What are you some microsft lover that thinks ooh microsoft is the only OS so therefore creating a window must be a known thing?

[Now now, let's all play nice together -- deadlinegrunt*]

ok.. anyway.

If you're willing to spend some money. There is a huge ass book called Programming Windows by Charles Petzold, contains almost everything in the win32api.


CrappySoft - game production team with a punk attitude. Mail me if you want to make levels, art etc.

*Personally I see both yours and minizips points. Content edited regardless...


Edited by - deadlinegrunt on June 30, 2001 4:21:55 AM

#15 Metal Typhoon   Members   -  Reputation: 122

Like
Likes
Like

Posted 30 June 2001 - 03:13 AM

I was looking forward those two books, The programming window , the definiti guide to win32 API is 55 dollars and The Tricks of
the Windows Game Programming Gurus is 45. If i get those book will it get me started in windows programming ?

"The shortcut is not always the best way "

Metal Typhoon

#16 the Dealy Lama   Members   -  Reputation: 122

Like
Likes
Like

Posted 30 June 2001 - 03:59 AM

I've got Tricks of the Windows Game Programming Gurus and Programming Windows, and I've found them both to be excellent books.

Tricks has just a few chapters on strictly windows programming, before it delves in DirectX 6.1. It's a somewhat accelerated, streamlined introduction to windows programming: it doesn't tell you everything you'll need to know, just enough to get started. I found it very useful to be able to get windows progs up and running quickly. But then I reached a point where I wanted to do more.

So I got Programming Windows. That book, combined with the MSDN, shows you how to do pretty much anything that can be done in windows.

Both those books are excellent for teaching the windows api, but the best reference is simply the MSDN.

=======================================
Matt Welch

"What sounds to you like a big bloat of trashy old noise
is in fact the brilliant music of a genius--myself" ~ Iggy Pop


Edited by - the Dealy Lama on June 30, 2001 11:02:34 AM

#17 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 30 June 2001 - 04:22 AM

Hi...

well, I gues that if you want to programm videogames with a basic knowledge od C++ you''re gonna have problems.... really

I really prefer programing on Linux-gtk, MUCH MUCH easyer than on windows , and you use about 10 lines of code to create a window ( vs 70 from windows)

how ever... I strongly recommend you "tricks of the Windows game programming gurus" to get started on windows game programing =)

nice day

jakovo

#18 Psylocybe   Members   -  Reputation: 130

Like
Likes
Like

Posted 30 June 2001 - 01:45 PM

If your using c++ then you will probably want to buy PROGRAMMING WINDOWS WITH MFC by prosise as it is the oop implementation of the windows API. All mfc is is just an object oriented wrapper around the windows api. If you dont want to learn mfc then go ahead with petzold''s book. And if you dont have the money to buy either one then have fun searching the net for endless hours trying to find everything you need.

#19 JDog   Members   -  Reputation: 122

Like
Likes
Like

Posted 30 June 2001 - 02:03 PM

Well If you have MSVC then you have one of the greatest resources a windows programmer can have. That MSDN library disk covers almost every window''s api function. One quick search and I can find just about anything about Windows Programming. Also the extra articles included are priceless because sometimes the Microsoft technical references can sound like gibberish.

-Good luck

#20 Scooter   Members   -  Reputation: 109

Like
Likes
Like

Posted 30 June 2001 - 02:27 PM

Thought I'd go ahead and post some simple junk:


// Includes
#define WIN32_LEAN_AND_MEAN

#include windows.h
#include stdlib.h
#include stdio.h
#include time.h
#include math.h


LRESULT CALLBACK WndProc(HWND hWnd, UINT message,WPARAM wParam, LPARAM lParam );

// WinMain

HWND mWnd;

int WINAPI WinMain( HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine, int iCmdShow )
{
WNDCLASS wc; HWND hWnd; HDC hDC; HGLRC hRC; MSG msg;
BOOL bQuit = FALSE;

// register window class
wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_ICON1);
wc.hCursor = LoadCursor( NULL, IDC_ARROW );
wc.hbrBackground = (HBRUSH)GetStockObject( BLACK_BRUSH );
wc.lpszMenuName = NULL;
wc.lpszClassName = "MyWindow";
RegisterClass( &wc );

hWnd = CreateWindowEx(NULL, "MyWindow", "MyWindow", WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,CW_USEDEFAULT, CW_USEDEFAULT, 640, 480, NULL, NULL, hInstance, NULL);

// Display the window
ShowWindow(hWnd,SW_SHOW);
UpdateWindow(hWnd);

mWnd = hWnd;

// program main loop
while ( !bQuit ) {

// check for messages
if ( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) ) {

// handle or dispatch messages
if ( msg.message == WM_QUIT ) {
bQuit = TRUE;
} else {
TranslateMessage( &msg );
DispatchMessage( &msg );
}

} else {


}

}

// destroy the window explicitly
DestroyWindow( hWnd );

return msg.wParam;

}

// Window Procedure

LRESULT CALLBACK
WndProc( HWND hWnd, UINT message,
WPARAM wParam, LPARAM lParam )
{

switch ( message ) {

case WM_CREATE:
return 0;

case WM_CLOSE:
PostQuitMessage( 0 );
return 0;

case WM_DESTROY:
return 0;

case WM_KEYDOWN:
switch ( wParam ) {

case VK_ESCAPE:
PostQuitMessage( 0 );
return 0;

}
return 0;

default:
return DefWindowProc( hWnd,
message, wParam, lParam );

}

}







Edited by - Scooter on June 30, 2001 9:28:52 PM




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS