看板 C_Sharp 關於我們 聯絡資訊
※ 引述《a741230 (fighter238)》之銘言: : 我嘗試將 : void CShellIconChangerDlg::RefreshIcons() : 的程式碼單獨copy出來成一個VC++2008的專案是可以正常執行的,之後我想將他包成一個 : DLL檔再到C#去呼叫裡面的函式時整個程式會當掉,不知道是出了什麼問題,真是傷腦經 : ... 補貼一下程式碼,麻煩大家幫我看哪裡有問題: C++ Win32 DLL專案: ------------------------------------------------------------------------ #include "stdafx.h" #include "atlstr.h" extern "C" __declspec(dllexport) void rbicon() { //內容和CodeProject網站裡的void CShellIconChangerDlg::RefreshIcons() //一樣 } ------------------------------------------------------------------------ C# form專案 [DllImport(@"rebuild_icon_cache_dll.dll", EntryPoint = "rbicon",CharSet=CharSet.Ansi)] public extern static void rbicon(); private void button1_Click(object sender, EventArgs e) { rbicon(); } 問題在於c++若編譯成執行檔可以正常執行,編譯成DLL檔再到C#呼叫後form會停止回應 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.57.142.249