Click here to Skip to main content
15,890,882 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Problem with IPicture-Object and Render Pin
masanne9-Jun-06 1:20
masanne9-Jun-06 1:20 
GeneralRe: Problem with IPicture-Object and Render Pin
Hamid_RT9-Jun-06 2:18
Hamid_RT9-Jun-06 2:18 
GeneralRe: Problem with IPicture-Object and Render [modified] Pin
masanne9-Jun-06 2:49
masanne9-Jun-06 2:49 
GeneralRe: Problem with IPicture-Object and Render [modified] Pin
masanne9-Jun-06 3:00
masanne9-Jun-06 3:00 
GeneralRe: Problem with IPicture-Object and Render Pin
Hamid_RT9-Jun-06 3:22
Hamid_RT9-Jun-06 3:22 
GeneralRe: Problem with IPicture-Object and Render Pin
masanne9-Jun-06 3:55
masanne9-Jun-06 3:55 
GeneralRe: Problem with IPicture-Object and Render Pin
Hamid_RT9-Jun-06 6:43
Hamid_RT9-Jun-06 6:43 
GeneralRe: Problem with IPicture-Object and Render Pin
masanne15-Jun-06 23:11
masanne15-Jun-06 23:11 
Thats it! Thank u very much!

<br />
VARIANT_BOOL CGetImageCtrl::getImage(VARIANT* image)<br />
{<br />
	AFX_MANAGE_STATE(AfxGetStaticModuleState());<br />
<br />
	// TODO: Fügen Sie hier Ihren Dispatchhandlercode ein.<br />
<br />
	//CBitmap bmp ; // bmp --> global<br />
	VARIANT p1;<br />
	PICTDESC desc;<br />
	HRESULT hres;<br />
<br />
	bmp.LoadBitmap(IDB_BITMAP1);// bmp --> global<br />
	VariantInit(&p1);<br />
<br />
	// setup pictdesc structure<br />
	desc.cbSizeofstruct = sizeof(PICTDESC) ;<br />
	desc.picType = PICTYPE_BITMAP;<br />
	desc.bmp.hbitmap = (HBITMAP)bmp.GetSafeHandle();<br />
<br />
	IPicture *pd;<br />
<br />
	// create the StdPicture object<br />
	hres = ::OleCreatePictureIndirect(&desc, IID_IPicture, FALSE,(LPVOID*)&pd);<br />
<br />
          <br />
	<br />
	if(SUCCEEDED(hres))<br />
    {<br />
		p1.vt = VT_UNKNOWN;<br />
		p1.punkVal = pd;<br />
<br />
		*image = p1;<br />
    }<br />
<br />
	return VARIANT_TRUE;<br />
}



/////////////////////////////////////////////////////////////////////////7

<br />
void CGetImageTestDlg::OnBnClickedButton1()<br />
{<br />
	// TODO: Fügen Sie hier Ihren Kontrollbehandlungscode für die Benachrichtigung ein.<br />
<br />
<br />
	VARIANT image;<br />
	IUnknown* pUnk;<br />
	IPicture *pPicture= 0;<br />
	long lWidth, lHeight;<br />
	int iWidth, iHeight;<br />
<br />
	//CClientDC pDC(this);<br />
<br />
	//CDC memdc;<br />
	//memdc.CreateCompatibleDC(&pDC);<br />
	<br />
	VariantInit(&image);<br />
	m_myGetImage.getImage(&image);<br />
	<br />
	pUnk = image.punkVal;<br />
	HRESULT hr = pUnk->QueryInterface(&pPicture);<br />
<br />
	if(SUCCEEDED(hr))<br />
	{		<br />
		//breite u. höhe vom bild holen<br />
		pPicture->get_Width(&lWidth);<br />
		pPicture->get_Height(&lHeight);<br />
<br />
		//in Pixel konvertieren<br />
		iWidth  = (lWidth  * GetDeviceCaps(GetDC()->m_hDC, LOGPIXELSX)) / 2540;<br />
		iHeight = (lHeight * GetDeviceCaps(GetDC()->m_hDC, LOGPIXELSY)) / 2540;<br />
<br />
		CRect Rect(0,0,iWidth,iHeight);<br />
		<br />
		//Bild anzeigen mittels Render<br />
		pPicture->Render(GetDC()->m_hDC,0,0,Rect.right - Rect.left,Rect.bottom - Rect.top,0,lHeight,lWidth,-lHeight,&Rect);<br />
<br />
	}<br />
	else MessageBox("The Displaying of the Image is not possible!");<br />
<br />
}<br />

QuestionDoubt regarding the combo box Pin
Member 30398439-Jun-06 0:27
Member 30398439-Jun-06 0:27 
AnswerRe: Doubt regarding the combo box Pin
_AnsHUMAN_ 9-Jun-06 0:34
_AnsHUMAN_ 9-Jun-06 0:34 
AnswerRe: Doubt regarding the combo box Pin
Jesal Rana9-Jun-06 0:37
Jesal Rana9-Jun-06 0:37 
AnswerRe: Doubt regarding the combo box Pin
_AnsHUMAN_ 9-Jun-06 0:43
_AnsHUMAN_ 9-Jun-06 0:43 
GeneralRe: Doubt regarding the combo box Pin
Laxman Auti9-Jun-06 0:47
Laxman Auti9-Jun-06 0:47 
AnswerRe: Doubt regarding the combo box Pin
David Crow9-Jun-06 3:29
David Crow9-Jun-06 3:29 
QuestionReading order of the language of current locale Pin
Cool Ju9-Jun-06 0:13
Cool Ju9-Jun-06 0:13 
AnswerRe: Reading order of the language of current locale Pin
David Crow9-Jun-06 3:37
David Crow9-Jun-06 3:37 
GeneralRe: Reading order of the language of current locale Pin
Cool Ju11-Jun-06 19:14
Cool Ju11-Jun-06 19:14 
QuestionCOleControl? Pin
raghuji.rao8-Jun-06 23:45
raghuji.rao8-Jun-06 23:45 
QuestionHow do I open file excel in VC++. Pin
Vu Ngoc Quyen8-Jun-06 23:35
Vu Ngoc Quyen8-Jun-06 23:35 
AnswerRe: How do I open file excel in VC++. Pin
raghuji.rao8-Jun-06 23:42
raghuji.rao8-Jun-06 23:42 
GeneralRe: How do I open file excel in VC++. Pin
XalanXalan9-Jun-06 1:30
XalanXalan9-Jun-06 1:30 
GeneralRe: How do I open file excel in VC++. Pin
raghuji.rao9-Jun-06 22:18
raghuji.rao9-Jun-06 22:18 
QuestionRe: How do I open file excel in VC++. Pin
David Crow9-Jun-06 3:39
David Crow9-Jun-06 3:39 
AnswerRe: How do I open file excel in VC++. Pin
ThatsAlok11-Jun-06 22:04
ThatsAlok11-Jun-06 22:04 
QuestionLogin program problem Pin
yogendra kaushik8-Jun-06 23:22
yogendra kaushik8-Jun-06 23:22 

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.