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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:03:02+00:00 2026-05-18T08:03:02+00:00

hello I have the following win32 program, and I have an EDITTEXT control that

  • 0

hello I have the following win32 program, and I have an EDITTEXT control that doesn’t show up on the screen. There is meant to be two EDITTEXT controls drawn on the main window, but only one shows, why is this?

full code

#include <windows.h>
#include <iostream>
#include "resource.h"
using namespace std;
const int BUFFERMAX = 512;
char server_ip[BUFFERMAX];
int port;


const char windclassname[] = "windowClass";

LRESULT CALLBACK WndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam);
INT_PTR CALLBACK AboutDialog(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam);
INT_PTR CALLBACK ConnectWin(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam);


int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow){
    WNDCLASSEX parent_window;
    HWND hwnd;
    MSG msg;

    parent_window.cbSize = sizeof(WNDCLASSEX);
    parent_window.style = 0;
    parent_window.lpfnWndProc = WndProc;
    parent_window.cbClsExtra = 0;
    parent_window.cbWndExtra = 0;
    parent_window.hInstance = hInstance;
    parent_window.hIcon = LoadIcon(NULL,IDI_APPLICATION);
    parent_window.hCursor = LoadCursor(NULL,IDC_ARROW);
    parent_window.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
    parent_window.lpszMenuName = MAKEINTRESOURCE(ID_MENU);
    parent_window.lpszClassName = windclassname;
    parent_window.hIconSm = LoadIcon(NULL, IDI_APPLICATION);

    //Registering the Class for use.
    if ( !RegisterClassEx(&parent_window)){
        MessageBox(NULL,"Could not Register WindowClass","Error",MB_OK);
        return 0;
    }

    //Creating the window
    hwnd = CreateWindowEx(WS_EX_CLIENTEDGE,windclassname,"UI test",WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,250,350,NULL,NULL,hInstance,NULL);
    if ( hwnd == NULL ){
        MessageBox(NULL,"Could not create window","Error",MB_OK);
        return 0;
    }

    ShowWindow(hwnd,nCmdShow);
    UpdateWindow(hwnd);

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

}

LRESULT CALLBACK WndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam){
    switch (msg){
        case WM_CREATE:

            HWND chatbox_cntrl;
            HWND message_text;

            chatbox_cntrl = CreateWindowEx(WS_EX_CLIENTEDGE,"EDIT","",
                WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL | ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL,
                0,0,240,260,hwnd,(HMENU)CHATBOX,GetModuleHandle(NULL),NULL);

            message_text = CreateWindowEx(WS_EX_CLIENTEDGE,"EDIT","",
                WS_CHILD,0,270,240,10,hwnd,(HMENU)MESSAGETEXT,GetModuleHandle(NULL),NULL);

        break;
        case WM_COMMAND:
            switch(LOWORD(wParam)){
                case ID_MABOUT_INFO:
                    DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(ID_MABOUT_INFO), hwnd,AboutDialog);
                break;

                case ID_MCONTROLS_CONNECT:
                    int ret = DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(ID_MCONTROLS_CONNECT), hwnd,ConnectWin);
                break;
                case ID_MCONTROLS_EXIT:
                    DestroyWindow(hwnd);
                break;
            }
        break;
        case WM_CLOSE:
            DestroyWindow(hwnd);
        break;
        case WM_DESTROY:
            PostQuitMessage(0);
        break;
    }
    return DefWindowProc(hwnd,msg,wParam,lParam);

}

INT_PTR CALLBACK AboutDialog(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam){
    switch (msg){
        case WM_CLOSE:
            EndDialog(hwnd,WM_CLOSE);
        break;
        default:
            return false;
    }
    return true;

}

INT_PTR CALLBACK ConnectWin(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam){
    switch(msg){
        case WM_COMMAND:
            switch(wParam){
                case CONNECT_BUTTON:
                    int len = GetWindowTextLength(GetDlgItem(hwnd,EDITTEXT_CONNECT));
                    int recv = GetDlgItemText(hwnd,EDITTEXT_CONNECT,server_ip,len+1);
                    port = GetDlgItemInt(hwnd,EDITTEXT_PORT,NULL,false);
                    EndDialog(hwnd,CONNECT_BUTTON);
                break;
            }
        break;
        case WM_CLOSE:
            EndDialog(hwnd,WM_CLOSE);
        break;
        default:
            return false;
    }
    return true;
}

these are the two controls.

case WM_CREATE:

            HWND chatbox_cntrl;
            HWND message_text;

            chatbox_cntrl = CreateWindowEx(WS_EX_CLIENTEDGE,"EDIT","",
                WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL | ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL,
                0,0,240,260,hwnd,(HMENU)CHATBOX,GetModuleHandle(NULL),NULL);

            message_text = CreateWindowEx(WS_EX_CLIENTEDGE,"EDIT","",
                WS_CHILD,0,270,240,10,hwnd,(HMENU)MESSAGETEXT,GetModuleHandle(NULL),NULL);

        break;
  • 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-18T08:03:02+00:00Added an answer on May 18, 2026 at 8:03 am

    The message text window doesn’t have the same style flags as the first. Specifically, it is missing WS_VISIBLE. This could well be your problem.

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

Sidebar

Related Questions

Imagine I have the following: inFile = /adda/adas/sdas/hello.txt # that instruction give me hello.txt
Hello I have the following code namespace ConsoleApplication2 { class Program { static void
I have the following: val it = DATAX (hello,DATAX (world,DATAX #,DATAX #),... Is there
Hello I have the following error by git-fsck, which cannot be cleaned by git-gc
I have the following line: 14:48 say;0ed673079715c343281355c2a1fde843;2;laka;hello ;) I parse this by using a
Say for example I have the following string: var testString = Hello, world; And
I have the following string: <SEM>electric</SEM> cu <SEM>hello</SEM> rent <SEM>is<I>love</I>, <PARTITION />mind I want
If I have data in the following format id subid text 1 1 Hello
I have a file called hellowf.cs class MyFirstApp { static void Main() { System.Windows.Forms.MessageBox.Show(Hello,
Hello I have a following formvalidatior function in my document. function formValidator(formid) { var

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.