如何从.net位图获取本机GDI位图

Yam*_*our 5 .net c++ gdi+ gdi

我想使用Pinvoke技术在本地库中使用.net位图,本机函数具有以下原型,

int cropImage(  bool aBlocking,Gdiplus::Bitmap *aInputImage, )
Run Code Online (Sandbox Code Playgroud)

我打了下面的pinvoke

public extern int cropImage( bool blocking , Intptr bitmap ) 
Run Code Online (Sandbox Code Playgroud)

而我这样称呼它

System.Drawing.Bitmap b = new Syste.Drawing.Bitmap("Amour.jpg");
cropImage(true,b.getHitmap());
Run Code Online (Sandbox Code Playgroud)

但它不起作用,你有什么建议?

Yam*_*our 0

我建议解决这个问题的最好方法是使用接受 HBitmap 的本机库,然后使用 CBitmap::fromHandle 函数,然后调用您尝试与之通信的 api!