473,473 Members | 2,167 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Cast HDC to long

Hye,
In an external DLL from a VC++.NET DLL call, I want to pass HDC value. How
to cast HDC to long?

I've read in forums' messages some thing like "static_cast<IntPtr>" but
IntPtr is unknown...
What's up so?
Dec 6 '05 #1
2 1105
> Hye,
In an external DLL from a VC++.NET DLL call, I want to pass HDC
value. How to cast HDC to long?

I've read in forums' messages some thing like "static_cast<IntPtr>"
but IntPtr is unknown...
What's up so?


Just cast it -

HDC hd = ...

long l = (long)hd;
IntPtr is a .NET framework type that's used to represent native pointers in
managed classes. If you're not developing managed code, IntPtr has no
relevance.

-cd
Dec 6 '05 #2
So easy...
thx a lot.

"Carl Daniel [VC++ MVP]" <cp*****************************@mvps.org.nospam > a
écrit dans le message de news:%2******************@TK2MSFTNGP12.phx.gbl...
Hye,
In an external DLL from a VC++.NET DLL call, I want to pass HDC
value. How to cast HDC to long?

I've read in forums' messages some thing like "static_cast<IntPtr>"
but IntPtr is unknown...
What's up so?
Just cast it -

HDC hd = ...

long l = (long)hd;
IntPtr is a .NET framework type that's used to represent native pointers

in managed classes. If you're not developing managed code, IntPtr has no
relevance.

-cd

Dec 6 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

31
by: Jamie Burns | last post by:
Hello, I am writing a client / server application. There is 1 server, and many clients. The server processes requests from each client, and typically creates and manipulates C++ objects on their...
12
by: Martin | last post by:
Two questions relating to FAQ answer 12.42. (1) In the statement s.i16 |= (unsigned)(getc(fp) << 8); i16 is declared int. The reason for casting to (unsigned) is explained as guarding...
9
by: Nicolas Blais | last post by:
Hi, I have this following class which I use as a timer: #include <sys/time.h> using namespace std; class chrono { public: chrono() {};
10
by: jeff | last post by:
unsigned long a = ...; long b = (long)a; while a overflows, what is the result of b? Thank you.
12
by: Ralf | last post by:
If you want to explicitly state the type of an integer constant, you basically have two options. Either you use an explicit cast, as in: (unsigned int) 1234 or you use the UL suffixes, as in:...
5
by: cdg | last post by:
I am trying to write a section of code that uses a worker thread and would need a "post message" to post a "long" integer to the receiving function. However, I am not sure how to write the cast...
9
by: Joe | last post by:
I need to cast the correct way HMENU mymenu; int stuff; .... stuff=(int)(long)(HMENU)mymenu; ....
18
by: Felix Kater | last post by:
I haven't been thinking about it for years but recently I've stumbled on the fact that 'casting' is actually doing (at least) two different things: On the one hand 'casting' means: 'Change...
5
by: aaragon | last post by:
Hi everyone, I wrote a very simple function to try to understand the casting of variables in C++. The function is function foo() { std::vector<inttest(100); randomize(test); unsigned long...
8
by: ManicQin | last post by:
Hi, I've browsed the STL code a bit and stumble upon the next line (in the operator << overload of both long and short outputs - the line is for checking does the input is a manipulator) long...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.