🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
6 messages
6 total messages Started by DeKayA Thu, 19 Oct 2006 21:52
convert a HWND to something I can see
#2957
Author: DeKayA
Date: Thu, 19 Oct 2006 21:52
14 lines
979 bytes
Hi;

I am trying to convert a windows handle to something I can display in
a text box.



int handle = hwnd; //this doesn't compile

It gives me an error that it cannot convert type void to type int


thanks
Re: convert a HWND to something I can see
#2958
Author: Bruce Salzman
Date: Thu, 19 Oct 2006 22:15
21 lines
1350 bytes
<DeKayA@bellsouth.net> wrote in message 
news:4537f328.35659415@forums.borland.com...
>
> Hi;
>
> I am trying to convert a windows handle to something I can display 
> in
> a text box.
>
>
>
> int handle = hwnd; //this doesn't compile
>
> It gives me an error that it cannot convert type void to type int
>

int handle = static_cast<int>(hwnd);

-- 
Bruce 
Re: convert a HWND to something I can see
#2961
Author: Remy Lebeau (TeamB)
Date: Thu, 19 Oct 2006 22:31
13 lines
1268 bytes
" Bruce Salzman" <bruce@nospam.org> wrote in message
news:4537f8f4$1@newsgroups.borland.com...

> int handle = static_cast<int>(hwnd);

static_cast is the wrong type of casting in this situation.  You need to use
reinterpret_cast instead:

    int handle = reinterpret_cast<int>(hwnd);


Gambit
Re: convert a HWND to something I can see
#2959
Author: DeKayA
Date: Thu, 19 Oct 2006 22:34
10 lines
1061 bytes
On Thu, 19 Oct 2006 17:15:18 -0500, " Bruce Salzman"
<bruce@nospam.org> wrote:

>
>int handle = static_cast<int>(hwnd);


Tried that .  no joy  same error

But thanks
Re: convert a HWND to something I can see
#2960
Author: Thomas Maeder [TeamB]
Date: Thu, 19 Oct 2006 22:41
18 lines
1482 bytes
DeKayA@bellsouth.net writes:

> I am trying to convert a windows handle to something I can display in
> a text box.
>
>
>
> int handle = hwnd; //this doesn't compile
>
> It gives me an error that it cannot convert type void to type int

That doesn't sound plausible. Isn't it from void * to int?

Anyway; something like

reinterpret_cast<unsigned long>(hwnd)

should work.
Re: convert a HWND to something I can see
#2662
Author: poojo hackma
Date: Fri, 26 Jan 2007 17:43
24 lines
1662 bytes
Is he just wanting the handle address?
AnsiString addy;
addy.Format("Window Address: %x", &hwnd);

"Thomas Maeder [TeamB]" <maeder@glue.ch> wrote in message 
news:m23b9kx71z.fsf@glue.ch...
> DeKayA@bellsouth.net writes:
>
>> I am trying to convert a windows handle to something I can display in
>> a text box.
>>
>>
>>
>> int handle = hwnd; //this doesn't compile
>>
>> It gives me an error that it cannot convert type void to type int
>
> That doesn't sound plausible. Isn't it from void * to int?
>
> Anyway; something like
>
> reinterpret_cast<unsigned long>(hwnd)
>
> should work. 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads