Simple Direct Draw Using MFC
Firstly, forgive me for my code. I have really tried my best to make is as easy to read as possible but DirectX is never the easiest thing to code. I originally wanted to write DirectX applications but found that every book I read relating to DirectX was coded using SDK material and not MFC. I wanted to create a very simple wrapper that allowed the easy display of bitmaps on the screen using DirectDraw.
The code itself is fairly limited to displaying bitmaps on the screen (FULLSCREEN MODE) using DirectDraw but it shows the concepts of using wrappers to make your programs far easier to use. I could have put it all in a DLL but realised that this would not be simple for you all to use. Anyway, here is how you use the libraries.
1. Include the following header into your Application Header or StdAfx.h. E.g
#include "DirectControl.h"
2. Create an instance of the CDirectControl Object. For example:
CDirectControl m_Control;
3. In the App Init Instance call the following code:
m_pMainWnd = m_Control.CreateFullScreen(800,600,16);
if (!m_pMainWnd)
return FALSE;
4. You can now use the Controller to create bitmaps (from the resource) using the code :
m_Control.CreateOffScreenSurface("My Bitmap",IDB_IMAGE);
The first parameter is the object identifier that I use to manipulate or select the object at a further time. The second parameter is the resource id of the bitmap.
You also need to tell the controller that the bitmap is available to be rendered. The default is false so you need to set the visibility by using the code:
m_Control.GetSurface("My Bitmap")->SetRender(TRUE);
5. The bitmaps are defaulted to the top left of the screen (x=0,y=0) but you can alter its position by using:
m_Control.GetSurface("My Bitmap")->SetPosition(10,10);
6. Once you have created your bitmap/s you can render the screen by calling:
m_Control.Render(TRUE,FALSE,FALSE);
Ok. What I suggest is that you look at the example project I have done. If anyone wishes to expand it further etc. I would welcome and more additional source code or comments. Please dont laugh at my code. I just wanted Direct X to be easy for everyone. Enjoy.
BTW... I havn't implemented the Escape key so you will have to press ALT-F4 to quit.

Comments
There Offer the discount MBT sandals shoes online with good quality 1i
Posted by Rxabudz33 on 03/19/2013 01:55am[p]Mulberry Bags Are Famous For The Excellent Design Even so, for these designer [url=http://www.burberrycoatsales.com]burberry jacket[/url] mulberry men's bags bag and other components, women of all ages have a very smart number of money Evo Leger . The pattern of donning handbags has by no means been out of [url=http://www.burberrycoatsales.com]burberry shoes[/url] the trend scene . Mulberry Outletis situated in ChilCompton, with [url=http://www.burberry520.com]burberry discount[/url] 190 expert employees and 10 production lines . As you may recognise, some varieties of latest approach approaches and movements will change when a new time of the year is upcoming . Just now, since his disenchantment with farming was Mulberry bags 2012 glad to stay with Apart from the fact UK Mulberry Outlet Shop Bags the sight of Cheap Mulberry Bags Sale Handbags happy and affectionate couple, so pleased with themselves and everyone else, and their well-ordered home, had always a cheering effect on he felt a longing, now UK Mulberry Outlet Shop Bags he was so dissatisfied with his own life, to get at UK Mulberry Outlet Shop Bags secret in which gave him [url=http://www.burberrycoatsales.com]burberry coat[/url] such clarity, definiteness, and good courage in life . Reputable mulberry handbags for target Mulberry accoutrements ability fee as continued as lots of money . Quite a few hundreds of many years ahead with the starting with all the twentieth century, [url=http://www.lovelyburberry.com]burberry sale[/url] hand bags were designed absent from mulberry bags prevalent materials found inside the people's locality . It appealed to greater extent to women and turned out as the biggest hit amongst other Mulberry bags.[/p][p]This bag easily converts from a modern, slouchy tote bag with short leather handles ç¯C to a super feminine messenger style bag with zip drawing a line under . Every single lovely person really should get one . It was found in 1970 by Roger Saul . The 2011 Newest Style Mulberry Bags Release As everybody, we can see such an excellent brand or luckily possess a Mulberry 2011 but we are rarely aware of the complete method of designing a Mulberry [url=http://www.lovelyburberry.com]burberry handbags[/url] bag . Mulberry Outlet illustrates Rydon Homeséç commitment to excellence and the provision of homes that are outstanding places to live and investments [url=http://www.burberry520.com]burberry outlet online[/url] that provide peace of mind . As you may recognise, some varieties of latest approach approaches and movements will change when a new time of the year is upcoming . You needn't go out of house, just need [url=http://www.burberrycoatsales.com]burberry shirt[/url] open you company search online and place the order, the products you bought will be sent to your address . The new Bayswater is beautiful during this bright red version, I have found perfect diamond necklace to a new thousand outfits, such may be the bag to put on along with a total white or total black look after which it be blended with accessories and red lipstick, for instance, belt, shoes , purse and lipstick red, as being a little provocative, but the form, sometimes you might want to see transgressive and sexy around the mirror.[/p]
ReplyPlease help me on Directshow + MFC
Posted by nvnoi76 on 12/01/2004 09:56pmHi, I write a program to play Video files using Directshow and MFC ( Visual C++ 6.0 , DirectX 9.0 ) I compile in DEBUG mode, It runs well and correctly. But when I compile in RELEASE mode. It reports error : "Unhandle exception in Playwnd.exe (MFC42.dll)0xC0000005: Access Violation" Is there any problem on MFC42.dll ? Please help me to correct it. Thank you very much. Noi - nvnoi76@yahoo.com
ReplyDirectX : embed text in video stream ~Need help
Posted by Legacy on 10/30/2003 12:00amOriginally posted by: HS
ReplyNeed Help Loading X Files in Direct X
Posted by Legacy on 10/04/2003 12:00amOriginally posted by: Ace Corban
Im gay :}
ReplyGood for beginners
Posted by Legacy on 05/08/2003 12:00amOriginally posted by: sunil
I found this example helpful to begin with DirectX
Replythanks
Same old Stopping problem
Posted by Legacy on 08/15/2002 12:00amOriginally posted by: amit mankikar
hi,
i have used your classes in my SDI application to display Bitmaps in full screen mode. However i want the additional functionality of going back to the windowed mode as soon as the user presses "Escape".
How do I do it ?
amit mankikar
ReplyNo header includes with texture and utils
Posted by Legacy on 03/19/2002 12:00amOriginally posted by: Shura
No header includes with texture and utils
Reply
sehr sch�n
Posted by Legacy on 12/09/2001 12:00amOriginally posted by: Olaf kliss
ReplyHallo Eva,
sehr sch�n gemacht, weiter so. Ich bin auf der Suche nach den Methoden zur direct Programmierung.
GUI not responding to mouse events after playing mpeg file using DirectShow
Posted by Legacy on 10/25/2001 12:00amOriginally posted by: RK
The problem I have is as follows:
An MPEG file is played using DirectShow in GUI made using MFC on VC++. I pause the video clip midway, in order to draw a rectangle around a chosen area in the paused frame. But the GUI now no longer is able to respond to mouse events. Can somebody give me a clue as to why this could be happening ?
Regards,
ReplyRK
Who to play MPG files using DDraw Pay windows SDK with MFC appli. ??
Posted by Legacy on 09/24/2001 12:00amOriginally posted by: Marty
ReplyLoading, Please Wait ...