Hey again. I'm working on and off on my little tool that currently installs fonts, writes the registry, and will do various other things i'm gonna need.

I'm currently trying to implement full error checking before i go on, and i'm pretty clueless on how to use return values. I know that it's a stupid question, but,

AddFontResource(myFont);

Return Values

If the function succeeds, the return value specifies the number of fonts added.
If the function fails, the return value is zero. No extended error information is available.

Okay, so how exactly do i get those return values to be able to use them for error checking? Do i simply put return after the function? I'm clueless on this one.

Recommended Answers

All 2 Replies

if (AddFontResource(myFont) == 0) {
    // Alas... YOU know what to do in that case...
}

As far as I know it's possible to define several filenames in the argument string ( | separated names). In that case you know how many font files needed so you can set more useful test:

if (AddFontResource(myFontList) != N) { // YOU know N value...

What's a problem?..

Thanks, it's just now that i noticed the function is declared as int and therefore can be used just like an integer... I still have a lot to learn you know. :)

Thanks for the help, it works.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.