DWORD Equivalent

Question:
I’m trying to translate from VC++ to Java. Can you declare a variableDWORD in Java? If not, what is the Java equivalent?

Also, what is theequivalent for HINSTANCE?

Answer:
Java differs from C and C++ in that all of its fundamental data types havespecified sizes that are guaranteed to be the same across allplatforms. In C, the size of an integer can vary from compiler tocompiler and platform to platform. When Microsoft moved from 16-bitDOS and Windows 3.1 to 32-bit Windows 95 and NT, they tried toabstract the fundamental types in order to facilitate the maintenanceof a single code-base for different memory architectures. Therefore,a DWORD may be represented by a different native C type on Windows 95for Intel processors and NT 4.0 for Alpha processors.

There is no need to abstract the fundamental data types because Javadefines a fixed size for all of its data types. To answer your firstquestion: no, you cannot declare a variable as a Visual C++ DWORD inJava. The Microsoft types are also ill-designed because a WORD isactually a 16-bit unsigned integer value in 32-bit Windows 95, whereyou would expect a WORD to be a 32-bit unsigned integer value. ADWORD is a 32-bit unsigned integer value. Java does not supportunsigned integer types other than char, which you shouldn’t think ofas an integer type, so there is no Java equivalent to a DWORD. Youcould use an int, which is 32 bits, if you are only concerned aboutbit values?or a long, which is 64 bits, if you want to easilymanipulate the range of 32 bit unsigned values.

HINSTANCE is usuallya void pointer, for which the closest Java analog is an Objectreference.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

The Latest

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a

chrome os developer mode

How to Turn on Chrome OS Developer Mode

Google’s Chrome OS is a popular operating system that is widely used on Chromebooks and other devices. While it is designed to be simple and user-friendly, there are times when users may want to access additional features and functionality. One way to do this is by turning on Chrome OS

homes in the real estate industry

Exploring the Latest Tech Trends Impacting the Real Estate Industry

The real estate industry is changing thanks to the newest technological advancements. These new developments — from blockchain and AI to virtual reality and 3D printing — are poised to change how we buy and sell homes. Real estate brokers, buyers, sellers, wholesale real estate professionals, fix and flippers, and beyond may