Article View: borland.public.cppbuilder.nativeapi
Article #2809Re: form inside a dll loaded by a console application
From: Ed Mulroy
Date: Thu, 28 Dec 2006 17:05
Date: Thu, 28 Dec 2006 17:05
92 lines
3288 bytes
3288 bytes
I cannot find the old app where I played with both a console and GUI windows
in an app.
However there is a window associated with the console. You cannot subclass
it but you can do some things with it. For example, here's a 'quicky' that
moves it around.
. Ed
-----------------------
// can be built from the command line with
// bcc32 -WCR filename
#include <windows.h>
class Console
{
public:
Console();
~Console() {}
operator HWND () const { return console_hwnd; }
private:
Console(const Console &);
Console operator = (const Console &);
HWND console_hwnd;
static char new_title[];
}; // end class Console
char Console::new_title[] = " ZAB}{NEW TITLE][ABC";
Console::Console()
{
char orig_title[1024];
// make sure the new title is unique
*new_title = ' ';
for (char c = '!';
FindWindow(NULL, new_title) && (c <= '`');
++c)
{
*new_title = c;
}
GetConsoleTitle(orig_title, sizeof(orig_title));
if (SetConsoleTitle(new_title))
{
Sleep(10); // Give Win9x/WinME time to update the title
console_hwnd = FindWindow(NULL, new_title);
SetConsoleTitle(orig_title);
}
else
{
console_hwnd = NULL;
}
} // end Console::Console
void ShowWindowMovement(HWND hwnd)
{
RECT rect;
GetWindowRect(hwnd, &rect);
int top = rect.top;
int high = rect.bottom - top;
int wide = rect.right - rect.left;
for (int i = 0, x = rect.left - 20;
i < 4;
++i, x += 5)
{
MoveWindow(hwnd, x, top, wide, high, TRUE);
Sleep(1000);
}
} // end ShowWindowMovement
int main()
{
Console cons_info;
ShowWindowMovement(cons_info);
return 0;
}
-----------------------
> Remy Lebeau wrote in message
> news:459343d1@newsgroups.borland.com...
Technical Details
Message-ID:
<4593f94f$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<458e4f48@newsgroups.borland.com> <45903d10$1@newsgroups.borland.com> <45919f15@newsgroups.borland.com> <4591c308$1@newsgroups.borland.com> <4592cf7c$1@newsgroups.borland.com> <4592dc17$1@newsgroups.borland.com> <4592e225@newsgroups.borland.com> <4592ebe5$1@newsgroups.borland.com> <45932f76@newsgroups.borland.com> <459343d1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,3fa2091e9808a898 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Ed Mulroy" <dont_email_me@bitbuc.ket> Newsgroups: borland.public.cppbuilder.nativeapi References: <458e4f48@newsgroups.borland.com> <45903d10$1@newsgroups.borland.com> <45919f15@newsgroups.borland.com> <4591c308$1@newsgroups.borland.com> <4592cf7c$1@newsgroups.borland.com> <4592dc17$1@newsgroups.borland.com> <4592e225@newsgroups.borland.com> <4592ebe5$1@newsgroups.borland.com> <45932f76@newsgroups.borland.com> <459343d1@newsgroups.borland.com> Subject: Re: form inside a dll loaded by a console application Date: Thu, 28 Dec 2006 12:05:48 -0500 Lines: 94 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3028 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 66.57.117.102 Message-ID: <4593f94f$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1167325519 66.57.117.102 (28 Dec 2006 09:05:19 -0800) X-Authenticated-User: edmulroy Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail