Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
How do I put this into a C++11 edit box instead of the CLI?

#define _UNICODE
#define UNICODE

#include <conio.h>
#include <stdio.h>

const int TextOne  = 4;

int main(void){
   using namespace std;
   wstring_convert<codecvt_utf8<wchar_t>, wchar_t> CatsInUnicode;
   wstring mixedstring = L"I like cats = 猫が好きです";
 
   for (auto UX : mixedstring){
      cout << CatsInUnicode.to_bytes(UX) << '\n';
   }
   return 0;
}


What I have tried:

Studied .to_bytes and found a lot of CLI examples with explanations but no GUI. Can this be put into a C++11 edit box (CreateWindowExW)?

I think that if I put
CatsInUnicode.to_bytes(UX)
into the edit box then it will work. I am not clear how to do this with
hedit = CreateWindowExW
. Do I use a button to do this?


What do I do with this, and am I doing this correctly?

hedit = CreateWindowExW(
   WS_EX_CLIENTEDGE,
   L"EDIT",
   L"Cats with Unicode",
   WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_LEFT | ES_MULTILINE | ES_AUTOVSCROLL,
   10, 10,
   100, 700,
   hwnd,
   (HMENU) TextOne,
   GetModuleHandle( nullptr ),
   nullptr
   );



I think that I replace
int main(void){


I think that I use
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    LPSTR lpCmdLine, int nCmdShow)
    {
        WNDCLASSEX wc;
        MSG Msg;

        wc.cbSize        = sizeof(WNDCLASSEX);
        wc.style         = 0;
        wc.lpfnWndProc   = WndProc;
        wc.cbClsExtra    = 0;
        wc.cbWndExtra    = 0;
        wc.hInstance     = hInstance;
        wc.hIcon         = LoadIcon(nullptr, IDI_APPLICATION);
        wc.hCursor       = LoadCursor(nullptr, IDC_ARROW);
        wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
        wc.lpszMenuName  = nullptr;
        wc.lpszClassName = my_window_ClassName;
        wc.hIconSm       = LoadIcon(nullptr, IDI_APPLICATION);

        if(!RegisterClassEx(&wc))
            {
                MessageBox(nullptr, L"Window Registration Failed!", L"Error!", MB_ICONEXCLAMATION | MB_OK);
                return 0;
            }

        Handle_Main_Window = CreateWindowExW
            (
                WS_EX_CLIENTEDGE,
                my_window_ClassName,
                L"Cats Title",
                WS_OVERLAPPEDWINDOW,
                CW_USEDEFAULT,
                CW_USEDEFAULT,
                150,
                750,
                nullptr,
                nullptr,
                hInstance,
                nullptr
            );

        if(Handle_Main_Window == NULL)
            {
                MessageBox(nullptr, L"Window Creation Failed!", L"Error!", MB_ICONEXCLAMATION | MB_OK);
                return 0;
            }

        ShowWindow(Handle_Main_Window, nCmdShow);
        UpdateWindow(Handle_Main_Window);

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



More attempts:

// create a string
std::wstring mixedstring = L"I like cats = 猫が好きです";


// setup converter
typedef  std::codecvt_utf8<wchar_t> convert_type;
std::wstring_convert<convert_type, wchar_t> converter;

// use converter (.to_bytes: wstr->str, .from_bytes: str->wstr)
std::string converted_str = converter.to_bytes( mixedstring );

// Output the converted bytes (UTF-8)
for (size_t i = 0; i < converted_str.length(); ++i)
{
    // This part here.
    // Can I put this into the CreateWindowExW EDIT box
    // instead of printing it out?
    print_char_hex(converted_str[i]);
}
    // Or this part here.
    // Can I put this into the CreateWindowExW EDIT box
    // instead of printing it out?
std::cout << std::endl;



Please no Visual Studio. Please no boost. C++11 please.

Thank you for your help.
Posted
Updated 6-Dec-20 1:19am
v6
Comments
Rick York 5-Dec-20 14:50pm    
What is a C++11 edit box? I have worked with Windows for about thirty years and I have never heard of one.

Besides that, C++17 is considerably better. I would hate to lose the improvements it has.
PotatoSoup 5-Dec-20 21:42pm    
Rick York, "What is a C++11 edit box? I have worked with Windows for about thirty years and I have never heard of one."

L"EDIT",

30 years? Maybe after 30 years you are just now learning C++ also. Maybe these real programmers can help you too. Maybe you need to read codeproject.com more.

30 years. It took me a while to decide to learn C++. I understand. It is OK. You probably should have just made that a question like, "After 30 years of using Windows, I am just now starting to learn programming, and I have not heard of edit box. What is it?" That would probably have been better.

These might help you.

https://www.codeproject.com/Messages/4095520/win32-edit-box-validating-text

https://stackoverflow.com/questions/25356724/how-to-map-help-id-of-a-error-messagebox-in-mfc

https://www.codeproject.com/KB/edit/#Beginners

https://stackoverflow.com/questions/44588648/handler-for-when-an-edit-box-gains-focus-in-c-mfc-app

https://www.codeproject.com/Articles/6385/Controls-in-controls-A-line-numbering-edit-box

https://www.codeproject.com/Articles/6386/Rapid-data-entry-An-edit-box-with-a-history

https://www.codeproject.com/Articles/6382/Controls-in-controls-An-edit-box-with-an-icon

OK.
Rick York 6-Dec-20 14:56pm    
Yes, those confirmed my statement. The fact is there is NO such thing as a C++11 edit box. Actually, that was not particularly helpful because I already knew that. Apparently you still do not.
PotatoSoup 7-Dec-20 12:35pm    
At the bottom of this page it says, "Let's work to help developers, not make them feel stupid." Read that. So you are smart. So you know a lot of [something]. That line is still at the bottom of this page. People like you need to read it again, often. I do not need you to tell me that I "do not" know things. I already know that I do not know. What I also know is that I did not appreciate your degradation. "Let's work to help developers, not make them feel stupid." If you are so smart as to give advice, then you should be so smart as to read that line on the bottom of this page, "Let's work to help developers, not make them feel stupid." Read it.

"I have worked with Windows for about thirty years and I have never heard of one." did not "work to help developers". It was arrogant. I still reject that statement of yours as it being not helpful.

"Let's work to help developers, not make them feel stupid."

I submit to this site's management to decide whether I was right or wrong in rejecting those statements of yours. I will abide by their decision.


See Edit Control (Windows Controls) - Win32 apps | Microsoft Docs[^] for all the properties and methods of the Eddit control.
 
Share this answer
 
Comments
PotatoSoup 5-Dec-20 21:51pm    
Richard MacCutchan,

Maybe I need to read that first line of my question post for you. Here it is: "How do I put this into a C++11 edit box instead of the CLI?".

Maybe you need someone to read to you where I was using .to_bytes with CLI first.

Your answer was a waste. It was almost less than a nullptr. It did not even slightly address my question.
Richard MacCutchan 6-Dec-20 3:22am    
Maybe you need to read your first statement: "How do I put this into a C++11 edit box instead of the CLI?"

Firstly, as Rick York already pointed out, there is no such thing as a C++11 edit box. There is only a Windows Edit control. And putting text into an edit control is quite simple, if you take the time to study the documentation. But it seems that you would far rather waste your time insulting people who try to help you. You will obviously go far in life.
PotatoSoup 7-Dec-20 13:25pm    
"putting text into an edit control is quite simple, if you take the time to study the documentation" Maybe for you. Not for me. I read the documentation and I have been struggling with it for days. I took the time. I studied the documentation. I am not at your level. I spent hours studying (looking up on this site and others) one word at a time of the documentation, and then when I was finished, I did not quite know what it was I was supposed to know. I did that multiple times. It became a fight to learn. Then I come here, and I get reminded that I am so far below the level of others here that they ridicule me for not knowing.

"But it seems that you would far rather waste your time insulting people who try to help you. You will obviously go far in life." Rejecting ridicule from someone is not insulting. They did not try to help. They tried to point out how stupid I am. I will go far and I will get through my unknowing of C++. I am not Stroustrup. I am not you. I am a beginner. I am so low in knowing this stuff that my simple question attracted ridicule from even you. That is sad. I had hoped for better from you at your expert level. Do you not remember being so new to programming that it was like a fog? I reject all ridicule. Ridicule, all by itself, if I understand it, comes from a weak mind. I beg for programming help.

Thank you for your help.

I am missing something. Firstly, in my several decades of working with Windows code I have never heard of a C++11 edit box. In Windows, the edit box has nothing to do with C++, 11 or otherwise. It is just a control so I have no idea what that is.

Secondly, WHY? Why are you calling to_bytes? You have Unicode defined, you called CreateWindowExW to create the edit control, so why are not just loading the text right into the control? Richard posted a link to the docs. You should read them. Windows works with Unicode natively so you can load Chinese, Katakana, Cyrillic, Greek, Sanskrit, and any other kind of text directly into its controls.

If your question is about using to_bytes - that is an entirely separate issue from the control. The control accepts and expects Unicode text so that is what you need to give it.
 
Share this answer
 
Comments
PotatoSoup 5-Dec-20 22:07pm    
Rick York,

"In Windows, the edit box has nothing to do with C++,". I thought that I was a beginner. I use C++ and in the code I use an edit box. There is a more correct name, but you claim to "several decades" of working with Windows "code", and yet you seem to have missed those codeproject.com pages that I listed earlier. That is two answers from beginners. I had hoped for someone beyond a neophyte to answer.

"WHY? Why are you calling to_bytes?" That is irrelevant to you. I am a beginner and I am attempting to learn. Why I want to learn is none of your business. You would have done better to make your own question, "I know nothing and I want to know why other people want to learn, so why?" Start your own post. You wasted time here.

In your attempt to impress, to which you failed. You missed stating when Microsoft Windows started using Unicode and the UTF to which Windows uses it. You just spewed out some catch phrases and wasted more time.

"If your question is about using to_bytes - that is an entirely separate issue from the control. The control accepts and expects Unicode text so that is what you need to give it." Read the question again. You are proving yourself to be arrogant and wasting time. nullptr might have a chance of being more than your response.
As I am in a forgiving mood, here is a simple sample that you can modify to your own needs.

This simple program creates a main Window with an EDIT control inside it. On clicking the
Open selector of the File menu item some text will be posted to the control.
As you can see this has nothing to do with C++11, or any other version.
C++
/*
 *              Copyright © CodeProject, 1999-2020
 *
 ******************************************************************************
 *
 *    Name      : SimpleEdit.cpp
 *
 *    Function  : Basic Windows example of using Edit control.
 *
 ******************************************************************************
 */

#define WIN32_LEAN_AND_MEAN     // Exclude rarely-used stuff from Windows headers
#include <windows.h>            // general windows definitions

#define ID_FILE_OPEN    201 // 
#define ID_APP_EXIT     203 //

// handle to the Edit control
static HWND hWndEdit;

/// <summary>
/// Handle the <c>WM_CREATE</c> message. Any one-time code or modifications
/// to the <c>CREATESTRUCT</c> parameters may be performed here.
/// </summary>
///
/// <param name="hWnd">handle to the window being created</param>
/// <param name="pCreateStruct">pointer to a <c>CREATESTRUCT</c></param>
///
/// <returns><c>TRUE</c> if create activities were successful</returns>
///
BOOL OnCreate(HWND              hWnd,
              LPCREATESTRUCT    pCreateStruct
              )
{
    // create an Edit control to be placed in the client area of the main window
    hWndEdit = CreateWindowEx(WS_EX_CLIENTEDGE,
        TEXT("EDIT"),
        NULL,
        WS_VISIBLE | WS_CHILD | WS_VSCROLL | ES_LEFT | ES_MULTILINE | ES_AUTOVSCROLL,
        0,
        0,
        0,
        0,
        hWnd,
        0,
        pCreateStruct->hInstance,
        0
    );

    return TRUE;        // done!
}


// handle the WM_SIZE message, to ensure the child window gets resized properly
void OnSize(HWND hWnd, UINT uState, int nWidth, int nHeight)
{
    if (nWidth == 0)
        return;
    // resize the child windows
    MoveWindow(hWndEdit, 0, 0, nWidth, nHeight, TRUE);

}


/// <summary>
/// Dispatcher for the <c>WM_xxx</c> Windows messages.
/// Called to action the messages generated
/// in response to user actions on the main window.
/// </summary>
///
/// <param name="hWnd">handle to the main window</param>
/// <param name="uMessage">a <c>WM_xxx</c> message constant</param>
/// <param name="wParam">parameter associated with the <c>WM_xxx</c> message</param>
/// <param name="lParam">parameter associated with the <c>WM_xxx</c> message</param>
///
/// <returns>Value depends on the actual message being processed</returns>
///
static
LRESULT CALLBACK WndProc(HWND       hWnd,
                         UINT       uMessage,
                         WPARAM     wParam,
                         LPARAM     lParam
                         )
{
    switch (uMessage)
    {
    case WM_CREATE:
        return OnCreate(hWnd, reinterpret_cast<LPCREATESTRUCT>(lParam));

    case WM_COMMAND:
    {
        if (LOWORD(wParam) == ID_FILE_OPEN)
        {
            SetWindowText(hWndEdit, L"\r\n\r\n\tThe rain in Spain falls mainly on the ground ...");
            return 0;
        }
        return 1;   // command not handled here
    }

    case WM_SIZE:
        OnSize(hWnd, wParam, LOWORD(lParam), HIWORD(lParam));
        break;

    case WM_DESTROY:
        PostQuitMessage(0);
        break;

    default:
        return DefWindowProc(hWnd, uMessage, wParam, lParam);
    }

    return 0;
}


/// <summary>
/// Main function of the windows application.
/// This function registers a Windows class and creates
/// a window which is an instance of that class, then
/// dispatches the <c>WM_xxx</c> messages sent to the window.
/// </summary>
///
/// <param name="hInstance">instance value of the invoked application</param>
/// <param name="hPrevInstance">no longer used</param>
/// <param name="pszCmdLine">pointer to the MS-DOS command line</param>
/// <param name="nCmdShow">value indicating initial state of the window</param>
///
/// <returns>Return value from final message</returns>
///
int APIENTRY wWinMain(HINSTANCE hInstance,
                      HINSTANCE hPrevInstance,
                      PWSTR     pszCmdLine,
                      int       nCmdShow
                      )
{
    WNDCLASSEX      wndClassEx; // class structure
    HWND            hWnd;
    MSG             msg;

    //  Register the window class
    wndClassEx.cbSize           = sizeof wndClassEx; 
    wndClassEx.style            = CS_HREDRAW | CS_VREDRAW;
    wndClassEx.lpfnWndProc      = WndProc;
    wndClassEx.cbClsExtra       = 0;
    wndClassEx.cbWndExtra       = 0;
    wndClassEx.hInstance        = hInstance;
    wndClassEx.hIcon            = nullptr;
    wndClassEx.hCursor          = LoadCursor(NULL, IDC_SIZEWE);
    wndClassEx.hbrBackground    = reinterpret_cast<HBRUSH>(COLOR_SCROLLBAR + 1);
    wndClassEx.lpszMenuName     = TEXT("IDR_MAINFRAME");
    wndClassEx.lpszClassName    = TEXT("SimpleEdit");
    wndClassEx.hIconSm          = NULL;

    if (!RegisterClassEx(&wndClassEx))
    {
        return FALSE;
    }

    // create the main frame window
    hWnd = CreateWindowEx(
        WS_EX_CLIENTEDGE,           // extended window style
        wndClassEx.lpszClassName,   // registered class name
        TEXT("SimpleEdit"),         // and window title
        WS_OVERLAPPEDWINDOW,        // window style
        CW_USEDEFAULT,              // horizontal position of window
        0,                          // vertical position of window
        600,                        // window width
        350,                        // window height
        NULL,                       // handle to parent or owner window
        NULL,                       // menu handle or child identifier
        hInstance,                  // handle to application instance
        NULL                        // sent with WM_CREATE message in CREATESTRUCT
        );
    if (!hWnd)
    {
        return FALSE;               // CreateWindow failed...
    }

    // display the main frame window
    ShowWindow(hWnd, nCmdShow);     // show the window frame and
    UpdateWindow(hWnd);             // update the client area

    // Main message loop:
    while (GetMessage(&msg, NULL, 0, 0) > 0) 
    {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }

    // all done...
    return msg.wParam;
}

Include the following resource script to add the menu to the main Window.
C++
/*
 *              Copyright © CodeProject, 1999-2020
 *
 ******************************************************************************
 *
 *    Name      : SimpleEdit.rc
 *
 *    Function  : SimpleEdit resource script
 *
 ******************************************************************************
 */

#include <winresrc.h>

/////////////////////////////////////////////////////////////////////////////
//
// Menu

IDR_MAINFRAME   MENU
BEGIN
    POPUP   "&File"
    BEGIN
        MENUITEM    "&Open",    201 // ID_FILE_OPEN
        MENUITEM SEPARATOR
        MENUITEM    "E&xit",    203 // ID_APP_EXIT
    END
END


/////////////////////////////////////////////////////////////////////////////
//
// English (U.K.) resources

LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK

/////////////////////////////////////////////////////////////////////////////
//
// Version

VS_VERSION_INFO VERSIONINFO
    FILEVERSION     1, 0, 0, 0
    PRODUCTVERSION  1, 0, 0, 0
    FILEFLAGSMASK   VS_FFI_FILEFLAGSMASK
#if defined(_DEBUG)
    FILEFLAGS   VS_FF_DEBUG
#else
    FILEFLAGS   0x0L
#endif
    FILEOS      VOS_NT_WINDOWS32
    FILETYPE    VFT_APP
    FILESUBTYPE VFT2_UNKNOWN
BEGIN
    BLOCK   "StringFileInfo"
    BEGIN
        BLOCK   "080904b0"
        BEGIN
            VALUE   "FileDescription",      "SimpleEdit Application"
            VALUE   "FileVersion",          "1, 0, 0, 0"

            VALUE   "ProductName",          "SimpleEdit"
            VALUE   "ProductVersion",       "1, 0, 0, 0"

            VALUE   "InternalName",         "SimpleEdit"
            VALUE   "OriginalFilename",     "SimpleEdit.exe"

            VALUE   "CompanyName",          "CodeProject"
            VALUE   "LegalCopyright",       "Copyright© 2020"
            VALUE   "LegalTrademarks",      ""
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x809, 0x4b0
    END
END
 
Share this answer
 
Comments
PotatoSoup 7-Dec-20 13:29pm    
THANK YOU.

I am not certain what you wrote.

But, I will now study it. I will probably have to read and study many of the commands that you used. But, at my level, I know that is what I have to do. Maybe I will then see some way through this fog of beginning. Thank you.

THANK YOU. Thanks to this site. I now have, even if it does not directly address my question, SOMETHING to at least guide me in some direction.

Thank you.
PotatoSoup 7-Dec-20 13:53pm    
I think that I shall begin by studying your use of the following:

SetWindowText(hWndEdit, L"\r\n\r\n\tThe rain in Spain falls mainly on the ground ...");

I think SetWindowText is something that I need to learn before going on. Then maybe I can learn how to use this to put the Unicode numbers that I get with .to_bytes representing the Unicode text into the text box. I probably miss-explained, and called things the wrong thing, but I am being helped.

If I get this to work, in my program, I hope to get back to you with it.

Thank you Richard MacCutchan.
Richard MacCutchan 7-Dec-20 15:45pm    
We are not trying to ridicule you in any way, we are genuinely trying to help. But when you post a question that includes quite a lot of code we assume (because we do not know you) that you have a reasonable understanding of the basics of a) the programming language you are using, and b) the general principles of Windows programming. However, it seems that we were mistaken and you may not yet have experience of using these aspects of programming. So perhaps my suggested code does not make a lot of sense. If that really is the case then maybe you need to step back and try a few tutorials on the basics of Windows programming, it is not something you can learn easily from posting questions here.
PotatoSoup 7-Dec-20 16:03pm    
Thank you.

