Thread: GetStockObject()

  1. #1
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972

    GetStockObject()

    Whenever I try to use GetStockObject I get a linker error like:
    c:\dev-c++\myproj\winapp3\winapp.o(.text+0x126):winapp.cp p: undefined reference to `GetStockObject@4'
    for example i was using it in an edit control:
    Code:
    HFONT hfDefault;
            HWND hEdit;
    
            hEdit = CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "", 
                WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL | ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL, 
                0, 0, 100, 100, hwnd, (HMENU)IDC_MAIN_EDIT, GetModuleHandle(NULL), NULL);
            if(hEdit == NULL)
                MessageBox(hwnd, "Could not create edit box.", "Error", MB_OK | MB_ICONERROR);
    
            hfDefault = GetStockObject(DEFAULT_GUI_FONT);
            SendMessage(hEdit, WM_SETFONT, (WPARAM)hfDefault, MAKELPARAM(FALSE, 0));
    I am using Dev C++ 4

    EDIT: Disregard this post I found the problem.
    Last edited by JaWiB; 02-23-2003 at 11:45 PM.
    "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

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. My first "real" windows app
    By JoshR in forum Windows Programming
    Replies: 2
    Last Post: 07-28-2005, 07:40 AM
  2. predefined button color
    By FOOTOO in forum Windows Programming
    Replies: 3
    Last Post: 01-30-2005, 04:07 PM
  3. Question: GetStockObject()
    By dicky in forum Windows Programming
    Replies: 4
    Last Post: 05-31-2004, 08:33 AM