小编Ami*_*mil的帖子

运行.exe有限的寿命?

我想知道是否可以通过cmd运行程序,除了限制程序只有5秒钟完成其任务.

原因是因为我调用的程序可以很快完成(<1秒)或进入无限循环.在无限循环的情况下,我不希望我的其余脚本挂起.

例如,

cd "c:/temp"
countfiles.exe -loopIfMoreThan2Files
echo "Done"         # <--- will never be reached if there are more than 2 files
Run Code Online (Sandbox Code Playgroud)

c++ windows cmd dos

3
推荐指数
2
解决办法
190
查看次数

C++ DLL卸载析构函数?

所以我有一个用C++编写的DLL.但是,它使用GlobalAlloc()分配内存.为了避免内存泄漏,我想跟踪这些分配并在销毁DLL时解除所有这些分配.

有没有办法编写一个在卸载DLL时调用的函数?我能想到的一件事是在我的DLL中创建一个全局对象,并在其析构函数中编写无内存调用,但这似乎有些过分.我的另一个想法是在DLL卸载时依靠操作系统来释放内存,但这看起来很脏.

谢谢

c++ windows dll winapi

3
推荐指数
1
解决办法
9363
查看次数

将数据并行写入磁盘?

所以我正在研究C++/cli图像处理库,并试图优化我的代码.基本上,我传递了一个System :: Drawing :: Bitmap的图像,然后我需要写入磁盘,执行复杂的分析,并返回分析结果.我以为我可以将图像并行写入磁盘以加快速度(我的算法不会修改图像).但是,我没有使用过很多线程,所以我想知道最好的方法是什么.

string ProcessImage(System::Drawing::Bitmap ^bmp, System::String^ targetFile)
{
    bmp->Save(targetFile);
    System::Drawing::Bitmap^ bmp8 = BitmapConvertPixelFormat(bmp, 8); //<-- a function I wrote which converts the 32bpp I am passed into an 8bpp one
    string results = Analyze(bmp8); //<--- takes a good bit of time
    return results;
}
Run Code Online (Sandbox Code Playgroud)

请让我知道你的想法.先感谢您!

multithreading c++-cli image-processing

3
推荐指数
1
解决办法
2601
查看次数

标签 统计

c++ ×2

windows ×2

c++-cli ×1

cmd ×1

dll ×1

dos ×1

image-processing ×1

multithreading ×1

winapi ×1