I am retired from an industry where I was required to learn and comprehend and be able to apply very fast. Within minutes. I was a general industrial repair man, called in to repair or replace mistakes by others that often required me to learn new applications on-site almost immediately and fix or repair quickly at potential great cost to my employer if I failed.

I have found C++ to be an incredibly intense strain to success at that speed. I have found that with C++ I have NOT! This is a new world. A new foreign language of its own intensity and structure.

I worked with others that had the same demands upon them and we freely offered help to each other quickly without any judgmental comments. I am not yet used to those two changes. I will get there. Thus, in this new field, I shall adjust.

That all said, I think that I have fallen in love with C++ programming. I might even suggest that this is probably one of the best mental exercises that the retired could do.

I apologize. Your comments were, I hope, as among fellows with friendly teasing. I see that now. I again apologize. Please forgive me.

Thank you.

Thank you all.

Every one of you.

Thank you.
PotatoSoup 7-Dec-20 15:38pm    
Looking at your example. Trying to understand what I have been reading about some of it.

(1)

I have been reading about WinMain vs wWinMain and I am not certain that I understand the best application for each.

Microsoft uses, "PWSTR pCmdLine," and "pCmdLine contains the command-line arguments as a Unicode string." ( https://docs.microsoft.com/en-us/windows/win32/learnwin32/winmain--the-application-entry-point ). I was using, "LPSTR lpCmdLine," because I thought it was better for both CLI and GUI. Now that I read that particular Microsoft page, I think that wWinMain with PWSTR is preferred for CLI and not for GUI. Which is it?



Also,
(2)

Which is better to use WinMain or wWinMain for my program if I want it to be later compiled on 32 bit Windows like XP 32 bit, and later compiled on 64 bit Windows 10? Or should I use WinMain on one and wWinMain on the other?




I see that you used PWSTR in your wWinMain where I used LPSTR in WinMain. Other than the [...]Main parts:

I am not certain what I am being told by Microsoft for the following.


(3)

Microsoft says, that PWSTR is "A 64-bit unsigned integer." ( https://docs.microsoft.com/en-us/windows/win32/winprog/windows-data-types?redirectedfrom=MSDN ) I think that a DWORD is a 64-bit unsigned integer, which I thought works in the old XP 32 bit operating system. But, I see it here, so I am now not so certain if I correctly understand it. Does that mean that if I want my programs to be backward compatible to 32 bit systems like XP 32 bit, that I should not use this? I am not clear on what Microsoft is saying here.



(4)

I was reading that for "LPWSTR and PWSTR in the Windows Data Types": ( https://social.msdn.microsoft.com/Forums/vstudio/en-US/52ab8d94-f8f8-427f-ad66-5b38db9a61c9/difference-between-lpwstr-and-pwstr ) "Yes, they are the same. The L in LPWSTR stands for "long/far pointer" and it is a leftover from 16 bit when pointers were "far" or "near". Such a distinction no longer exists on 32/64 bit, all pointers have the same size." Does that mean that I should use PWSTR in both 32 bit and 64 bit C++ code?


(5)

Microsoft says, "The LPSTR type and its alias PSTR specify a pointer to an array of 8-bit characters, which MAY be terminated by a null character." ( https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-dtyp/3f6cc0e2-1303-4088-a26b-fb9582f29197 )
and, "The format of the characters MUST be specified by the protocol that uses them. Two common 8-bit formats are ANSI and UTF-8."

Microsoft says, "The LPWSTR type is a 32-bit pointer to a string of 16-bit Unicode characters, which MAY be null-terminated."

If I use in my Unicode string parsing (whether by the actual characters or by the hex(?) number) UTF-8 exclusively, does that mean that for me LPSTR is better?

If I use similar to the previous question, but more than UTF-8 (also UTF-16 and UTF-32), does that mean that for me LPWSTR is better?


Thank you.
codeproject.com has some amazing coders. I have enjoyed reading and learning from many of the answers given on this site.

I apologize to [DELETED].com for asking a question to which the arrogant and the mentally limited have had such such difficulty.

A search on Google.com for +"C++" +"CreateWindow" +"EDIT" gives, according to Google.com "About 50,800 results". Not a new thing.

codeproject.com
"what is the simplest way to create edit box in c++"
visual c++ - what is the simplest way to create edit box in c++ - Stack Overflow[^]

Part of an answer from that page:
CreateWindow("EDIT", ...);. You can use CreateWindowEx if you prefer, but it's not necessary.

I could have used a Dialog Box like the following quote from that page:
"Of course you can also create a dialog (DialogBox or DialogBoxEx) containing an edit control. This avoids having to manually set the focus and such."
But I am learning CreateWindow.

Please, no more arrogant beginners attempting to impress. I am a beginner and I am attempting to learn from this site's already impressive masters of code.

I hope that is better.

Thank you for allowing me to ask a question here.
 
Share this answer
 
v2
Comments
OriginalGriff 6-Dec-20 1:47am    
This is not a solution.
It looks close to spam, but I'll fix that for you ...
And it is on the edge of begin rude, but since I can't work out who you are trying to insult I won't treat it as abusive, yet.
Richard MacCutchan 6-Dec-20 3:24am    
Me and Rick York are the targets of his ire.
OriginalGriff 6-Dec-20 3:35am    
So I see.
Sorry, I was just starting my first coffee of the day ...

Hmm. I'm tempted to call him abusive and start the kicking process. He's certainly angry and unthinking ... Your thoughts?
Richard MacCutchan 6-Dec-20 3:47am    
Looking at a previous question he seemed better behaved, so I think just let it pass. But one to watch for the future.
PotatoSoup 7-Dec-20 13:40pm    
No! It is not you and Rick. It is your ridicule of my unknowing. Probably you and Rick are extremely adapt at programming, which I am not. But, even though I am willing to beg, and willing to admit that I do not know even what it is that I do not know, I will still not take ridicule.

I lean heavily upon codeproject.com's "Let's work to help developers, not make them feel stupid". I see it as a shield against ridicule. Thank you codeproject.com for having that.

Thank you OriginalGiff for editing my post. I was typing fast and that was a missspelling. I tried to edit it.

Thank you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900