1. 程式人生 > >matlab在64位的機子上不能執行notebook解決方法

matlab在64位的機子上不能執行notebook解決方法

matlab提供notebook工具箱,可以讓我們在word執行matlab程式碼,這是一個非常方便的功能,但是如果你的office和matlab是安裝在64位的機子上的話,可能會報以下錯誤:

這時候實在令人抓狂,因為我一開始還以為是由於我的word與matlab版本不對應,所以執行不了notebook,但是經過google後,可以通過修改以下程式碼就可以修復:

新增PtrSafe屬性,將:
Private Declare  Function WinHelp Lib "USER32.DLL" Alias "WinHelpA" (ByVal hWnd As Integer, ByVal lpHelpFile _
    As String, ByVal wCmd As Integer, ByVal dwData As String) As Integer
Private Declare  Function GetActiveWindow Lib "USER32.DLL" () As Integer
改為:
Private Declare PtrSafe Function WinHelp Lib "USER32.DLL" Alias "WinHelpA" (ByVal hWnd As Integer, ByVal lpHelpFile _
    As String, ByVal wCmd As Integer, ByVal dwData As String) As Integer
Private Declare PtrSafe Function GetActiveWindow Lib "USER32.DLL" () As Integer
感謝百度知道的大神。大笑