简体   繁体   中英

How do I save screenshots with automated naming?

This is what I have to screen shots:

CImage image;
image.Attach(hBitmap);
image.Save(_T("image1.bmp"));

Is it possible to name the screenshots with a variables? Such as sc01.jpg, sc02.jpg and so on?

I am thinking about doing something like string namefile + int file_number. jpg

but I can't get it to work!

Any ideas?

Thanks!

U can't use a String and add a Int variable?

Example

ostringstream ss;

for (int i=1;i<NumberOfImages;i++)
{ 
ss << i;
string name = "sc"+ ss.str();

image.Attach(hBitmap);

image.Save(_T(name));
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM