Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - SajibFinix

Pages: [1]
1
C - C++ / Re: Program Is Not Compiling But It Should!
« on: March 04, 2013, 08:51:45 pm »
 :D
Thanks.

2
C - C++ / Re: Program Is Not Compiling But It Should!
« on: March 04, 2013, 08:42:29 pm »
Thanks.
Its working!!
But what is Linker Options? @Deque

3
C - C++ / Program Is Not Compiling But It Should!
« on: March 04, 2013, 06:17:41 pm »
This following program isn't compiling.......

Code: (c) [Select]
#include <windows.h>

LRESULT CALLBACK WindowFunc(HWND, UINT, WPARAM, LPARAM);

char szWinName[] = "MyWin"; //window clss name

int WINAPI WinMain(HINSTANCE hThisInst, HINSTANCE hPrevInts, LPSTR lpszArgs, int nWinMode){


    HWND hwnd;
    MSG msg;
    WNDCLASSEX wcl;


    /*define window clss*/
    wcl.cbSize = sizeof(WNDCLASSEX); //size of WNDCLASSEX
    wcl.hInstance = hThisInst; //Handle to this instance
    wcl.lpszClassName = szWinName; //window class name
    wcl.lpfnWndProc = WindowFunc; //window function
    wcl.style = 0; //default style
    wcl.hIcon = LoadIcon(NULL, IDI_APPLICATION); //icon style
    wcl.hIconSm = LoadIcon(NULL, IDI_WINLOGO); //small icon style
    wcl.hCursor = LoadCursor(NULL, IDC_ARROW); //Cursor style
    wcl.lpszMenuName = NULL; //as no menu
    wcl.cbClsExtra = 0; //as no extra
    wcl.cbWndExtra = 0; //information needed
    wcl.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); //Window Background: White
    if(!RegisterClassEx(&wcl)) return 0;


    /*Now a window class has been registered, a window can be created*/
    hwnd = CreateWindow(
        szWinName, //name of window class as prmtr
        "Window Skeleton", //Title
        WS_OVERLAPPEDWINDOW, // Window Style: Normal
        CW_USEDEFAULT, // X coordinate: Let Window Choose
        CW_USEDEFAULT, // Y coordinate: Let Window Choose
        CW_USEDEFAULT, // Width: Let Window Choose
        CW_USEDEFAULT, // Height: Let Window Choose
        HWND_DESKTOP, // No parent window
        NULL, // As No Menu
        hThisInst, // Handle to this Instance of the program
        NULL // No Additional Arguments
    );


    /*Display The Window*/
    ShowWindow(hwnd, nWinMode);
    UpdateWindow(hwnd);


    /*Creat The Message Loop*/
    while(GetMessage(&msg, NULL, 0, 0)){
        TranslateMessage(&msg); // Translate Keyboard Message
        DispatchMessage(&msg); // Return Control To Window
    }
    return msg.wParam;
}


/*This Function Called By Window And Is Passed Message from queue*/
LRESULT CALLBACK WindowFunc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){
    switch(message){
        case WM_DESTROY: // Terminate the program
            PostQuitMessage(0);
            break;
        default:
            return DefWindowProc(hwnd, message, wParam, lParam); //Let window process message
    }
    return 0;
}

Its showing following error on Code::Blocks
Build Log:

Compiling: D:\Stuff\Personal\Sajib\Programming\C Codes\Test\Untitled1.c
Linking console executable: D:\Stuff\Personal\Sajib\Programming\C Codes\Test\Untitled1.exe
D:\Stuff\Personal\Sajib\Programming\C Codes\Test\Untitled1.o:Untitled1.c:(.text+0x96): undefined reference to `GetStockObject@4'  /*At line 25*/
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 0 warnings[/code]

But I don't Know What wrong with this GetStockObject!! Its right i think

Pages: [1]