Following this walkthrough, showing how to use a font without having to install it in C++: http://www.codeproject.com/Articles/42041/How-to-Use-a-Font-Without-Installing-it I get an Adress Violation Error (0xc0000005) in ntdll.dll
The calling code in the DialogEx::OnInitDialog() inherited function is the following:
Gdiplus::PrivateFontCollection m_fontcollection;
HINSTANCE instance = AfxGetResourceHandle();
HRSRC res = FindResource(instance, MAKEINTRESOURCE(IDR_MAIN_FONT), L"BINARY");
HGLOBAL mem = LoadResource(instance, res);
void *data = LockResource(mem);
size_t len = SizeofResource(instance, res);
Gdiplus::Status Result = m_fontcollection.AddMemoryFont(data, len); // Exception arises
I debugged the calls and everything looks good to me. The length matches and there are no NullPointers...
The Exception happens somewhere in the called method in gdiplusfontcollection.h
inline Status
PrivateFontCollection::AddMemoryFont(IN const void* memory,
IN INT length)
{
return SetStatus(DllExports::GdipPrivateAddMemoryFont(
nativeFontCollection,
memory,
length));
}
which was not further debuggable...
Any ideas how to find out what is going wrong in the function call?