Quantcast
Channel: mfc – codexpert blog
Browsing index pages (41 articles)

Image may be NSFW.
Clik here to view.

MFC Support for Direct2D – Transforms (1)

Direct2D supports linear transforms like translation, scale, rotation and skew. If using MFC, we can apply transforms to render targets by calling CRenderTarget::SetTransform. Here is an example that...

View Article


Image may be NSFW.
Clik here to view.

MFC Support for Direct2D – Part 8: Lost Render Target

As stated in the Direct2D documentation, the graphics device might become unavailable. If the device is lost, the render target also becomes invalid, along with any device-dependent resources that were...

View Article


Image may be NSFW.
Clik here to view.

Codexpert – 2017 Articles Summary

MFC Support for Direct2D – Part 3: Multithreading MFC Support for DirectWrite – Part 8: Trimming MFC Support for DirectWrite – Part 9: Hit-Test MFC Support for DirectWrite – Part 10: Outlined Text MFC...

View Article

Image may be NSFW.
Clik here to view.

MFC Support for Windows Animation

Let’s say we have to make a slide show presentation using Cross Fade effect. If the target system is Windows 10, that’s quite easy because Direct2D offers built-in Cross Fade effect. Cross Fade effect...

View Article

Image may be NSFW.
Clik here to view.

MFC Support for Direct2D – Part 7: Saving to files

Once have enabled Direct2D support in an MFC application, there is no sweat to load an image from a file, by using one of CD2DBitmap constructors. Unfortunately, we cannot find a CD2DBitmap method to...

View Article


Image may be NSFW.
Clik here to view.

Three Ways to Find Files

Let’ say we have to implement a function that search a folder to recursively find files having an extension from a given list of extensions. This article shows three possible implementations: one using...

View Article

Image may be NSFW.
Clik here to view.

MFC Support for DirectWrite – Part 11: About Trimming Again

In a previous article, I showed how to trim a text which overflows the layout box. In the example presented there, the ellipsis is added at the end of truncated text. But if, let’s say, we have to show...

View Article

Image may be NSFW.
Clik here to view.

Easy Screen Capture with MFC

In an older article published at Codeguru, I showed how easy is to make screen capture using CImage ATL/MFC class. Here is the sample code from that article:BOOL CScreenImage::CaptureRect(const...

View Article


Image may be NSFW.
Clik here to view.

Double-click in MDI Client

It’s hard to believe that handling mouse double-clicks in MDI Client windows can be super useful, but I found this problem in a discussion forum. I presumed that it was not only for fun, so I tried to...

View Article


Image may be NSFW.
Clik here to view.

MFC Support for Direct2D – Part 5: Interoperability with GDI

There are two ways to combine Direct2D with Windows GDI API in the same application: Drawing Direct2D content to a GDI device context Drawing GDI content to a Direct2D GDI-compatible render target...

View Article

Image may be NSFW.
Clik here to view.

MFC Support for Direct2D – Part 4: Built-in Effects

Direct2D has built-in support for image processing like changing brightness or contrast, blurring, creating drop shadows, and so on. Basically, we can use for this purpose the CreateEffect and...

View Article

Image may be NSFW.
Clik here to view.

MFC Support for DirectWrite – Part 10: Outlined Text

In a previous article, I showed the basics of custom text rendering with DirectWrite (see MFC Support for DirectWrite – Part 7: A Step to Custom Rendering). So far so good but it just mimics the...

View Article

Image may be NSFW.
Clik here to view.

MFC Support for DirectWrite – Part 9: Hit-Test

DirectWrite has hit-testing support that can be useful for showing a caret, making a selection, doing some action if the user chicks in a given text range, and so on. The hit-test methods of...

View Article


Image may be NSFW.
Clik here to view.

MFC Support for Direct2D – Part 3: Multithreading

As shown in previous articles, we can enable MFC Direct2D support for a window by a call of CWnd::EnableD2DSupport. Example:int CSlideShowWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) { if...

View Article

Image may be NSFW.
Clik here to view.

MFC Support for DirectWrite – Part 8: Trimming

When using “classic” GDI functions i.e. CDC::DrawText, it’s no sweat to trim with ellipsis a single-line text when that text does not fit in the drawing rectangle width, by specifying DT_WORDBREAK...

View Article


Codexpert – 2016 Articles Summary

C++ Programming Language Guidelines Support Library Review: span<T> Guidelines Support Library Review: string_span<T> Microsoft Libraries Easy PNG Resource Loading with MFC – Part 1 MFC...

View Article

Image may be NSFW.
Clik here to view.

Easy PNG Resource Loading with MFC – Part 2

A previous article demonstrates how easy is to load images from PNG resources, by using Direct2D MFC support. I have found even an easier way: CPngImage class which extends CBitmap with methods that...

View Article


Read IFD and EXIF Metadata with WIC and MFC

A graphic file can store additional information abaout image (camera model, camera manufacturer, date and time, etc). Windows Imaging Component (WIC) provides interfaces which allow dealing with image...

View Article

Getting Direct2D, DirectWrite and WIC Factories in MFC

MFC library offers a series of wrapper classes over Direct2D and DirectWrite interfaces (see CRenderTarget and CD2D classes). That’s pretty cool because allows to easily load and render images and draw...

View Article

Image may be NSFW.
Clik here to view.

Visual Studio 2015: How to Step into MFC Framework Code

Let’s say we have installed Visual Studio 2015 and  have started an MFC application in DEBUG mode. Now, attempting to step into an MFC Framework function, e.g. CWinApp::InitInstance, the debugger...

View Article
Browsing index pages (41 articles)


Latest Images