Boost Users :
From: Felipe Magno de Almeida (felipe.m.almeida_at_[hidden])
Date: 2005-05-11 01:11:31
On 5/10/05, Aleksey Gurtovoy <agurtovoy_at_[hidden]> wrote:
> Felipe Magno de Almeida writes:
> > I would like to know if it is possible to generate a number of static
> > functions that redirect to some other function inside the class,
> > taking an object as void * and is casted to the object (that it knows
> > which is), and be possible to take the address of such functions...
> Sure. Wrapping (legacy) C interfaces along the above lines is probably
> one of the most common basic application of C++ metaprogramming.
> > well, i dont have a good english, so I will reexplain:
> > For the ones that already are familiar with Win32 GUI:
> > I must create a static function to be the DialogProc of a window, the
> > problem is... I'm creating some property sheets to be used with one
> > class, and I would like to make it automatic the redirection from the
> > static function to some other method inside the class, that isnt
> > static... and I would like to create a class, probably with CRTP to
> > say to it to create the functions that would redirect to me, saying
> > how much functions would that be, and make it creates the codes that
> > gives to windows the static functions addresses and create the
> > functions that would redirect....
> Sounds like you are on the right track. You might want to check out
> John Torjo's win32gui library (http://www.torjo.com/win32gui/), which
> uses modern C++ techniques to build a set of convenient wrappers for
> Win32 API along the same lines.
I've looked that already, but I dont think it will help me in this
case... cos it is not really me who creates the window, it is
someone's code(MMC(Microsoft Management Console) ) and I need to give
to it a static function for that it creates it. (Maybe I overlooked
someway to get this static or C function address from the win32gui).
But I managed to automatize the creation of these functions, I dont
know if it was the better way... But it is working.... I did with a
mpl::vector_c (for the dialog ID's of each page).. I privately inherit
from this class, create a function that calls the function from this
class, and it redirects the calls to me... I use a class xxxx_access,
like in serialization library to give to it total access to the
derived class. But, in fact, I didnt liked very much its design...
but... maybe there's a way to use win32gui with it... It would really
help me with the low level GUI part that I'm having to deal with...
I'll continue to try the win32gui, see if there's a way...
> Aleksey Gurtovoy
> MetaCommunications Engineering
Thank you very much,
Felipe Magno de Almeida.
-- Felipe Magno de Almeida UIN: 2113442 email: felipe.m.almeida+spam at gmail com felipe.almeida at ic unicamp br, felipe.m.almeida at gmail com, felipe at synergy com I am a C, modern C++, MFC, ODBC, Windows Services, MAPI developer from synergy, and Computer Science student from State University of Campinas(UNICAMP). To know more about: Unicamp: http://www.ic.unicamp.br Synergy: http://www.synergy.com.br current work: http://www.mintercept.com "There is no dark side of the moon really. Matter of fact it's all dark."
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net