Public Group

#### Archived

This topic is now archived and is closed to further replies.

# Non MFC Window Tutorial!

This topic is 5687 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello everyone...i''ve been searching far and wide of a Non MFC Windows tutorial because like every I know we all hate Microsoft.(their code is so sloppy) and I hate their MFC crap...well anyway I don''t like making anything windows specific. "By thy keyboard and thy hand, thou shall be created!"

##### Share on other sites
First off, you''re probably not going to get a very good response to your request, given that you''re bashing Microsoft while trying to learn Windows programming, not a very stable position. Remember who you are trying to get information from before you piss anybody off.

Second, I agree that MFC is bloated and Windows specific, but so is Win32, which I assume you were thinking of as a "Non MFC Windows" API. Someone may correct me here, but I can''t think of any API that would allow you to create a window in Windows and be platform independent. It''s kinda an operating system specific task.

Thirdly, if you try searching the web using a search engine like Google, you will notice that there are quite a few Win32 tutorials out there and you don''t need to ask the question here. A little initiative will get you a long way. Here''s one to start off: theForgers Win32 API tutorial. Look for others and you will find them.

##### Share on other sites
quote:

I know we all hate Microsoft.(their code is so sloppy)

There is a large pro-microsoft community that visit''s these forums. It is not advisable to bash microsoft on these forums. I am pro-microsoft and I feel that the MFC architecture is much easier then the win32 equivalent.

quote:

i''ve been searching far and wide of a Non MFC Windows tutorial
..and..
well anyway I don''t like making anything windows specific.

The most popular "Non MFC Windows" is win32 and has many tutorials - but if your looking for a windows API that is platform independent try QT though it is much slower then win32 and MFC because it is platform independent.

##### Share on other sites
If you want to do hardcore stuff, MFC ends up being a royal pain in the butt.

All in all, "MFC = crap" I agree. And I'm VERY pro Microsoft.
IMO, C# System.Windows.Forms is what MFC should have been like.

As for Win32 code, Here's some stuff to get you going:

    #include <windows.h>HINSTANCE ghInstance; // global HInstance for whenever you need to create more windows elsewhere.int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdParam, int nCmdShow){	HWND		hwnd;	MSG		msg;	WNDCLASS	wndclass;  // main window class	wndclass.style = CS_HREDRAW | CS_VREDRAW;	wndclass.lpfnWndProc = WndProc;	wndclass.cbClsExtra = 0;	wndclass.cbWndExtra = 0;	wndclass.hInstance = hInstance;									  	wndclass.hIcon = NULL;	wndclass.hCursor = LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW));	wndclass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);	wndclass.lpszMenuName = NULL;	wndclass.lpszClassName = "Blarg";	RegisterClass(&wndclass);	hwnd_main = CreateWindow("Blarg", "Title!", //class, title		WS_OVERLAPPEDWINDOW, //style		100, 100, 10, 10,	//x, y, width, height		NULL, NULL, hInstance, 0);	ShowWindow(hwnd_main, nCmdShow);	UpdateWindow(hwnd_main);	ghInstance = hInstance;	while (GetMessage(&msg, NULL, 0, 0))	{		TranslateMessage(&msg);		DispatchMessage(&msg);	}	return msg.wParam;}LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){	switch(message)	{	  // look up WM_ codes to put here.          // such as WM_KEYDOWN, WM_MOUSEMOVE, WM_CREATE, WM_DESTROY	}	return DefWindowProc(hwnd, message, wParam, lParam);}

EDIT: There was/is some stuff in there that was/is unnecessary. Ignore any unused variables.

[edited by - Nypyren on January 22, 2003 3:12:22 AM]

##### Share on other sites
I aggree that MFC is bloated and unecessarily complicated, and i have spend long hours on the net trying to find non MFC ways of doing things. (i.e skinning, subclassing and also OLE and COM stuff)
The best thing to do is search for C ONLY windows tutrials (i.e. not c++) on the net as then the code *cannot* include any MFC.

Failing that, look though the MSDN samples in the SDK section. Nearly all the code in that section is straight win32.

Does it matter? Even if it does matter, does it matter that it matters?

##### Share on other sites
Check out Relisoft there are some very good OOP Window creation tutorials there

##### Share on other sites
Hey guys...I was just kinda testing that out to see what type of responses I would get. I already know windows programming and all the stuff. But thanks for the great references...now some real newbies may find this thread and maybe get some answers they were looking for since I had some windows programming problems when I first started. I know everyone has =)

.:Not a newbie question:.
I''ve been partly designing a crossplatform application(engine)using DX9 and OpenGL(i''ve done many windows engines in the past) I would like to know if anyone had some theorys or resource they would like to share on this cross-platform application development(ie Unix/Linux and Windows, and console systems)

Thanks

"By thy keyboard and thy hand, thou shall be created!"

1. 1
2. 2
3. 3
4. 4
frob
15
5. 5

• 16
• 12
• 20
• 12
• 18
• ### Forum Statistics

• Total Topics
632160
• Total Posts
3004500

×