|
To access the contents, click the chapter and section titles.
Sams Teach Yourself Visual J++ 6 in 21 Days
SummaryVisual J++ is a powerful language that makes it easy to develop applications. However, at times youll want to go directly to the Windows API. For this reason, you should always keep J/Direct as one of your alternatives when Visual J++ just doesnt seem to give you what you need. Using J/Direct is easy. While the examples in this chapter are simple, you can build on them and create your own powerful layers to the Windows API. Q&AQ How do you create a wrapper class and add methods that directly access the Windows API? A You start by displaying the J/Direct Call Builder window. Then, you find the Windows API function that you want to add in the list box and double-click on it. Youill be asked if you want to add the class; then when you reply yes, the method on which you double-clicked will be added to a new class. Q How do you pass a character string to a Windows API function that expects a pointer to a character buffer? A J/Direct takes care of all data marshalling. For Windows API functions that take character buffers as arguments, you pass a Java String object. J/Direct will take care of the conversion details. Q Why would anyone want to go to the trouble to access the Windows API directly? Isnt Visual J++ enough? A Every language from Visual C++ to Visual Basic to Visual J++ has occasion to need direct calls to the Windows API. There are so many things that programmers may require with regards to language functionality that languages cant cover every single thing that may arise. For this reason, going directly to the Windows API can give you the method to solving your programming problems. Q Where can I go for help when it comes to the Windows API? A For starters, the Visual J++ online help is excellent. Try to find Windows API in the help index. Next to that, a good Windows API reference book would be helpful. Usually the books geared toward C and C++ programmers are best. Exercises
|
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement. |