calling createwindow function the program exit

Discussion in 'C Programming' started by infobox0531@163.com, Apr 2, 2008.

  1. Guest

    The system run on linux platform,i call createwindow,the program
    automatically exit,why?Following is my code:


    int RegisterClass_BackDesc()
    {
    static BOOL reg = FALSE;
    WNDCLASS wcx;

    if (reg)
    return -1;

    memset(&wcx, 0, sizeof(WNDCLASS));
    wcx.lpszClassName = "HAIERSH_BACKDESCRIBE_WND";
    wcx.lpfnWndProc = BackDescProc;
    wcx.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);

    UnRegisterClass("HAIERSH_BACKDESCRIBE_WND");
    if( !RegisterClass(&wcx) )
    return FALSE;

    reg = TRUE;

    return 0;

    }

    HMENU CreatMenu_BackDesc()
    {
    CHAR buff1[40] = {0};

    hMenu = CreateMenu();
    if (!hMenu)
    return NULL;

    memset(buff1, 0, 40);
    strcpy(buff1,"return");
    AppendMenu(hMenu, MF_STRING, ID_M_RETURN, buff1);
    return hMenu;

    }

    HWND CreateWindow_BackDesc(HWND hWndParent)
    {
    CHAR buff[40] = {0};

    RegisterClass_BackDesc();

    hMenu = CreatMenu_BackDesc();

    hBackDesc = CreateWindow("HAIERSH_BACKDESCRIBE_WND", "", WS_CHILD |
    WS_OVERLAPPEDWINDOW | WS_BORDER,
    0, 0,
    180, 120,
    hWndParent, hMenu, 0, 0);

    ..........
    ..........
    ..........

    }

    besides,if i call createwindow,which head file should i include in
    linux platform?
     
    , Apr 2, 2008
    #1
    1. Advertising

  2. jacob navia Guest

    wrote:
    > The system run on linux platform,i call createwindow,the program
    > automatically exit,why?Following is my code:
    >
    >
    > int RegisterClass_BackDesc()
    > {
    > static BOOL reg = FALSE;
    > WNDCLASS wcx;
    >
    > if (reg)
    > return -1;
    >
    > memset(&wcx, 0, sizeof(WNDCLASS));
    > wcx.lpszClassName = "HAIERSH_BACKDESCRIBE_WND";
    > wcx.lpfnWndProc = BackDescProc;
    > wcx.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
    >
    > UnRegisterClass("HAIERSH_BACKDESCRIBE_WND");
    > if( !RegisterClass(&wcx) )
    > return FALSE;
    >
    > reg = TRUE;
    >
    > return 0;
    >
    > }
    >
    > HMENU CreatMenu_BackDesc()
    > {
    > CHAR buff1[40] = {0};
    >
    > hMenu = CreateMenu();
    > if (!hMenu)
    > return NULL;
    >
    > memset(buff1, 0, 40);
    > strcpy(buff1,"return");
    > AppendMenu(hMenu, MF_STRING, ID_M_RETURN, buff1);
    > return hMenu;
    >
    > }
    >
    > HWND CreateWindow_BackDesc(HWND hWndParent)
    > {
    > CHAR buff[40] = {0};
    >
    > RegisterClass_BackDesc();
    >
    > hMenu = CreatMenu_BackDesc();
    >
    > hBackDesc = CreateWindow("HAIERSH_BACKDESCRIBE_WND", "", WS_CHILD |
    > WS_OVERLAPPEDWINDOW | WS_BORDER,
    > 0, 0,
    > 180, 120,
    > hWndParent, hMenu, 0, 0);
    >
    > .........
    > .........
    > .........
    >
    > }
    >
    > besides,if i call createwindow,which head file should i include in
    > linux platform?


    You are trying to compile a windows program under linux.

    You can't do that, linux has a different windows system called
    "X windows". You will have to read the documentation of X windows
    and find the equivalent programs.

    Alternatively you can buy an emulation of windows under linux.

    Or you can get the windows emulator for linux, called "wine",
    and try to compile your program with it.


    --
    jacob navia
    jacob at jacob point remcomp point fr
    logiciels/informatique
    http://www.cs.virginia.edu/~lcc-win32
     
    jacob navia, Apr 2, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?U2FuZHk=?=

    Code to Exit Web App and Exit Internet Explorer

    =?Utf-8?B?U2FuZHk=?=, Aug 3, 2005, in forum: ASP .Net
    Replies:
    7
    Views:
    7,907
    =?Utf-8?B?U2FuZHk=?=
    Aug 5, 2005
  2. Joe Smith
    Replies:
    4
    Views:
    65,871
    sandeep1976
    Nov 8, 2006
  3. Replies:
    2
    Views:
    459
    Jeff Epler
    May 31, 2005
  4. Jeff Adams

    CreateWindow returns NULL

    Jeff Adams, Mar 14, 2005, in forum: C Programming
    Replies:
    2
    Views:
    403
    Flash Gordon
    Mar 14, 2005
  5. Replies:
    3
    Views:
    1,498
    Gabriel Genellina
    Jun 18, 2008
Loading...

Share This Page