Re: Casting Function pointers : Can anyone correct this MS Knowledge base Example pls ?

From: Howard (
Date: 10/15/04

Date: Fri, 15 Oct 2004 19:55:50 GMT

"John Harrison" <> wrote in message
> >
>> This should probably be casted, because the number of parameters is
>> different.
> 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
> for
> 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.


Relevant Pages

  • Re: Comparioson of purpose for PyGUI and AnyGUI ???
    ... > Anygui API was inspired by it. ... maintaining a Windows back-end (and I find hard to fault him for that: ... devote time and energy to Windows programming. ...
  • Re: newbe about API
    ... Emne: Re: newbe about API ... > I found all these API-CALL strings are finally compiled to ... more than that...and Windows simply takes this to an extreme that this ... DLL, when a weak point is found (which, with Microsoft, is something ...
  • Re: In the Shallow End
    ... When a document claims how an API is supposed to be used and then gives the user examples that actually work, ... Vague in your instance means you have no context to VMS or UNIX of that era. ... Windows offers lots of this stuff. ... That's why Apple had to dump a whole paradigm to plunge ahead and take the lead. ...
  • Re: (2010) Beginner Question: Directory Lists
    ... further enhancement and that it's not going to be the official primary developement api for 3rd parties. ... all sorts of articles talking about how "the aging win32 api" ... It is the api that windows will be presenting in the future. ... Metro apps will most likely run on either windows 8 or wp8 - but, not sure what web apps has to do with anything... ...
  • Re: a pre-beginners question: what is the pros and cons of .net, compared to ++
    ... as the windows forms architecture wraps a number of activex ... and retains backwards compatibility with both COM and the classic Win32 api. ... C++ cannot inherently do video capture either, since you have to import COM. ... Outlook or Word or IM programs, each of which would run in managed code ...