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 6101617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:31:12+00:00 2026-05-23T13:31:12+00:00

How can I create child dialog from an existing dialog? Declaration(global scope) HINSTANCE hInst;

  • 0

How can I create child dialog from an existing dialog?

Declaration(global scope)

HINSTANCE hInst;
HWND hWnd;

WinMain :

int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
                      LPSTR lpCmdLine, int nCmdShow )
{
    DialogBox(hInstance, MAKEINTRESOURCE(IDD_MAIN),hWnd, (DLGPROC)DlgProc);
    //MessageBox (NULL, TEXT ("Hello, Windows 98!"), TEXT ("HelloMsg"), 0);
    return 0;
}

DlgProc:

LRESULT CALLBACK DlgProc(HWND hWndDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
{
    switch(Msg)
    {
    case WM_COMMAND:
            switch(LOWORD(wParam))
            {
            case IDM_ABOUT:
                //DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUT),hWnd, (DLGPROC)AboutDlgProc);
                                    DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUT),hWndDlg, (DLGPROC)AboutDlgProc); //changed to this...
                return 0;
            }
            break;
    }
}

AboutDlgProc:

BOOL CALLBACK AboutDlgProc (HWND hDlg, UINT message,
    WPARAM wParam, LPARAM lParam)
{
    switch (message)
    {
    case WM_CREATE:
        hInst = ((LPCREATESTRUCT) lParam)->hInstance ;
        return 0;
    case WM_INITDIALOG :
        ShowWindow (hDlg, SW_HIDE);
        return TRUE ;

    case WM_COMMAND :
        switch (LOWORD (wParam))
        {
        case IDOK :
        case IDCANCEL :
            EndDialog (hDlg, 0) ;
            return TRUE ;
        }
        break ;
    }
    return FALSE ;
}

When I click a menu item called About(IDM_ABOUT), but nothing happened.
So how can I create an about dialog ?

EDIT

The about dialog can be poped out now. the reason why the about dialog cannot poped out before is me drag a MFC Link control the the dialog box. As my win32 sdk application do not support MFC , so it just failed. LOL .

  • 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-05-23T13:31:13+00:00Added an answer on May 23, 2026 at 1:31 pm

    If you are not initializing the hInst that you’re using in the call to DialogBox, the call will fail because it can’t find the dialog resource. You really should be checking the return values of system calls when tracking down errors like this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create Linq Expression that I can use to query child
I'm attempting to create a new forum on an existing forum. I can create
I have an application that create child's gifts applications, and every application owner can
I knew that we can create child themes for wordpress. But i want to
I can create a contact that is not mail enabled, but how do I
How can create a view with mutiple images, something similiar to the photo app
One can create an anonymous object that is initialized through constructor parameters, such as
How can create a New user in ORACLE with full access (alter, delete, select,
I can create an array of buttons in Windows Form but how can i
I can create a sparse php array (or map) using the command: $myarray =

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.