Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VC8.0
How to open the file using fopen_s to save the image??? Please help me...
 
for(int c=0;c<10;c++)
	{
		 sprintf_s(buffer,"D:\image%u.jpg",c);
		 CString sName(buffer);  
         LPCTSTR lpszName = sName; 
		 bool ok=CreateFile(lpszName,GENERIC_ALL,FILE_SHARE_WRITE | FILE_SHARE_READ,NULL,CREATE_NEW | OPEN_EXISTING,
			                FILE_ATTRIBUTE_NORMAL,NULL);
 
         if( (err = fopen_s( &stream2, "data2", "w+" )) != 0 )
 
		file.Write(&bh, sizeof(BITMAPFILEHEADER));
			file.Write(&(bi.bmiHeader), sizeof(BITMAPINFOHEADER));
			file.Write(lpBitmapBits, 3 * nWidth * nHeight);
			file.Close();
			Sleep(10000);
		}
		
	}
Posted 19-Apr-11 0:44am
Comments
walterhevedeich at 19-Apr-11 5:49am
   
What's the error message you are receiving?
SAKryukov at 19-Apr-11 13:14pm
   
Did you remove your Question:
http://www.codeproject.com/Answers/183776/How-to-write-and-call-a-function-in-windows-servic.aspx
 
...after I answered and added the update. Why?!
--SA
Gokulnath007 at 20-Apr-11 0:23am
   
No. i didnt remove it..
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Buddy as per i understand your problem you are trying to copy content of image file to a normal file it is ok to do it...Smile | :)
 
But if you are trying to convert one kind of file to another type then it is not the right way to do so..
 
Instead you can use GDIPLUS for programmers: GDI+[^]
 
Hope this may help!!! Smile | :)
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You're obviously using MFC. Why don't you go ahead and use the framework's classes?
 
CBitmap myBmp;
CImage myImg;
myImg.Attach(myBmp);
myImg.Save(_T("my.bmp"));
myImg.Detach();
  Permalink  
Comments
Niklas Lindquist at 19-Apr-11 7:39am
   
I think he's trying to rid himself of MFC as per his other questions.
Gokulnath007 at 20-Apr-11 0:25am
   
I need these codes which is taking the screenshots of the screen to be run as a service so that it can start taking the screen shots once the service is started.. please help me..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 245
1 Kamal Rocks 184
2 Sergey Alexandrovich Kryukov 175
3 BillWoodruff 173
4 PIEBALDconsult 160
0 OriginalGriff 5,655
1 DamithSL 4,506
2 Maciej Los 3,997
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,180


Advertise | Privacy | Mobile
Web02 | 2.8.141216.1 | Last Updated 19 Apr 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100