I believe that I have found a solution to P/Invoke the acdbDisplayPreviewFromDwg function using unsafe code (code using pointers) in C#. Here's the sample code:
// Compile with: /unsafe
[DllImport("acdb17.dll", CallingConvention = CallingConvention.Cdecl,
EntryPoint = "?acdbDisplayPreviewFromDwg@@YA_NPB_WPAXPBK@Z")]
private static extern unsafe bool acdbDisplayPreviewFromDwg(
[MarshalAs(UnmanagedType.LPWStr)] string pszDwgfilename,
IntPtr pPreviewWnd, uint* pBgColor);
// This code works correctly
private unsafe void DlgPreview_Paint(object sender, PaintEventArgs e)
{
string str = "C:\\AutoCAD 2009\\Sample\\colorwh.dwg";
// Color mBgColor = Color.Black;
// PictureBox pbImage;
uint clr = (uint)mBgColor.R +
(((uint)mBgColor.G) << 8) +
(((uint)mBgColor.B) << 16);
acdbDisplayPreviewFromDwg(str, pbImage.Handle, &clr);
}