Couple of Questions

This is a discussion on Couple of Questions within the Windows Programming forums, part of the Platform Specific Boards category; Hello everyone, can someone help me answering these questions, I really need them answered, because I can't find then in ...

  1. #1
    Registered User
    Join Date
    May 2005
    Location
    Texas
    Posts
    103

    Couple of Questions

    Hello everyone, can someone help me answering these questions, I really need them answered, because I can't find then in the internet.

    Well, here are my questions:

    1) When creating an edit child control class on a Window, when the user types text, of course, somewhere in the code we must send a message to EM_GETLINE: on the Windows's Procedure right?? Well, how can we actually get the text, I know that the LPARAM has it, yet I don't know how to convert it into a string. How?

    2) After knowing Question 1) , how can I get the strings of Multiple Edit Child Control Classes on a Window??

    3) On Windows API, how can you clear the screen? Such as when I push "NEXT", the window will display something new, for the User, such as the "Next Step".

    4) If the user tries to resize a window, how can I stop, and change it back, or if it possible, not being able to be changed...

    Hope Some of you can help answering my quesitons, and I would appreciate it very. Thank you in advance!!
    Last edited by toonlover; 07-12-2006 at 10:15 AM.
    Be easy on me...only 14

  2. #2
    The larch
    Join Date
    May 2006
    Posts
    3,573
    1)
    int GetWindowTextLength(

    HWND hWnd // handle of window or control with text
    );

    Gets you the length of the text in the edit control.

    2) Allocate a character array with size lenght+1

    3) int GetWindowText(

    HWND hWnd, // handle of window or control with text
    LPTSTR lpString, // address of buffer for text (one you just allocated)
    int nMaxCount // maximum number of characters to copy (length of text)

    );

    To clear the edit box, just set it's text to empty string using SetWindowText()
    Last edited by anon; 07-12-2006 at 10:13 AM.

  3. #3
    Registered User
    Join Date
    Nov 2005
    Posts
    673
    1)
    Code:
    GetWindowText (windowID, char, sizeofarray);
    so basicly,
    Code:
     
    GetWindowText (hwnd, buffer, 50);
    2) use the
    Code:
     SetWindowText(windowID, char );
    3) using SetWindowText() will clear all contents of the window your writing to before adding new text, you can use a AppendText() to add to a window without destroying contents which is like
    Code:
    void AppendText(HWND childt, char* TXT)
    {
    
    	/* Move selection to end of text */
    	SendMessage(childt, EM_SETSEL,
    		GetWindowTextLength(windowID),
    		GetWindowTextLength(windowID));
    
    	/* Add the text line and scroll it into view */
    	SendMessage(windowID, EM_REPLACESEL, FALSE, (LPARAM) TXT);
    	SendMessage(windowID, EM_SCROLLCARET, 0, 0);
    }
    then just use the
    Code:
    AppendText(windowID, char );
    function to add text


    also easy way to clear a single window would be to
    Code:
    SetWindowText(windowID, "");
    hope that helps

  4. #4
    Registered User
    Join Date
    May 2005
    Location
    Texas
    Posts
    103
    Wow, yay! Thanks, do anybody else know's the answers of the rest?? Thank you very much!! Please.
    Be easy on me...only 14

  5. #5
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    > 4) If the user tries to resize a window, how can I stop, and change it back, or if it possible, not being able to be changed...

    You can create a window without a resize button (I think the WS_SYSMENU style specifies this). You should also be able to handle the WM_SIZING message to prevent the user from changing the size manually
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  6. #6
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    I think it is the WS_THICKFRAME style that gives the window a sizing border. So you could use as your style:
    Code:
    WS_OVERLAPPEDWINDOW & ~WS_THICKFRAME

  7. #7
    Registered User
    Join Date
    May 2005
    Location
    Texas
    Posts
    103
    Wow you guys! Thanks! Yet sorry, I still forgot to include one last question....
    How can you make your Windows API be included in the system tray?? Where the time is?
    Be easy on me...only 14

  8. #8
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342

  9. #9
    Even death may die... Dante Shamest's Avatar
    Join Date
    Apr 2003
    Location
    Malaysia
    Posts
    970
    Quote Originally Posted by toonlover
    How can you make your Windows API be included in the system tray?? Where the time is?
    System Tray Icons

  10. #10
    Registered User
    Join Date
    May 2005
    Location
    Texas
    Posts
    103
    Thanks you guys!
    Be easy on me...only 14

  11. #11
    Registered Abuser
    Join Date
    Jun 2006
    Location
    Toronto
    Posts
    591
    Try disable the size command in the system menu also (if you have one).
    First get the system menu, then delete the SC_SIZE item from it:
    Code:
    HMENU hSysMenu = GetSystemMenu(hwnd, FALSE);
    DeleteMenu(hSysMenu, SC_SIZE, MF_BYCOMMAND);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Couple of questions about XOR linked lists...
    By klawson88 in forum C Programming
    Replies: 5
    Last Post: 04-19-2009, 05:55 PM
  2. Couple of simple directdraw questions.
    By Deo in forum Game Programming
    Replies: 3
    Last Post: 05-25-2005, 08:55 AM
  3. Studying for Final, Couple Questions...
    By stewade in forum C Programming
    Replies: 4
    Last Post: 05-10-2004, 06:02 PM
  4. A couple of Questions
    By johnnabn in forum C++ Programming
    Replies: 4
    Last Post: 02-24-2003, 10:10 PM
  5. A couple of PowerPoint questions.
    By sean in forum Tech Board
    Replies: 2
    Last Post: 01-27-2003, 05:26 AM

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