直到最近,我们还在以 x86 方式运行服务,但将其更改为 Any CPU 以使用 64 位 DLL 引入一些新功能。剩下的第三方 DLL 之一是 32 位。我在注册表中为它设置了一个 DLL 代理,但这只是解决方案的一半。
我怀疑在内存中创建的指针不可访问,因为它不再在进程中运行。我需要知道的是如何使用 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;
    }