calling createwindow function the program exit

I

infobox0531

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?
 
J

jacob navia

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,135
Latest member
VeronaShap
Top