|
hi every body
can you help me with this
how can I get a bitmap from a path in a database field
in a static picture box in the form view
I am using visaul studioC++ ver 6
thanks
I am a Civil Engineer, graduated in 1969, I've a wide experience in quite many fields of civil engineering, aswellas in HR development, Quality assurance, planning and QC,
I've been employed by Consultant Offices, Contractor Companies,
I did services for both Public Sectors and Private Sectors,
I've been in charge in Projects located inside and outside Egypt,
I've dealt with both Arabic companies and American Companies.
All these movements have given me a great variety of experiences.
|
|
|
|
|
Is the problem with reading the path from database or loading and displaing the image or both ?
|
|
|
|
|
you see the program consider the field as a string
so how I tell him this is a file path not a string
becuse he fill the other Edit boxes with strings from
the other fields but for the picture box I gave him a static
variable and I use the loadimage and Bitblt but nothing
shown in the picture box
I am a Civil Engineer, graduated in 1969, I've a wide experience in quite many fields of civil engineering, aswellas in HR development, Quality assurance, planning and QC,
I've been employed by Consultant Offices, Contractor Companies,
I did services for both Public Sectors and Private Sectors,
I've been in charge in Projects located inside and outside Egypt,
I've dealt with both Arabic companies and American Companies.
All these movements have given me a great variety of experiences.
|
|
|
|
|
here is my code I hope you tell me what is wrong with it?
void CFilmsView::OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView)
{
// TODO: Add your specialized code here and/or call the base class
CDaoRecordView::OnActivateView(bActivate, pActivateView, pDeactiveView);
//CPaintDC dc(this);
CClientDC dc(this);
HBITMAP bmpHandle = (HBITMAP)LoadImage(NULL,strPictureName,IMAGE_BITMAP,
0,0,LR_COPYFROMRESOURCE);
CBitmap bmpPicture;
CDC mdcPicture;
CBitmap *bmpFromHandle = bmpPicture.FromHandle(bmpHandle);
CRect rctPicture;
m_Picture1.GetWindowRect(&rctPicture);
mdcPicture.CreateCompatibleDC(&dc);
CBitmap * bmpPrevious = mdcPicture.SelectObject(bmpFromHandle);
ScreenToClient(&rctPicture);
dc.BitBlt(rctPicture.left, rctPicture.top,
rctPicture.Width(), rctPicture.Height(),
&mdcPicture, 0, 0, SRCCOPY);
dc.SelectObject(bmpPrevious);
//DeleteObject(bmpHandle);
I am a Civil Engineer, graduated in 1969, I've a wide experience in quite many fields of civil engineering, aswellas in HR development, Quality assurance, planning and QC,
I've been employed by Consultant Offices, Contractor Companies,
I did services for both Public Sectors and Private Sectors,
I've been in charge in Projects located inside and outside Egypt,
I've dealt with both Arabic companies and American Companies.
All these movements have given me a great variety of experiences.
|
|
|
|
|
What have you done so far?
What are your troubles about?
(i.e. Please be more specific)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I gave the picture box a static control
the program fill all the Edit box aith the string variables I gave him but for the picture box he treated the field as a string not a file path here is my code hope you can tell me what is wrong with it
void CFilmsView::OnPaint()
{
strPictureName=m_pSet->m_P1;
strPictureName=("E:\\BMP\\Hany\\Jimy1.bmp");
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
// TODO: Add your control notification handler code here
HBITMAP bmpHandle = (HBITMAP)LoadImage(NULL,strPictureName,IMAGE_BITMAP,
0,0,LR_LOADFROMFILE);
LoadBitmap(0,strPictureName);
CBitmap bmpPicture;
CDC mdcPicture;
CBitmap *bmpFromHandle = bmpPicture.FromHandle(bmpHandle);
CRect rctPicture;
m_Picture1.GetWindowRect(&rctPicture);
mdcPicture.CreateCompatibleDC(&dc);
CBitmap * bmpPrevious = mdcPicture.SelectObject(bmpFromHandle);
ScreenToClient(&rctPicture);
dc.BitBlt(rctPicture.left, rctPicture.top,
rctPicture.Width(), rctPicture.Height(),
&mdcPicture, 0, 0, SRCCOPY);
dc.SelectObject(bmpPrevious);
DeleteObject(bmpHandle);
// Do not call CDaoRecordView::OnPaint() for painting messages
}
I am a Civil Engineer, graduated in 1969, I've a wide experience in quite many fields of civil engineering, aswellas in HR development, Quality assurance, planning and QC,
I've been employed by Consultant Offices, Contractor Companies,
I did services for both Public Sectors and Private Sectors,
I've been in charge in Projects located inside and outside Egypt,
I've dealt with both Arabic companies and American Companies.
All these movements have given me a great variety of experiences.
|
|
|
|
|
Hi,
I have developed an application in eVc++4 on ARMV4I device. At present the application is ready adn in testing phase. Before handing over the final version, I want to know how to do the following:
1) The user should able to start the application only once i.e. if the application is already running, the user shouldn't be able to open another time the application.
2) Create a setup for the application. I want to restrict the setup being used only 3 times. Creating shortcut on desktop will be handled with the setup.
3) Add the application in the start up.
Any helpline and guidance for the above is highly appreciated.
Thanks
Terry
|
|
|
|
|
I have build an application somewhat same to windows explorer.
LeftView inheriting from TreeView and RightView from ListView..right
LeftView captures Expanding message:
ON_NOTIFY_REFLECT(TVN_ITEMEXPANDING, OnTvnExpanding)
But how can I get the HTREEITEM of expanding tree item.
e.g.
When we select a tree item we can get it using
HTREEITEM Item=TreeCtrl.GetSelectedItem();
But in case of expanding how can I get it?
|
|
|
|
|
MPTP wrote: When we select a tree item we can get it using
HTREEITEM Item=TreeCtrl.GetSelectedItem();
When you expand a node, it has to be selected or it will be selected before it expands or collaps.
So the same method TreeCtrl.GetSelectedItem(); should work inside the message handler.
|
|
|
|
|
But in explorer it should not be like this?
It mean I can not get the HTREEITEM at time of expanding tree item right?
|
|
|
|
|
You can try casting the pNMHDR into a pointer to NMTREEVIEW structure, where the structure members itemOld and itemNew will be populated with the Old and New states of the item.
modified on Friday, July 11, 2008 7:06 AM
|
|
|
|
|
Varghese_Paul_M wrote: When you expand a node, it has to be selected or it will be selected before it expands or collaps.
No no no
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi all,
I need to change the bitmap of the CbitmapButton on the events GetFocus, LostFocus and also in Clicked event. The problem I am facing is that, when I change the bitmap during GetFocus the bitmap is not loaded properly and when I use a breakpoint and debug the code the bitmap changed correctly. I dont know how to use it.
Also I tried to create a custom class for CBitmapButton and used it. In this I cannot set the bitmap to a particular button.
Please help me.
|
|
|
|
|
I think you are not using method CBitmapButton::LoadBitmaps for associating the images with the bitmap button.
|
|
|
|
|
m_button4.LoadBitmaps(IDB_BITMAP2,IDB_BITMAP1,IDB_BITMAP2,IDB_BITMAP2);
The above is the method I am using. For the focus events, I use like below :
void CdfdgDlg::OnBnKillfocusButton4()
{
m_button4.LoadBitmaps(IDB_BITMAP2,IDB_BITMAP1,IDB_BITMAP3,NULL);
}
void CdfdgDlg::OnBnSetfocusButton4()
{
m_button4.LoadBitmaps(IDB_BITMAP4,IDB_BITMAP5,IDB_BITMAP6,NULL);
}
|
|
|
|
|
The code looks fine. I assume that you have made the button property as "OwnerDraw".
It could be a problem of repainting the client area. Try calling m_button4.UpdateWindow() after calling LoadBitmaps. Ensure that the bitmaps are of correct size, color depth and fits correctly on the button. Also ensure that the method LoadBitmaps returns TRUE.
|
|
|
|
|
Hello Paul,
bool val=m_button4.LoadBitmapsIDB_BITMAP4,IDB_BITMAP4,IDB_BITMAP4,IDB_BITMAP4);
m_button4.SizeToContent();
m_button4.UpdateWindow();
The above is also not working. I studied about Subclassing but I dont know how to implement it. Please advice.
|
|
|
|
|
Is there anybody to help me...
|
|
|
|
|
how to add integers into a listbox
|
|
|
|
|
With MFC:
int iItem = 5;
CString szItem;
szItem.Format(_T("%d"),iItem);
listBox.AddString(szItem);
Plain Win32:
INT iItem = 5;
TCHAR szItem[32];
_stprintf(szItem, _T("%d"), iItem);
SendMessage(hWndListBox, LB_ADDSTRING, 0, (LPARAM) szItem);
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
i have connect ms access with vc++
i know how to get text from ms database
i dont know how get date from database and change its formate
|
|
|
|
|
Regards,
Sandip.
modified on Friday, July 11, 2008 5:31 AM
|
|
|
|
|
Instead you may give link to that post.
|
|
|
|
|
|
Its surprise to see!
I didnt know that the same guy posting this question.
What will be the reason?
|
|
|
|
|