Jump to content
  • Advertisement
Sign in to follow this  
ShadowP13

[.net] Moving away from VC++ 6 and confused.

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

I've only recently gotten VS.Net and I'm very baffled. Previously I used VC++ 6 for everything. C++ .Net seems to make windows like this: System::Threading::Thread::CurrentThread->ApartmentState = System::Threading::ApartmentState::STA; Application::Run(new Form1()); As apposed to VC++ 6 when I used to use RegisterClassEx and CreateWindow. Should I keep using these functions and just delete the new System::Threading::Thread (so on) function? Is there a way to get a HWND from the System::Threading... window? I need a HWND to create a device in Direct3D. Also, if I go to New Project->C++ Projects->.Net->Empty Project (.Net) and just start programming like I used to in version 6, am I using managed code already, or is there special syntax and conventions I have to use? Sorry to ask just basic questions like this. I wasn't sure if this should go in beginers forum or here.

Share this post


Link to post
Share on other sites
Advertisement
Yeah, I was expecting that actually. Believe it or not, I have read all of the MSDN information I could find that I thought was relavent and I bought and read a book on Visual Studio. I'm trying to stubornly continue using c++ since I'm used to it, and simultaneously use Managed DirectX. Unfortunatly, unless you can recomend a better manual then the one I've been looking through (and am still looking through actually) I'm pretty much stuck :/

Share this post


Link to post
Share on other sites
Crud, just a link to a website that discusses how managed c++ syntax is different from C++ might be helpfull (Especially if I am just being retarded and need to RTFM) . The only things I can find online are about C#. I can't seem to find the relavent FM to read. I try to wait tell the last moment to ask a question on GameDev, as I know how many of you get mad if you think the answer is easy to come by.

Share this post


Link to post
Share on other sites
The syntax is a bit different, but it looks like what you're really running into here is the API difference. In managed C++, you're using the .NET framework for stuff, which is completely different from the Win32 API (though it accomplishes many of the same tasks). You don't HAVE to make your apps in Managed C++, even if you're using Visual Studio.NET... so if you're more comfortable with the Win32 API, you can use it without sticking to the VS6 IDE.

BTW, don't let the APs get you down. We aren't all jerks. [smile]

Share this post


Link to post
Share on other sites
hiya!

I'm not sure if this is more basic than you're looking for:

tut

it's more of a ground up intro, and does not deal specifically with D3D. still, it's a quick read!

Share this post


Link to post
Share on other sites
I've also been struggling to convert some of my VB coding to use .NET and finding it to be fairly a undocumented process. You're using Managed C++ so perhaps it's even less documented for you, something I don't envy. All I can say is that if you can afford it to go out and buy one of the big .NET books that discusses the API. I've just started scratching the surface and there's huge aspects that are alien to me, especially being of a Win32 C++ background normally - things just seem more complicated, but I assume that there's some logical order to things. Just keep at it, grab a good book and hit google and MSDN as hard as you can. Luckily MSDN has VB/C#/C++ versions of most of it's examples which can only be a good thing when trying to make sense of things. If you're able to understand the basic concepts then you should be able to read some C# code and port it over to C++/VB with (hopefully) little trouble.

Good luck!

Share this post


Link to post
Share on other sites
Hey, thanks for the information. I kind of like the new namespace system and some of the other things I've been reading about. The main reason I'm trying to use Managed Code is that I have really simple needs for DirectX (I make 2D games) and the Managed DirectX SDK makes the Sprite class look more robust if you use Managed DirectX (The C++ DirectX Sprite doesn't even seem to support stretching the sprite for some reason). If it is true that you need to use Managed Code to use the Draw2D feature I want to figure out how this works :( Most of the example of creating a device in Direct3D involve passing the this pointer (when I try that I get the "error C2673: 'WinMain' : global functions do not have 'this' pointers" error.

Is there a quick answer to this? The Third parameter of the function to create the device wants a "Control *renderWindow". I'm having trouble figuring out what that is. An HWnd I've been assuming but I don't know how to pull an HWnd out of a window created in .Net. This really is turning more into a DirectX question actually. I'm not sure if I'm needing help with DirectX or .Net though :P (This problem really seems to elementry. I've totally already made 4 or 5 directX applications with DirectX8 before. Creating the Device never seemed this hard)

Share this post


Link to post
Share on other sites
Shadow,

for the control, you can just pass in a reference to the window. The Window class in .NET derives from the Control class. Since most UI controls derive from the Control class, you can essentially pass in almost any UI control into the CreateDevice() function. This can be especially cool if you are developing an editor and want a "panel" to show the results from the editor using the actual engine.

Share this post


Link to post
Share on other sites
Ok, thanks everyone. I'm going to spend more time on the tutorial site lonesock recomended and then perhaps just end up getting another book :/ I think I've tried the last Form1::get_Handle type thing that I could think of.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!