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

  • SEARCH
  • Home
  • 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 8218743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T12:54:28+00:00 2026-06-07T12:54:28+00:00

I want to create a little box embedded in my main window that can

  • 0

I want to create a little box embedded in my main window that can accept text input and contain buttons. When I say embedded, I mean I want it to be integrated in my main window seamlessly without its own close button. I have searched google endlessly and have not found an answer that does not involve mfc or .net. How can I do this in a raw win32 application. Please add your code to my skeleton shown below. Thanks!

#include <windows.h>

LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                    PSTR szCmdLine, int iCmdShow)
{
     static TCHAR szAppName[] = TEXT ("App") ;
     HWND         hwnd ;
     MSG          msg ;
     WNDCLASS     wndclass ;

     wndclass.style         = CS_HREDRAW | CS_VREDRAW ;
     wndclass.lpfnWndProc   = WndProc ;
     wndclass.cbClsExtra    = 0 ;
     wndclass.cbWndExtra    = 0 ;
     wndclass.hInstance     = hInstance ;
     wndclass.hIcon         = LoadIcon (NULL, IDI_APPLICATION) ;
     wndclass.hCursor       = LoadCursor (NULL, IDC_ARROW) ;
     wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
     wndclass.lpszMenuName  = NULL ;
     wndclass.lpszClassName = szAppName ;

     if (!RegisterClass (&wndclass))
     {
          MessageBox (NULL, TEXT ("This program requires Windows NT!"),
                      szAppName, MB_ICONERROR) ;
          return 0 ;
     }

     hwnd = CreateWindow (szAppName,                  // window class name
                          TEXT ("App"), // window caption
                          WS_OVERLAPPEDWINDOW,        // window style
                          CW_USEDEFAULT,              // initial x position
                          CW_USEDEFAULT,              // initial y position
                          CW_USEDEFAULT,              // initial x size
                          CW_USEDEFAULT,              // initial y size
                          NULL,                       // parent window handle
                          NULL,                       // window menu handle
                          hInstance,                  // program instance handle
                          NULL) ;                     // creation parameters

     ShowWindow (hwnd, iCmdShow) ;
     UpdateWindow (hwnd) ;

     while (GetMessage (&msg, NULL, 0, 0))
     {
          TranslateMessage (&msg) ;
          DispatchMessage (&msg) ;
     }
     return msg.wParam ;
}

LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
     HDC         hdc ;
     PAINTSTRUCT ps ;
     RECT        rect ;

     switch (message)
     {
     case WM_CREATE:

          return 0 ;

     case WM_PAINT:
          hdc = BeginPaint (hwnd, &ps) ;



          EndPaint (hwnd, &ps) ;
          return 0 ;

     case WM_DESTROY:
          PostQuitMessage (0) ;
          return 0 ;
     }
     return DefWindowProc (hwnd, message, wParam, lParam) ;
}
  • 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-07T12:54:29+00:00Added an answer on June 7, 2026 at 12:54 pm

    What all messages do you want to receive?

    For instance, WM_COMMAND message is sent when button is pressed. Handle these messages as follows:

    LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
    {
        HDC         hdc ;
        PAINTSTRUCT ps;
        RECT        rect ;
    
        switch (message)
            {
            case WM_CREATE:
                return 0 ;
    
            case WM_COMMAND:
                {
                switch(LOWORD(wParam))
                    {
                    case IDC_BUTTON:
                        /*
                        IDC_BUTTON is id given to button
                        This id is specified while creating window. If you are using
                        CreateWindow then it will be as follows:
    
                        CreateWindow("BUTTON", 0, WS_CHILD|WS_VISIBLE, 70, 70, 80, 25, g_hWnd, (HMENU)IDC_BUTTON, hInst, 0);
    
                        and in resource.rc file or in the beginning of code. Do "#define IDC_BUTTON                  3456"
                        3456 is just a reference you can give any other no as well. Prefer using bigger number so that they can not conflict with existing ones.
                        */
    
                        //do whatever you want to do here when button is pressed
                        break
                    }
                }
                break;
    
            case WM_PAINT:
                hdc = BeginPaint (hwnd, &ps) ;
    
                EndPaint (hwnd, &ps) ;
                return 0 ;
    
            case WM_DESTROY:
                PostQuitMessage (0) ;
                return 0 ;
            }
    
        return DefWindowProc (hwnd, message, wParam, lParam) ;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a little social network (a little test). How can Ii
I want to create a desktop recorder that require very little HD space. It
I am building a little app for users to create collections. I want to
I want create wordpress website into which I want create user management... That means
i want create a custom json data from the mssql 2008 results so that
I want create an application with animate button? how can i do? after click
i sort of want to create a little backend of a small website. i
Basically I want to create a form. It might be a little long after
So I have an input form that I want to use to update a
I have a text in an email on a windows box that looks something

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.