Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8658005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:39:41+00:00 2026-06-12T15:39:41+00:00

Before when I tried to make a window wrapper class, I learned that you

  • 0

Before when I tried to make a window wrapper class, I learned that you cannot pass a dialog procedure to CreateDialogParam() that is in a class, because it being a class member changes the signature and therefor doesn’t match that of DLGPROC. I used a workaround where all dialogs used one global procedure that used a map to find the class member procedure from the window handle passed to the global procedure. It would find the correct class pointer in the map, and pass the arguments to its procedure and return the result.

Now I am using this same method, but, in this project everything is going to be in a namespace. Is this valid?

namespace MyNamespace
{
    INT_PTR MyProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) {
        return 0;
    }

    class MyDlg
    {
    public:
        HWND hwnd;

        MyDlg(void) {
            hwnd = CreateDialogParam(
                GetModuleHandle(NULL),
                MAKEINTRESOURCE(IDD_MYDLG),
                HWND_DESKTOP,
                (DLGPROC)MyProc, // Maybe 'MyNamespace::MyProc'?
                NULL
            );
        }
    };
}

I’m not sure if namespaces change the function type signature like classes do.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T15:39:42+00:00Added an answer on June 12, 2026 at 3:39 pm

    Yes it does change how you address the function, but in this case you don’t need to qualify because you’re already inside MyNamespace. So:

    Valid:

    namespace MyNamespace
    {
        INT_PTR MyProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp);
        class MyDlg
        {
            //....
            MyDlg(void) {
                hwnd = CreateDialogParam(
                    GetModuleHandle(NULL),
                    MAKEINTRESOURCE(IDD_MYDLG),
                    HWND_DESKTOP,
                    (DLGPROC)MyProc,
                    NULL
                );
            }
        };
    }
    

    Invalid:

    namespace MyNamespace
    {
        INT_PTR MyProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp);
    }
    class MyDlg
    {
        //....
        MyDlg(void) {
            hwnd = CreateDialogParam(
                GetModuleHandle(NULL),
                MAKEINTRESOURCE(IDD_MYDLG),
                HWND_DESKTOP,
                (DLGPROC)MyProc, // need to use 'MyNamespace::MyProc'?
                NULL
            );
        }
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to make that when child window is opened, parent window is
I'm writing a program that uses SetWindowRgn to make transparent holes in a window
Before I have tried about doing one attachment (upload) for each record of my
I tried this before: string st = Unit; foreach (Label lb in tabControl1.Items) {
I tried to ask this question before but I guess I didnt explain myself
I'm pretty new to Java and tried the Best Before puzzle from Spotify yesterday.
What should data look like before data encoding in: urllib2.Request(someurl,data) I tried [('name1','value1'),('name2','value2'),...] but
Questions exactly like this have been asked before, i've read them all and tried
I know similar questions have been asked before, but I've tried many times and
this question has probably been asked before, but i'm stuck and i've tried a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.