Printer handle too big?

  • Thread starter Thread starter Jack Russell
  • Start date Start date
J

Jack Russell

The handle (hdc) associated with VB6 is according to the help file an
integer
Yet all the API calls use it as a long.

This has all worked in the past but now (under win98) I seem to be
getting negative handles. Presumably they are bigger than an integer.
I seem to be able to reliably reproduce this by selecting printer
preferences.

It does not seem to stop the program working (as long as I allow
negative handles) but it has me worried.

Any comments
Thanks
Jack Russell
 
Jack Russell said:
The handle (hdc) associated with VB6 is according to the help file an
integer
Yet all the API calls use it as a long.

In VB6 the 'Long' datatype is used to represent a handle.
In VB.NET, 'IntPtr' is typically used to represent a handle.

'Long' is 32-bit in VB6 and 64-bit in VB.NET, thus it's not possible to
reuse declaration/code taken from VB6 without adaption in VB.NET.
This has all worked in the past but now (under win98) I seem to be getting
negative handles. Presumably they are bigger than an integer.

Both 'Integer' and 'Long' are signed datatypes. Handles can be negative
numbers too (sign bit set to 1). However, it's very important to choose the
right datatype to store handles. If you are not able to solve your problem,
I suggest to include API declarations and the code calling the functions in
your reply.
 
Herfried,

In past to get an answer from you not real a question for this newsgroup was
to use a woman name.

Now I see the key is to answer. "Sorry wrong newsgroup".

:-)

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top