Jump to content
  • Advertisement

Archived

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

Awsric_Armitage

Need very basic help for a complete newb trying to begin deciphering the DirectX SDK

This topic is 5226 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

First off this is very basic, initializing a window, but it is also very frustrating for a complete newb to programming attempting to figure out the DirectX SDK. Here is the code sample I am having problems with: //----------------------------------------------------------------------------- // Name: WinMain() // Desc: The application''s entry point //----------------------------------------------------------------------------- INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR, INT )//WARNINGS?? { // Register the window class WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, MsgProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, "D3D Tutorial", NULL }; RegisterClassEx( &wc ); // Create the application''s window HWND hWnd = CreateWindow( "D3D Tutorial", "D3D Tutorial 01: CreateDevice", WS_OVERLAPPEDWINDOW, 100, 100, 300, 300, GetDesktopWindow(), NULL, wc.hinstance, NULL );//line 152 Errors?? // Initialize Direct3D if( SUCCEEDED( InitD3D( hWnd ) ) ) { // Show the window ShowWindow( hWnd, SW_SHOWDEFAULT ); UpdateWindow( hWnd ); // Enter the message loop MSG msg; while( GetMessage( &msg, NULL, 0, 0 ) ) { TranslateMessage( &msg ); DispatchMessage( &msg ); } } UnregisterClass( "D3D Tutorial", wc.hinstance );//Line 170 Errors?? return 0; } OK I have downloaded the DirectX SDX from MSDN and also downloaded the latest Bloodshed Dev-C++. I am attempting to run the tutorials from the SDK downloaded files. I have set the compiler to look for the SDK’s Lib, Bin, and Include paths in the SDKs default install location. I have imported the Visual C++ project file from the SDK tutorial into the Dev-C++ and attempted to compile and run it but I get the following errors from Dev-C++. C:\DXSDK\Samples\C++\Direct3D\Tutorials\Tut01_CreateDevice\CreateDevice.cpp [Warning] In function `INT WinMain(HINSTANCE__*, HINSTANCE__*, CHAR*,: 152 C:\DXSDK\Samples\C++\Direct3D\Tutorials\Tut01_CreateDevice\CreateDevice.cpp `struct _WNDCLASSEXA'' has no member named `hinstance'' 170 C:\DXSDK\Samples\C++\Direct3D\Tutorials\Tut01_CreateDevice\CreateDevice.cpp `struct _WNDCLASSEXA'' has no member named `hinstance'' I am still obviously very new to C++ and also programming having some antiquated Dos and Basic experience a long time ago. I understand some of the OOP logic and this leads to me to assume that the errors are from either the intialize statement in WinMain or the registration and class setup of WNDCLASSEX wc=. Admittedly, I do not know what is going on with the HINSTANCE_* and later the call for the wc.hinstance but I do know that somewhere the hinstance needs to be a part of the declaration of WNDCLASSEX wc. I just do not know where. I have tried looking in the SDK documentation but that leads me to believe I am looking in the wrong place for the answers. Any help for a complete newb to this process would be appreciated. They said it was a tutorial but I do not think they intended for me to learn quite this way. Good lesson though if I can get to the end of it. Apologize for the basic nature of the problem but what is routine for some is just virgin territory for others. So please refrain from bashing the newb however tempting that might be. I did ask in the beginners section. Awsric Armitage

Share this post


Link to post
Share on other sites
Advertisement
Sounds like you might want to get more familiar with C++ first before moving on to something like Direct X. Even though the Direct X code you posted is just the intro Tutorial its still using intermediate knowledge of C++ and knowing some Windows API will help to.

I''ve been doing non-graphical C++ programming for a few months now and just moving into the graphical end. I tried Direct X first as well but I put it down and am starting with SDL and Windows API now.

And, I''ve been reading these boards for quite some time now, and just started posting recently. From what I''ve seen, the people who post here are reasonable people and love to help. You can''t ask for a better community.

Share this post


Link to post
Share on other sites
It''s hInstance (CaSe MaTtErS).

don''t jump into DirectX, learn the basics of C/C++ first (syntax first then "hello world" , file input, etc. ). And then get some info on the Windows API (the code you posted uses it to initialize a window) and then you can go about learning DX / OpenGL.

Share this post


Link to post
Share on other sites
Thank you both for being kind to the newb. I will attempt more C++ reading and search for programming Windows API information before tackeling DirectX.

Again thank you both for being kind and not bashing the obvious newb.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!