Re: Casting Function pointers : Can anyone correct this MS Knowledge base Example pls ?
From: Howard (alicebt_at_hotmail.com)
Date: Fri, 15 Oct 2004 19:55:50 GMT
"John Harrison" <email@example.com> wrote in message
>> This should probably be casted, because the number of parameters is
> Seems reasonable.
>> Comments on this code are also welcome.
> It's the usual pile of shit.
Personal aversion to Windows programming expressed here? Or C-style API
calls in general?
You may not like Windows, but a lot of us have to write C++ code that runs
on that platform. And since the API is in C, we're stuck with C-style
interfaces in our C++ code.
>> Are there better ways to get
>> the default printer on all windows platforms ?
> No idea, ask on a Windows programming group. Your question is off topic
> two different reasons, firstly the code is C not C++, secondly Windows
> programming is not on topic in a C++ language group. Try
It's valid C++ code. Sure, it's calling a C API function, but if the
program is a C++ program, it's reasonable that the question could be
considered a C++ question.
The problem is apparently the definition of "PROC", which isn't shown. The
OP needs to define the function pointer to match the function declaration,
which it obviously doesn't. Simply using "PROC" is not the answer. The OP
needs to get the actual declaration of the function, and define a pointer
that matches that declaration.
However, you're right that THAT information is something the he probably
needs to go to a Windows newsgroup for, since we don't have (and don't
particularly care about) that info here.