Results 1 to 3 of 3

Thread: CreateDialogParam, help please

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Location
    Okinawa, Japan
    Posts
    271

    CreateDialogParam, help please

    Hi,

    The 4th argument passed to this is a lpDialogFunction.
    How do I pass a Class function into the api so i can handle the DlgProc in a class?

    For example:

    Class Form
    {
    public:
    void CreateForm(HINSTANCE HInstance)
    {
    HWND tempH;
    tempH=CreateDialogParam(hTInstance,MAKEINTRESOURCE(MyDialog),NULL,Form::HandleEvents,NULL);
    }
    BOOL CALLBACK HandleEvents(HWND dhwnd,UINT message, WPARAM wParam, LPARAM lParam)
    {
    .....SomeCodehere
    }

    };

    I keep getting

    converting from `BOOL (Form::*)(HWND__ *, unsigned int, unsigned int, long int)' to `BOOL (*)(HWND__ *, unsigned int, unsigned int, long int)'


    Any help, greatly appreciated.

    Thanks

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    You can't pass a class member function. You have to use a static member of the class and pass the this pointer in the lpParam parameter, then save it in some per-instance container in the called function (best would be the GWL_USERVALUE storage location which you can access using GetWindowLong(Ptr) and SetWindowLong(Ptr).
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Location
    Okinawa, Japan
    Posts
    271
    Thanks CornedBee,
    You pointed me in the right direction.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width