我想获得为给定进程加载的所有dll的列表.我目前正在使用.NET Framework 4.0.我知道尝试通过Process.Modules属性访问所有托管dll时存在错误.(仅列出非托管dll).我需要一种以编程方式检索所有这些dll的方法.
Process[] myProcess = Process.GetProcessesByName("MyProcess");
if(myProcess.Count() > 0)
{
foreach (ProcessModule processModule in myProcess[0].Modules)
//get information
}
Run Code Online (Sandbox Code Playgroud)
编辑:我感兴趣的过程不在当前的AppDomain中.
我是一个相当新的使用p/invoke调用,我想知道是否有人可以指导我如何从hbitmap检索原始像素数据(unsigned char*).
这是我的情景:
我在C#端加载一个.NET Bitmap对象,并将它的IntPtr发送到我的非托管c ++方法.一旦我在C++端收到hbitmap ptr ,我想访问Bitmaps 的像素数据.我已经创建了一个接受unsigned char*的方法,它表示来自c#的原始像素数据但是我发现从c#中提取byte []相当慢.这就是为什么我想发送Bitmap ptr而不是将Bitmap转换为byte []并将其发送到我的C++方法.
用于获取Bitmap IntPtr的C#代码
Bitmap srcBitmap = new Bitmap(m_testImage);
IntPtr hbitmap = srcBitmap.GetHbitmap();
Run Code Online (Sandbox Code Playgroud)
用于导入c ++方法的C#代码
[SuppressUnmanagedCodeSecurityAttribute()]
[DllImport("MyDll.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
public static extern int ResizeImage(IntPtr srcImg);
Run Code Online (Sandbox Code Playgroud)
将接收Hbitmap处理程序的C++方法
int Resize::ResizeImage(unsigned char* srcImg){
//access srcImgs raw pixel data (preferably in unsigned char* format)
//do work with that
return status;
}
Run Code Online (Sandbox Code Playgroud)
问题:
1)由于我发送的是IntPrt,我的C++方法参数可以是unsigned char*吗?
2)如果没有,我如何从c ++访问位图的原始数据?
我想抓住我的CaptureElement
xaml元素中显示的预览帧.在source
我的CaptureElement
设置为一个MediaCapture
对象,我用的StartPreview()
方法开始显示相机.我想访问正在显示的帧而不将它们保存为img或视频文件.目标是从预览中捕获10 fps并将每个帧发送到另一个接受byte []的类.
我尝试使用该CapturePhotoToStorageFileAsync
方法,但这不是一个可行的选项,因为我不想拍10张实际图像/秒.我也不想使用ScreenCapture
它,因为它存储捕获到视频文件中的内容.理想情况下,我不想暂时将任何媒体文件存储在手机上.看后MSDN的MediaCapture
,我注意到有一个名为方法GetPreviewFrameAsync()
但是这种方法不的Windows Phone 8.1中存在.我也偶然发现了这个例子,但我并不完全理解它是如何工作的.
任何有关如何处理此问题的建议都非常感谢.