Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > calling createwindow function the program exit

Reply
Thread Tools

calling createwindow function the program exit

 
 
infobox0531@163.com
Guest
Posts: n/a
 
      04-02-2008
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?
 
Reply With Quote
 
 
 
 
jacob navia
Guest
Posts: n/a
 
      04-02-2008
http://www.velocityreviews.com/forums/(E-Mail Removed) 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting Python exit code when calling Python script from Java program Quill_Patricia@emc.com Python 3 06-18-2008 10:09 PM
Exit code of a batch (using exit /B) Joe Smith Java 4 11-08-2006 12:25 PM
Code to Exit Web App and Exit Internet Explorer =?Utf-8?B?U2FuZHk=?= ASP .Net 7 08-05-2005 01:55 AM
CreateWindow returns NULL Jeff Adams C Programming 2 03-14-2005 07:09 PM
write a function such that when ever i call this function in some other function .it should give me tha data type and value of calling function parameter komal C++ 6 01-25-2005 11:13 AM



Advertisments