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?
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.