Author |
Topic |
|
ms08233
17 Posts |
Posted - 20 Jan 2003 : 18:25:52
|
I'm just starting out (using the Visual C++ 6 Programming Blue Book) trying to change bitmaps displayed in a simple dialog-box based eVC++ app. Following the book, I first tried using SetIcon to change the icon in a CStatic control (tied to a picture control set to type Icon), but that gave an "undefined external symbol" link error. The help file says SetIcon does not work for CStatic/CButtons in CE, so I tried using a Picture control set to bitmap type, and every combination of SetBitmap/LoadBitmap I could find in the help files, but the best I've been able to do is blank out the bitmap loaded into the picture control at design time.
All this is so much easier in Visual Basic, but we have to convert our project to eVC++ for many reasons. Does anybody have some eVC++ sample code (preferably using MFC) that shows how to do these things that would be simple in VB?:
1. Load a new bitmap into a control at run time. 2. Make a control invisible and visible again (so that an underlying bitmap could be shown/hidden rapidly). 3. Change the ZOrder of controls to specify which on is "on top". 4. Change the height of a control so that variable parts of a bitmap are displayed.
Any help for the VC++ newbie would be greatly appreciated. |
Edited by - ms08233 on 20 Jan 2003 18:29:48 |
|
whuh
23 Posts |
Posted - 20 Jan 2003 : 18:40:54
|
HI,
You may try like this. As workaround, LoadBitmap() will work fine. Here is some part of code.
CStatic m_hStatusIcon; ... DDX_Control(pDX, IDC_STATUSICON, m_hStatusIcon); ... m_hStatusIcon.SetBitmap(::LoadBitmap(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_OK)));
WH
|
|
|
ms08233
17 Posts |
Posted - 20 Jan 2003 : 18:55:28
|
Thanks! That did it. Instead of AfxGetInstanceHandle() I was using NULL (from the help file example code). Changing it to AfxGetInstanceHandle() solved the first problem.
Anybody have any samples for questions 2-4 above? |
|
|
|
Topic |
|
|
|