Microsoft KB Archive/162966: Difference between revisions
(importing KB archive) |
m (Text replacement - """ to """) |
||
Line 79: | Line 79: | ||
public static void main(String args[]) | public static void main(String args[]) | ||
{ | { | ||
System.out.println( | System.out.println("\nStarting test...\n"); | ||
IBoolTest btest = (IBoolTest) new BOOLTEST(); | IBoolTest btest = (IBoolTest) new BOOLTEST(); | ||
btest.TestBool(); //calling the Automation | btest.TestBool(); //calling the Automation |
Latest revision as of 11:01, 21 July 2020
Article ID: 162966
Article Last Modified on 5/12/2007
APPLIES TO
- Microsoft Visual J++ 1.0 Standard Edition
This article was previously published under Q162966
SYMPTOMS
Calling an Automation method that returns a Boolean value is interpreted incorrectly from Java. If the COM object returns True, Java interprets the return value as False, or if it returns False, then Java interprets the return value as True.
RESOLUTION
The problem has been fixed with the latest Microsoft virtual machine (Microsoft VM). Please follow the link to http://www.microsoft.com/mscorp/java to download the latest Microsoft VM.
STATUS
Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem has been fixed in Visual J++ 1.1.
MORE INFORMATION
Steps to Reproduce Behavior
- Create a default MFC Automation Server.
- Using the Class Wizard (OLE Automation Tab) create an automation method that returns a BOOL.
- Build the project and run it once to register the server.
- From the command line run JAVATLB /U:T Server.TLB, where Server is your MFC Automation Server. The JAVATLB creates Java class files with information about the COM interfaces and methods. After you have created Java descriptions of COM components, the output window shows two useful types of information, the import statement and the Summary.txt notice. You have to use the command line because Java Type Library Wizard doesn't list MFC Server's Type Library.
- Create a new Java project.
Create a Java class that uses the services from the MFC Automation Server. The following class illustrates how it uses the Automation Method that returns a BOOL:
import server.* // where server is the MFC Automation Server class javabool { public static void main(String args[]) { System.out.println("\nStarting test...\n"); IBoolTest btest = (IBoolTest) new BOOLTEST(); btest.TestBool(); //calling the Automation Method System.out.println(btest.TestBool()); } }
- Save this .JAVA file and build it.
- When you run this Java Application, you will notice that Java interprets the Bool value incorrectly.
REFERENCES
For the latest Knowledge Base articles and other support information on Visual J++ and the SDK for Java, see the following pages on the Microsoft Technical Support site:
Additional query words: Java VM Bool COM
Keywords: kbbug kbfix kbvj110fix KB162966