Click here to Skip to main content
16,006,594 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Help Pin
Anonymous28-Apr-03 11:56
Anonymous28-Apr-03 11:56 
GeneralRe: Help Pin
Kuniva29-Apr-03 4:49
Kuniva29-Apr-03 4:49 
GeneralSSL - i don't fully get the concept Pin
Kuniva27-Apr-03 7:15
Kuniva27-Apr-03 7:15 
GeneralRe: SSL - i don't fully get the concept Pin
Nish Nishant27-Apr-03 7:31
sitebuilderNish Nishant27-Apr-03 7:31 
GeneralRe: SSL - i don't fully get the concept Pin
Kuniva27-Apr-03 7:42
Kuniva27-Apr-03 7:42 
GeneralRe: SSL - i don't fully get the concept Pin
Felix Gartsman27-Apr-03 8:29
Felix Gartsman27-Apr-03 8:29 
GeneralPass IStream in Image Class Pin
Emiliano27-Apr-03 4:53
Emiliano27-Apr-03 4:53 
GeneralRe: Pass IStream in Image Class Pin
MAAK28-Apr-03 11:38
MAAK28-Apr-03 11:38 
this is a code I used to load a PNG image stored in the resources using Bitmap class and IStream, hope it could help you

//this will receive the handle of the loaded resource
HGLOBAL hGlb = NULL;	

//load the needed resource from the resources
HRSRC hRs = 
	FindResource(AfxGetInstanceHandle(), MAKEINTRESOURCE(nID), "RT_PNG");
if(hRs)
{
	//retreive the size of the resource
	ULONG size = SizeofResource(AfxGetInstanceHandle(), hRs);
	//retreive the resource's handle
	hGlb = LoadResource(AfxGetInstanceHandle(), hRs);
	//this handle will be used to allocate the memory for the IStream
	HGLOBAL hStream;
	//these are pointers to the resources memory and the IStream's memory
	void * pData, *pData2;
	//retreive the resource's memory pointer
	pData = LockResource(hGlb);
	//allocate memory for the IStream
	hStream = GlobalAlloc(GMEM_NODISCARD | GMEM_MOVEABLE, size);
	//pointer to IStream to be allocated
	IStream *ptrStream;
	//create the IStream object
	hr = CreateStreamOnHGlobal(hStream, true, &ptrStream);
	//dummy value to receive the number of bytes written
	ULONG dummy;
	//write the resource data to the stream
	ptrStream->Write(pData, size, &dumm);
	//free the resource
	UnlockResource(hGlb);
	//create a Bitmap object from the IStream, m_ptrBm is a Bitmap pointer
	m_ptrBm = Bitmap::FromStream(ptrStream);
	//release the IStream
	ptrStream->Release();
}
else
{
	int i = GetLastError();
	return;
}

the PNG image resource is a full PNG image file just stored in the memory.
GeneralCell Manipulation in CListCtrl Pin
ttohme27-Apr-03 4:04
ttohme27-Apr-03 4:04 
GeneralRe: Cell Manipulation in CListCtrl Pin
Stormwind27-Apr-03 17:02
Stormwind27-Apr-03 17:02 
GeneralRe: Cell Manipulation in CListCtrl Pin
basementman28-Apr-03 4:43
basementman28-Apr-03 4:43 
QuestionCan we customize the title bar buttons of a window? Pin
Abin27-Apr-03 3:48
Abin27-Apr-03 3:48 
AnswerRe: Can we customize the title bar buttons of a window? Pin
basementman28-Apr-03 4:46
basementman28-Apr-03 4:46 
AnswerRe: Can we customize the title bar buttons of a window? Pin
Brian Shifrin28-Apr-03 13:48
Brian Shifrin28-Apr-03 13:48 
GeneralRe: Can we customize the title bar buttons of a window? Pin
Abin28-Apr-03 14:00
Abin28-Apr-03 14:00 
GeneralRe: Can we customize the title bar buttons of a window? Pin
Matthias Mann29-Aug-03 22:46
Matthias Mann29-Aug-03 22:46 
AnswerRe: Can we customize the title bar buttons of a window? Pin
John R. Shaw28-Apr-03 16:31
John R. Shaw28-Apr-03 16:31 
GeneralUser Breapoint called from code at 0x77f9180c ! Pin
white jungle27-Apr-03 3:23
white jungle27-Apr-03 3:23 
GeneralRe: User Breapoint called from code at 0x77f9180c ! Pin
Ted Ferenc27-Apr-03 9:38
Ted Ferenc27-Apr-03 9:38 
GeneralCallbacks in C Pin
leppie27-Apr-03 3:22
leppie27-Apr-03 3:22 
GeneralRe: Callbacks in C - SOLVED Pin
leppie27-Apr-03 3:55
leppie27-Apr-03 3:55 
GeneralRe: Callbacks in C - SOLVED Pin
Dominik Reichl27-Apr-03 7:09
Dominik Reichl27-Apr-03 7:09 
Questionhow to show the tooltip of the menu? Pin
benben27-Apr-03 2:38
benben27-Apr-03 2:38 
AnswerRe: how to show the tooltip of the menu? Pin
Roman Nurik27-Apr-03 3:34
Roman Nurik27-Apr-03 3:34 
QuestionWhat means "typo"? Pin
George227-Apr-03 1:57
George227-Apr-03 1:57 

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.