Thread: how the heck do i point to this?

  1. #1
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001

    how the heck do i point to this?

    How can i create a pointer to
    _class.lpfnWndProc
    where the variable lpfnWndProc is of type:
    long (__stdcall ** )(struct HWND__ *,unsigned int,unsigned int,long)
    ?
    I've tried a number of approaches and i've hit the wall, can anyone help me? thanks.
    PHP and XML
    Let's talk about SAX

  2. #2
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    Try something like this:

    typedef long **(class::*ppFunction)(struct HWND__ *,unsigned int,unsigned int,long);

    ppFunction = &class.lpfnWndProc;

    Kuphryn

  3. #3
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946
    i believe thats a pointer to a pointer to a function which takes four parameters: a pointer to a HWND__ struct, two unsigned ints, and a long. my question is, WHY do you want a third level of indirection????!?!?!?!?!?
    hello, internet!

  4. #4
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001
    >>third level of indirection

    i'm creating a header file that makes it easier for newb's to code windows, those hungarian variables aren't very descriptive, so i've made pointers like:
    WindowInstance * WindowInstanceName=&_class.hInstance;
    etc.

    plus i personally hate using hungarian

    i've gotten the program to work for every one being pointed to except for this one.
    PHP and XML
    Let's talk about SAX

  5. #5
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001
    Code:
    typedef long **(__stdcall::*WindowsProcedureName)(struct HWND__ *,unsigned int,unsigned int,long);
    WindowsProcedureName=&_class.lpfnWndProc;
    ok, i can't visually pick this apart right now cause my head is killing me. I get the errors:

    C:\drew\Programming\C++\Open source\An_unbeata4286312182001\Anti_Hungarian\hung arians_suck.cpp(22) : error C2653: '`global namespace'' : is not a class or namespace name
    C:\drew\Programming\C++\Open source\An_unbeata4286312182001\Anti_Hungarian\hung arians_suck.cpp(23) : error C2513: 'long **(__stdcall *)(struct HWND__ *,unsigned int,unsigned int,long) ' : no variable declared before '='
    C:\drew\Programming\C++\Open source\An_unbeata4286312182001\Anti_Hungarian\hung arians_suck.cpp(48) : error C2275: 'WindowsProcedureName' : illegal use of this type as an expression
    C:\drew\Programming\C++\Open source\An_unbeata4286312182001\Anti_Hungarian\hung arians_suck.cpp(22) : see declaration of 'WindowsProcedureName'
    C:\drew\Programming\C++\Open source\An_unbeata4286312182001\Anti_Hungarian\hung arians_suck.cpp(85) : error C2541: delete : cannot delete objects that are not pointers
    C:\drew\Programming\C++\Open source\An_unbeata4286312182001\Anti_Hungarian\hung arians_suck.cpp(86) : error C2513: 'long **(__stdcall *)(struct HWND__ *,unsigned int,unsigned int,long) ' : no variable declared before '='
    Error executing cl.exe.



    thanks again everyone
    PHP and XML
    Let's talk about SAX

  6. #6
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    What's __stdcall::*WindowsProcedureName?

    Code:
    typedef long **(AClass::*WindowsProcedureName)(struct HWND__ *,unsigned int,unsigned int,long);
    
    WindowsProcedureName = &_class.lpfnWndProc
    Kuphryn

  7. #7
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001
    ok sorry to sound ignorant, but i haven't used classes much... so that's probably why i'm lost here.
    Here's what I've done....still lost mind you, can you please help me out? thanks much.
    Code:
    class AntiHungarian;
    
    //below lines are messed up 
    typedef long **(AntiHungarian::*WindowsProcedureName)(struct HWND__ *,unsigned int,unsigned int,long);
    WindowsProcedureName=&_class.lpfnWndProc;
    PHP and XML
    Let's talk about SAX

  8. #8
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    Is the function being pointed to a static member?
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  9. #9
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  10. #10
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001
    >>Is the function being pointed to a static member?
    I'm trying to create a pointer to a member variable of the
    WNDCLASSW struct (well, an instance of that struct i've made called _class).

    so it's not a function...I'm thinking perhaps my logic is screwed up that way as well....oh boy i need a vacation.
    PHP and XML
    Let's talk about SAX

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help realy needed
    By ZohebN in forum C++ Programming
    Replies: 2
    Last Post: 04-08-2008, 09:37 AM
  2. Getting a floating point exception
    By SnertyStan in forum C Programming
    Replies: 13
    Last Post: 03-25-2008, 11:00 AM
  3. How to monitor process creation?
    By markiz in forum Windows Programming
    Replies: 31
    Last Post: 03-17-2008, 02:39 PM
  4. instantiation point discussion
    By George2 in forum C++ Programming
    Replies: 1
    Last Post: 03-08-2008, 03:48 AM
  5. overloading operator help
    By syrel in forum C++ Programming
    Replies: 8
    Last Post: 09-30-2004, 10:49 AM