Jump to content
  • Advertisement
Sign in to follow this  

[D3D] No window appears

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Kay, I'm a newb at DirectX and I'm trying to learn DirectX9 programming. Unfortunately any of my Win32 applications are compiling and running, but nothing shows up.
/*            CRYSTAL BOND          */
/*************            ***********/
/*       DirectX game built by      */
/**     Glitch Softwares Studios   **/

//Include important files
#include <windows.h>
#include <windowsx.h>
#include <d3d9.h>

#include "functions.h"

//Include Direct3D Library
#pragma comment (lib, "d3d9.lib")

//Include files specifically for this game
#include "functions.h"

//Prototype of CALLBACK
LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);

// the entry point for any Windows program
int WINAPI WinMain(HINSTANCE hInstance,
                   HINSTANCE hPrevInstance,
                   LPSTR lpCmdLine,
                   int nCmdShow)
	HWND hWnd;

		//Clear windows for use
	ZeroMemory(&wc, sizeof(WNDCLASSEX));

	//Build structure with information
	wc.cbSize = sizeof(WNDCLASSEX);
	wc.style = CS_HREDRAW | CS_VREDRAW;
	wc.lpfnWndProc = WindowProc;
    wc.hInstance = hInstance;
    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH)COLOR_WINDOW;
    wc.lpszClassName = L"WindowClass";

	//Make the Windows Program
	hWnd = CreateWindowEx(NULL,
						L"WindowClass",				//Class name
						L"Crystal Bond",			//Window Caption
						5,							//X Start
						5,							//Y Start
						645,						//Width
						485,						//Height
						NULL,					//Parent Window
						NULL,					//Menus
						hInstance,				//Application handle
						NULL);					//Use with multiple windows

	//Make window visible
	ShowWindow(hWnd, nCmdShow);


	MSG resp;	//Create the structure to communicate the user input

		TranslateMessage(&resp);	//Translate input to machine's language

		DispatchMessage(&resp);		//Send message to be processed.
	return resp.wParam;

		// Check to see if any messages are waiting in the queue
		while(PeekMessage(&resp, NULL, 0, 0, PM_REMOVE))
			// Translate the message and dispatch it to WindowProc()

		// If the message is WM_QUIT, exit the while loop
		if(resp.message == WM_QUIT)

							UINT message,
							WPARAM wParam,
							LPARAM lParam)
	//Look for what to do at message recieved
		//Message says: Close the program and window
		{PostQuitMessage(0);return 0;}break;
	//Else, and nothing was supported in SWITCH
	return DefWindowProc(hWnd, message, wParam, lParam);

As I said, I'm new to the DirectX world, don't worry about things like cleanD3D(), as those are declared in one of my headers. Thanks in advanced. It'd be nice to get something of my own to work -_-'

Share this post

Link to post
Share on other sites
You seem to have two message loops, and a return at the end of the first one, and in the first message loop you never call renderFrame() so nothing will be drawn.

I wrote a few D3D tutorials myself, This one may be of use to you, and Part 2 is here.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!