Shell.open()非常重要!
今天在做SWT中显示OCX控件,照着Demo写的,但是不知道为什么每次执行到:Variant pVarResult = auto.invoke(dispIdMember, rgvarg);
JVM都会直接退出~error如下:
# # An unexpected error has been detected by HotSpot Virtual Machine: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x73d321b9, pid=3696, tid=2208 # # Java VM: Java HotSpot(TM) Client VM (1.5.0_04-b05 mixed mode, sharing) # Problematic frame: # C [MFC42.DLL+0x21b9] # # An error report file with more information is saved as hs_err_pid3696.log # # If you would like to submit a bug report, please visit: # http://java.sun.com/webapps/bugreport/crash.jsp # [error occurred during error reporting, step 270, id 0xc0000005] |
寻便了网络也没有解决办法,刚开始以为是JVM版本的问题,于是换了3个版本都是同样的问题~真是郁闷!
最后通过和Demo代码的比较,发现Demo中有一句shell.open(),注释掉此句,Demo也是引起JVM退出!在代码中加入shell.open(),搞定!
原来这个open方法还有这么多的玄机啊,但是javadoc上却只字未提!
客户虐我千百遍,我待客户如初恋!