直到最近,我們還是將x86服務作爲服務運行,但將其更改爲任何使用64位DLL的新功能。剩下的第三方DLL之一是32位。我在註冊表中爲它設置了一個DLL替代品,但這只是解決方案的一半。在64位服務中使用32位DLL的指針
我懷疑內存中的指針是不可訪問的,因爲它不再運行inProc。我需要知道的是如何使用System.Runtime.InteropServices.Marshall對象來訪問返回的指針。
在此先感謝。
public Image GetThumbnail(string strFilename)
{
SeThumbnailExtractor objExtractor = new SeThumbnailExtractor();
int hImageSE;
Image objImage = null;
try
{
objExtractor.GetThumbnail(strFilename, out hImageSE);
IntPtr iPImage = new IntPtr(hImageSE);
//fails below
objImage = Image.FromHbitmap(iPImage);
_ReturnedImage = objImage;
_SourceFile = strFilename;
Marshal.FreeHGlobal(iPImage);
}
catch (Exception ex)
{
_ErrorMsg = "ERROR: " + ex.Message.ToString();
}
if (objExtractor != null)
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(objExtractor);
objExtractor = null;
}
return objImage;
}
謝謝你的清晰簡潔的解釋。我已經到了必須將程序的功能分成兩個服務的程度。 64位的主要功能,然後是一個小的32位的剩餘功能。我們被困在那裏直到供應商喚醒到64位計算。 – BigBadOwl