Thread: function parameter questions

  1. #1
    Registered User
    Join Date
    Feb 2006
    Posts
    71

    function parameter questions

    I have 2 questions, The first being how does MAKELPARAM() macro generate a proper lparam for my EDIT box with these parameters:

    Code:
    SendMessage(hEdit, WM_SETFONT, (WPARAM)hfDefault, MAKELPARAM(FALSE, 0));
    The second being, how does IDC_MAIN_EDIT become a handle to my edit box by implementing it into the menu parameter in my CreateWindowEx() function:
    Code:
                     hEdit = CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "", 
                                            WS_CHILD | WS_VISIBLE,
                                            0,0,0,0, hwnd, (HMENU)IDC_MAIN_EDIT,
                                            GetModuleHandle(NULL), NULL);

  2. #2
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    MAKELPARAM forms a DWORD sized LPARAM value from two WORD values. In the case of WM_SETFONT, the high order word (second argument to the macro) is unused, and the low order word (first argument of the macro) is either FALSE or TRUE depending on whether you want it redrawn.

    In CreateWindowEx, the hMenu parameter can also be a child window identifier (in your case, the edit control). MSDN says:

    hMenu
    [in] Handle to a menu, or specifies a child-window identifier, depending on the window style. For an overlapped or pop-up window, hMenu identifies the menu to be used with the window; it can be NULL if the class menu is to be used. For a child window, hMenu specifies the child-window identifier, an integer value used by a dialog box control to notify its parent about events. The application determines the child-window identifier; it must be unique for all child windows with the same parent window.

  3. #3
    Registered User
    Join Date
    Feb 2006
    Posts
    71

    thanks

    Well, that seemed to clear things up, thanks.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Beginner Needs help in Dev-C++
    By Korrupt Lawz in forum C++ Programming
    Replies: 20
    Last Post: 09-28-2010, 01:17 AM
  2. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  3. Bisection Method function value at root incorrect
    By mr_glass in forum C Programming
    Replies: 3
    Last Post: 11-10-2005, 09:10 AM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  5. qt help
    By Unregistered in forum Linux Programming
    Replies: 1
    Last Post: 04-20-2002, 09:51 AM