Trouble in warp a function in COM dll
-
I have a class to wrap in COM dll. There is a c++ function declare void Draw(HDC hdc, int x, int y, int w, int h) I warp it in IDL as HRESULT Draw([in] int** hdc, [in] int offx, [in] int offy, [in] int width, [in] int height); STDMETHODIMP CImg::Draw(int** hdc, int offx, int offy, int width, int height) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); image->Draw((HDC)(hdc), offx, offy, width, height); return S_OK; } in this way, the hdc parameter will be IntPtr in C# so in c# code look like IntPtr hDC = e.Graphics.GetHdc(); if (img != null) img.Draw(hDC, 0, 0, 100, 100); e.Graphics.ReleaseHdc(hDC); sounds very pretty code. but when i turn to VB6, it doesn't work. I write the code Private Sub Form_Paint() Call g.Draw(hDC, 0, 0, 100, 100) End Sub but compiler complain it use some type that vb can't recognize What's the better way to make this interface be used by c#, vb6, dephi smoothly? Any idea?