Don't be helpless: At least look at the function you're using

Raymond Chen

Sometimes I see people ask a question and get an answer, but the answer doesn’t quite work. But instead of trying to understand the answer in order to see why it doesn’t work and develop a better solution, they just play stupid. Here’s an example. The names have been changed but the story’s the same.

How do I get a handle to a bright pink elephant? We have a dialog box that talks about elephants, and we’d like to put some information about the bright pink ones on it.

An answer came back rather quickly.

Use GetElephantHandle(EPHNT_BRIGHTPINK).

Some time later, the customer came back with a follow-up question.

I can’t get it to work. I get a compiler error:

error C2065: 'EPHNT_BRIGHTPINK' : undeclared identifier

Am I missing a header file?

(So much for people knowing what to do when they get this error message.)

Don’t be helpless. Your head isn’t just for looks. At least pretend to try to understand what you’re doing. In this case, the function is GetElephantHandle, and you’re having trouble because the EPHNT_BRIGHTPINK value we want isn’t defined. Why not check out the values that are defined?

#define EPHNT_DUMBO         0
#define EPHNT_BABAR         1
#define EPHNT_WHITE         2

Wow, I bet the person who wrote EPHNT_BRIGHTPINK really meant EPHNT_BRIGHT_PINK.

Armed with this new skill, perhaps you can solve this person’s problem:

Somebody recommended that I add the DS_SHELLEXT style to my property sheet dialog template to fix a sizing problem, but when I try that, I get an error that tells me that DS_SHELLEXT is not defined. Is there a file I have to include?


Discussion is closed.

Feedback usabilla icon