Click here to Skip to main content
15,913,709 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to kill a process by its processID? Pin
Carlos Antollini25-Oct-03 17:45
Carlos Antollini25-Oct-03 17:45 
GeneralRe: How to kill a process by its processID? Pin
George225-Oct-03 23:13
George225-Oct-03 23:13 
GeneralResources Pin
Daniel132425-Oct-03 17:12
Daniel132425-Oct-03 17:12 
GeneralRe: Resources Pin
Terry O'Nolley25-Oct-03 17:48
Terry O'Nolley25-Oct-03 17:48 
GeneralRe: Resources Pin
Daniel132425-Oct-03 17:53
Daniel132425-Oct-03 17:53 
GeneralRe: Resources Pin
Terry O'Nolley25-Oct-03 18:04
Terry O'Nolley25-Oct-03 18:04 
GeneralRe: Resources Pin
Daniel132425-Oct-03 18:14
Daniel132425-Oct-03 18:14 
GeneralRe: Resources Pin
Roger Allen27-Oct-03 2:46
Roger Allen27-Oct-03 2:46 
You can extract a resource to a file in this way:

bool ExtractResourceFile(const CString& resourceID, const CString& filename)
{
	// need to extract the resource out into the temporary filename supplied
	bool bOK = true;
	HANDLE hRes = ::LoadResource(AfxGetResourceHandle(), ::FindResource(AfxGetResourceHandle(), 
			resourceID, "YOUR_RESOURCE_TYPE"));
	if (hRes != INVALID_HANDLE_VALUE)
	{
		// we loaded it, now get the text from it
		DWORD sizeOfResource = ::SizeofResource(AfxGetResourceHandle(), 
			::FindResource(AfxGetResourceHandle(), resourceID, "YOUR_RESOURCE_TYPE"));
		char *lpRes = (char*)::LockResource(hRes);
		CFile file;

		if (file.Open(filename, CFile::modeCreate | CFile::modeWrite))
		{
			// write the resource out to the file
			file.WriteHuge(lpRes, sizeOfResource);
			file.Close();
		}
		else
		{
			bOK = false;
		}
		// release the resource
		::UnlockResource(hRes);
		::FreeResource(hRes);
	}
	return bOK;
}

Its up to you to delete the file once you have finished with it ::DeleteFile(filename)

Roger Allen
Sonork 100.10016

Death come early, death come late,
It takes us all, there is no reason.
For every purpose under heaven,
To each a turn, to each a season.
A time to weep and a time to sigh,
A time to laugh and a time to cry,
A time to be born and a time to die.
Dust to dust and ashes to ashes,
And so I end my song.

GeneralRe: Resources Pin
Daniel132427-Oct-03 7:31
Daniel132427-Oct-03 7:31 
Questionhow to add dynamically to Combo Box Pin
mr200325-Oct-03 15:46
mr200325-Oct-03 15:46 
AnswerRe: how to add dynamically to Combo Box Pin
Ravi Bhavnani25-Oct-03 17:34
professionalRavi Bhavnani25-Oct-03 17:34 
AnswerRe: how to add dynamically to Combo Box Pin
Michael Dunn25-Oct-03 17:34
sitebuilderMichael Dunn25-Oct-03 17:34 
AnswerRe: how to add dynamically to Combo Box Pin
Terry O'Nolley25-Oct-03 17:53
Terry O'Nolley25-Oct-03 17:53 
GeneralMaking video slider using Win32 Pin
IGx8925-Oct-03 13:45
IGx8925-Oct-03 13:45 
GeneralRe: Making video slider using Win32 Pin
Ravi Bhavnani25-Oct-03 17:29
professionalRavi Bhavnani25-Oct-03 17:29 
GeneralRe: Making video slider using Win32 Pin
IGx8926-Oct-03 6:33
IGx8926-Oct-03 6:33 
GeneralRe: Making video slider using Win32 Pin
Ravi Bhavnani26-Oct-03 6:41
professionalRavi Bhavnani26-Oct-03 6:41 
GeneralRe: Making video slider using Win32 Pin
IGx8926-Oct-03 6:44
IGx8926-Oct-03 6:44 
GeneralRe: Making video slider using Win32 Pin
Ravi Bhavnani26-Oct-03 6:49
professionalRavi Bhavnani26-Oct-03 6:49 
GeneralRe: Making video slider using Win32 Pin
IGx8926-Oct-03 10:13
IGx8926-Oct-03 10:13 
Generalselect() Pin
Alexander M.,25-Oct-03 13:37
Alexander M.,25-Oct-03 13:37 
GeneralRe: select() Pin
Johnny ²25-Oct-03 21:43
Johnny ²25-Oct-03 21:43 
Generalruntime C++ linking Pin
Alexander M.,25-Oct-03 12:10
Alexander M.,25-Oct-03 12:10 
GeneralRe: runtime C++ linking Pin
Jörgen Sigvardsson26-Oct-03 5:41
Jörgen Sigvardsson26-Oct-03 5:41 
QuestionCurrent username? Pin
M.u.m.b.a25-Oct-03 8:32
M.u.m.b.a25-Oct-03 8:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.