Results 1 to 3 of 3

Thread: Scroll Bars in an Edit box...

  1. #1
    Guest

    Question

    This is in a header file I am writing to make it easier to create buttons and other controls(with the Windows API)

    Code:
    #include <windows.h>
    
    
    HWND CreateButton(HINSTANCE hInstance, HWND parent, char * text, int x, int y, int cx, int cy)
    {
        HWND hwndb;
        hwndb = CreateWindowEx(0, "BUTTON", text, WS_CHILD, x, y, cx, cy, parent, NULL, hInstance, NULL);
        return hwndb;
    }
    
    HWND CreateEdit(HINSTANCE hInstance, HWND parent, char * text, int x, int y, int cx, int cy)
    {
        HWND hwnde;
        hwnde = CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", text, WS_CHILD + ES_MULTILINE, x, y, cx, cy, parent, NULL, hInstance, NULL);
        return hwnde;
    }
    both functions work,
    but I don't know which style to use to make the text box have a verticle and horizontal scrollbar...

    I can't seem to find it in the platform SDK...



    Thanks,

    Dennis

  2. #2
    Guest
    Come on... can't somebody help me??



    Thanks,
    Dennis

  3. #3
    Guest
    Ok, Somebody helped me figure it out...
    incase you are wondering... here is my code

    Code:
    #include <windows.h>
    #include <string>
    
    using namespace std;
    
    
    HWND MCreateEdit(HINSTANCE hInstance, HWND parent, string text, int x, int y, int cx, int cy, bool multiline)
    {
    
        long styles = 0;
        HWND hwnde;
        if (multiline == true)
        {
            styles = ES_MULTILINE | WS_HSCROLL | WS_VSCROLL;
        }
        hwnde = CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", text.c_str(), WS_CHILD | WS_VISIBLE | styles, x, y, cx, cy, parent, NULL, hInstance, NULL);
        return hwnde;
    }


    Dennis

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width