Article View: borland.public.cppbuilder.nativeapi
Article #9854Re: Creating a Window from a Console App... How to?!?
From: Filippo
Date: Fri, 11 Jun 2004 13:49
Date: Fri, 11 Jun 2004 13:49
63 lines
2991 bytes
2991 bytes
WOW!
thanks! Now seems it works!
thanks in advance,
Filippo
"Ed Mulroy [TeamB]" <dont_email_me@bitbuc.ket> wrote in message
news:40c9a47f@newsgroups.borland.com...
> I cannot with certainty tell you why it does that, but there are three
> things in that code which I think must be changed.
>
>
> The program's instance is not given in this call
>
> > hWnd=CreateWindowEx(WS_EX_OVERLAPPEDWINDOW,
> > szAppName, "Test Window",
> > WS_OVERLAPPEDWINDOW | WS_VISIBLE,
> > CW_USEDEFAULT, CW_USEDEFAULT, 500, 500,
> > NULL, NULL, NULL, NULL );
>
> Change the call to this
>
> hWnd=CreateWindowEx(WS_EX_OVERLAPPEDWINDOW,
> szAppName, "Test Window",
> WS_OVERLAPPEDWINDOW | WS_VISIBLE,
> CW_USEDEFAULT, CW_USEDEFAULT, 500, 500,
> NULL, NULL, _hInstance, NULL );
>
> _hInstance contains the instance handle for your program and is a
> variable created by the startup code. Add this line following the
> includes to declare it for the program:
>
> extern HINSTANCE _hInstance;
>
>
> You have a case for WM_DESTROY but no case for WM_CLOSE. Add a
> WM_CLOSE case and either let it fall through to the WM_DESTROY case or
> have it call PostMessage to post a WM_DESTROY to the window.
>
>
> The code uses CreateThread. It should use one of _beginthread or
> _beginthreadNT and not CreateThread so that TLS is properly
> initialized. Read the help on _beginthread for more details of why it
> should be used instead of CreateThread.
>
> . Ed
>
> > Filippo wrote in message
> > news:40c98aec$1@newsgroups.borland.com...
> > Hello,
> > I try to create a window from a Console App (so with main() and
> without
> > the 'WinMain...').
> > To do this I created a new thread inside the main console app
> that
> > register the window and show it... seems to work but...
> > I have some problem when I try to resize the window... all the
> desktop
> > become white! without refreshing it.
> > How can I create a window from a console app not in this 'dirty'
> way?
> > ...
>
>
Technical Details
Message-ID:
<40c9b87f$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<40c98aec$1@newsgroups.borland.com> <40c9a47f@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,3be54e0f405e81ba X-Google-Attributes: gid10cc67,public From: "Filippo" <filfor_no@spamtin.it> Newsgroups: borland.public.cppbuilder.nativeapi References: <40c98aec$1@newsgroups.borland.com> <40c9a47f@newsgroups.borland.com> Subject: Re: Creating a Window from a Console App... How to?!? Date: Fri, 11 Jun 2004 15:49:29 +0200 Lines: 65 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 82.104.120.51 Message-ID: <40c9b87f$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1086961791 82.104.120.51 (11 Jun 2004 06:49:51 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail