Click here to Skip to main content
15,895,142 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: trouble with _beginthread Pin
Michael Dunn9-Jun-06 1:09
sitebuilderMichael Dunn9-Jun-06 1:09 
AnswerRe: trouble with _beginthread Pin
Hamid_RT9-Jun-06 1:19
Hamid_RT9-Jun-06 1:19 
GeneralRe: trouble with _beginthread Pin
Cedric Moonen9-Jun-06 1:22
Cedric Moonen9-Jun-06 1:22 
GeneralRe: trouble with _beginthread Pin
Hamid_RT9-Jun-06 1:41
Hamid_RT9-Jun-06 1:41 
Questionproblem in inserting image into the database Pin
maharaja pandian9-Jun-06 0:46
maharaja pandian9-Jun-06 0:46 
AnswerRe: problem in inserting image into the database Pin
Ștefan-Mihai MOGA9-Jun-06 0:58
professionalȘtefan-Mihai MOGA9-Jun-06 0:58 
QuestionRe: problem in inserting image into the database Pin
maharaja pandian9-Jun-06 1:22
maharaja pandian9-Jun-06 1:22 
QuestionProblem with IPicture-Object and Render Pin
masanne9-Jun-06 0:37
masanne9-Jun-06 0:37 
Hi!

I have here a activeX- component "spectrometer.ocx" with the method "getImage(VARIANT *image)".
If a Application call this method, the activeX have to give back a bitmap (which was included in the ressourses). The bitmap have to convers in a VARIANT.

the Method:



<br />
BOOL CSpectrometerCtrl::getImage(VARIANT* image)<br />
{<br />
AFX_MANAGE_STATE(AfxGetStaticModuleState());<br />
<br />
// TODO: Fügen Sie hier Ihren Dispatchhandlercode ein.<br />
<br />
CBitmap bmp ;<br />
VARIANT p1;<br />
PICTDESC desc;<br />
HRESULT hres;<br />
<br />
bmp.LoadBitmap(IDB_BITMAP1);<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 />
IPicture *pd;<br />
<br />
// create the StdPicture object<br />
hres = ::OleCreatePictureIndirect(&desc, IID_IPicture, FALSE,(LPVOID*)&pd);<br />
<br />
<br />
if(SUCCEEDED(hres))<br />
{<br />
p1.vt = VT_UNKNOWN;<br />
p1.punkVal = pd;<br />
<br />
*image = p1;<br />
<br />
return TRUE;<br />
}<br />
else<br />
return FALSE;<br />
}



In my Application i call this method and i want that the bitmap is shown on a dialog.



void CSpectrometerTestDlg::OnBnClickedButton1()<br />
{<br />
// TODO: Fügen Sie hier Ihren Kontrollbehandlungscode für die Benachrichtigung ein.<br />
<br />
VARIANT imageData;<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(&imageData);<br />
m_mySpectrometer.getImage(&imageData);<br />
<br />
pUnk = imageData.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(pDC, LOGPIXELSX)) / 2540;<br />
iHeight = (lHeight * GetDeviceCaps(pDC, LOGPIXELSY)) / 2540;<br />
<br />
//Bild anzeigen mittels Render<br />
pPicture->Render(pDC, 0, 0, iWidth, iHeight, 0, lHeight, lWidth, -lHeight, 0);<br />
<br />
////// VERSUCH ÜBER DER Ausgabe über die CBitmap Klasse//////////////////////////<br />
//HBITMAP hBmp ;<br />
//pPicture->get_Handle((OLE_HANDLE FAR *) &hBmp);<br />
<br />
//// create a temporary bitmap<br />
//CBitmap * TempBmp = CBitmap::FromHandle(hBmp);<br />
<br />
//memdc.SelectObject(TempBmp);//select original bitmap<br />
<br />
//pDC.BitBlt(200, 300, iWidth, iHeight, &memdc, 0, 0, SRCCOPY);<br />
/////////////////////////////////////////////////////////////////////////////////<br />
}<br />
<br />
}




The variables "iWidth, iHeight" have already the right values. It means that something comes on but the displaying doesn't work.

Is there someone with a Idea? What is wrong?

Thanks

-- modified at 6:50 Friday 9th June, 2006
QuestionRe: Problem with IPicture-Object and CPictureHolder::Renderpicture Pin
Hamid_RT9-Jun-06 0:50
Hamid_RT9-Jun-06 0:50 
AnswerRe: Problem with IPicture-Object and Render Pin
masanne9-Jun-06 0:55
masanne9-Jun-06 0:55 
GeneralRe: Problem with IPicture-Object and Render Pin
Hamid_RT9-Jun-06 1:10
Hamid_RT9-Jun-06 1:10 
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 
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 

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.