STATIC text label or LABEL in Windows APP - NO MFC!

This is a discussion on STATIC text label or LABEL in Windows APP - NO MFC! within the Windows Programming forums, part of the Platform Specific Boards category; Hi, When you use an EDIT control for user input in a Visuall C++ Windows App usuing API (NO MFC), ...

  1. #1
    Registered User
    Join Date
    Sep 2004
    Posts
    15

    STATIC text label or LABEL in Windows APP - NO MFC!

    Hi,

    When you use an EDIT control for user input in a Visuall C++ Windows App usuing API (NO MFC), it's fairly straightforward how to do this using the CreateWindow() and assigning it to a HWND data type handle in the main function. Most programs place a brief explanatory text with perhaps a colon before the EDIT control text box (e.g. Enter Age.
    What is the standard/simplest way of doing this in a Windows APP using C++, that is not based upon MFC, but goes straight with API? Code examples please...

    Thanks in advance,
    triste

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,669

  3. #3
    Registered User
    Join Date
    Sep 2004
    Posts
    15
    Yes, I would think a static control is what would be suitable...

    >>What is the standard/simplest way of doing this in a Windows APP using C++, that is not based upon MFC, but goes straight with API?

    >>Code examples please...

  4. #4
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,669
    Use CreateWindow() to create standard controls. This tutorial covers all the basics you need to know.

    gg

  5. #5
    Registered User
    Join Date
    Sep 2004
    Posts
    15
    Try this:

    (http://msdn.microsoft.com/library/
    default.asp?url=/library/en-us/shellcc/platform/commctls/staticcontrols/aboutstaticcontrols.asp)

    //handle declaration
    HWND hwndLabel;

    //code inside WINAPI WinMain() function
    hwndLabel = CreateWindow("STATIC","Enter Age:",
    WS_VISIBLE | WS_CHILD | SS_RIGHT,
    10,200,75,35,hWnd,NULL,hInstance,NULL);

    Simple and to the point; code example; only took a few lines of code.

  6. #6
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,669
    Why don't you try clicking on the "Static Controls" of my first post.
    And then "This tutorial" in my second post.

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. non-MFC DLL with MFC app question.
    By Kempelen in forum Windows Programming
    Replies: 10
    Last Post: 08-20-2008, 07:11 AM
  2. Which one :MFC, Win32, Windows Forms (.Net)?
    By Robert_Sitter in forum Windows Programming
    Replies: 6
    Last Post: 11-17-2005, 05:15 AM
  3. MFC: Change the color of static text with button press?
    By BrianK in forum Windows Programming
    Replies: 2
    Last Post: 06-16-2004, 11:03 PM
  4. Static Text In MFC
    By Unregistered in forum Windows Programming
    Replies: 0
    Last Post: 05-25-2002, 02:41 PM
  5. Outputting String arrays in windows
    By Xterria in forum Game Programming
    Replies: 11
    Last Post: 11-13-2001, 06:35 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21