CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2009
    Posts
    31

    Creating a label (WinAPI)

    I've been looking through the documentation of
    CreateWindow and CreateWindowEx and I can't seem to find the style to create a basic label with text.

    it's probably in static, but then again i'm not too sure

    Help would be appreciated.

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,395

    Re: Creating a label (WinAPI)

    What is a "basic label with text"?
    Victor Nijegorodov

  3. #3
    Join Date
    Jun 2009
    Posts
    31

    Re: Creating a label (WinAPI)

    it's like a textbox but with not white or boarders.. basically text to tell the user what the place is for.



    like the textbeside the fields

  4. #4
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,234

    Re: Creating a label (WinAPI)

    Quote Originally Posted by james2432 View Post
    it's probably in static, but then again i'm not too sure
    Be sure you need a static common control (of class "static").
    Take a look at Static Control Styles.
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  5. #5
    Join Date
    Apr 2009
    Posts
    598

    Smile Re: Creating a label (WinAPI)

    Here is an example where a label is created, with an input field on its right side:
    Code:
       static HWND hwnd_st_u, hwnd_ed_u;
       int x, w, y, h;
       y = 10; h = 20;
       x = 10; w = 50;
       hwnd_st_u = CreateWindow("static", "ST_U",
                                  WS_CHILD | WS_VISIBLE | WS_TABSTOP,
                                  x, y, w, h,
                                  hwnd, (HMENU)(501),
                                  (HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);
       SetWindowText(hwnd_st_u, "User:");
    
       x += w; w = 60;
       hwnd_ed_u = CreateWindow("edit", "",
                                  WS_CHILD | WS_VISIBLE | WS_TABSTOP
                                  | ES_LEFT | WS_BORDER,
                                  x, y, w, h,
                                  hwnd, (HMENU)(502),
                                  (HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);
       SetWindowText(hwnd_ed_u, "Bill");

Tags for this Thread

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

Featured