Jump to content
  • Advertisement

Archived

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

G a m e D e v

HWND of console

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

Advertisement
The console window was never really meant to be "known about" by the program running in it. It''s basically an emulator of the old DOS system. I suppose that it''s theoretically possible to query the system and find the process to pull out the HWND, but I really can''t see why you''d ever want to do that.

What exactly are you trying to accomplish?

-fel

Share this post


Link to post
Share on other sites
Actually, you should create a normal Win32 Application project (if you''re using MSVC) and set up your own console window. i remember seeing it in the MSDN sample application for __beginthread and __endthread. It''s way more powerful and flexible. I''m too far away from my own computer to provide more info and too lazy to check MSDN online.

Share this post


Link to post
Share on other sites
Im trying to use DirectX with a console window. I found a function for getting the HWND but it only works with Windows 2000. Is there a way to do it that would work on most versions of windows?

Share this post


Link to post
Share on other sites
You should probably be using a Win32 application rather than a console then, you''re going to be needing a lot more control than a console is capable of giving you.

The console is more or less meant for text-based programs that don''t require any windows support.

-fel

Share this post


Link to post
Share on other sites
Use SetConsoleTitle() to make the title (temporarily) something wierd, then use FindWindow() to get the HWND, then set it back.

Share this post


Link to post
Share on other sites
It doesn''t really matter if your application is a console application or a windows application. If it''s a conolse application, you can still call all the regular windows functions (CreateWindow, et al) and a windows application can still use a console (but it just has to call AllocConsole() first).

The onle difference between the two is the entry point. A console application''s entry point is main() and a windows'' one is WinMain().


War Worlds - A 3D Real-Time Strategy game in development.

Share this post


Link to post
Share on other sites
Incidentally, the console is a kernel object and is not owned by your application, so there may be a restriction on what you can do with the window, or else you could mess up the kernel.

Share this post


Link to post
Share on other sites
quote:
Original post by GayleSaver
Incidentally, the console is a kernel object and is not owned by your application, so there may be a restriction on what you can do with the window, or else you could mess up the kernel.


If you try to mess with the console it might work on 9x but it''ll most likely crash in windows NT/2000. Stick to Win32 Applications, unless you''re using glut(which, since you said you''re using dx, is very unlikely).

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.

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!