Solved

Dynamically replacing pictures using dialog box with images in it

Posted on 1997-07-14
9
272 Views
Last Modified: 2013-12-03
I'm trying to write a web counter wich is an activex control.
I made a dialog box using the resources in visual c++.
Then I put 5 picture controls in it.
I also have 10 gifs of the 10 digits 0-9.
What I don't know is: How to send a message during run time changing the gif in the image control.
The idea is: each new loaded counter will open a socket with the server saying "I'm a new count... " and the server will answer saying some thing like " you are number xxxxx" and now I need to put the right digits in the right place.

How ???????????
0
Comment
Question by:israel022697
  • 5
  • 4
9 Comments
 
LVL 3

Expert Comment

by:jaba
Comment Utility
If you using MFC you must set ID to picture control ( it is, really, static control with few styles). ID must be different when IDC_STATIC. When you need go to classwizard and add variable referencing to you control ( control , CStatic type ) in you dialog class. CStatic have members SetBitmap , SetIcon etc ...
If you not using MFC you jast need send message STM_SETBITMAP to you control with right parametres . Look in help.
Sample :
SendDlgItemMessage(hwndDlg , IDC_DIGIT0 , STM_SETBITMAP , IMAGE_BITMAP , hDigit7 );


0
 

Author Comment

by:israel022697
Comment Utility
I sent this message but nothing is shown in the static control.
I wrote:

SendDlgItemMessage( hWndDlg, IDC_DIGIT0, STM_SETIMAGE, IMAGE_BITMAP, IDB_BITMAP8);

But instead of seeing the 8 digit picture, I see nothing there.
If I'm missing some refresh message please tell wich.
Any way, please write a short working example .
0
 
LVL 3

Expert Comment

by:jaba
Comment Utility
Stop ! Did you look into help topic ??? lParam isnt ID or bitmap resource. It is handle of bitmap. You need to load bitmaps from resources and keep handles for using.
Like this :
static HBITMAP hDigit8 = LoadBitmap (hInstance , MAKEINTRESOURCE(IDC_DIGIT8) );

SendDlgItemMessage( hWndDlg, IDC_DIGIT0, STM_SETIMAGE, IMAGE_BITMAP, hDigit8);
0
 

Author Comment

by:israel022697
Comment Utility
10x a lot.
If you can please tell me where can I find a good resource for all windows messages and actually a good reference to the win 32 API I'll apreciate it.( I prefer a good book ).

I don't have much experiece grading these questions/answers so if you can tell me how much point do you think it worth I'll grade it.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 3

Expert Comment

by:jaba
Comment Utility
Hmm , may be its bug of WWW server , but my new comment not here.
You wrong , LPARAM of STM_SETIMAGE isnt resource ID of bitmat. It is handle of bitmap . You need make somthing like this:
static HBITMAP hDigit8 = LoadBitmap(hInstance ,  IDB_BITMAP8 );
SendDlgItemMessage( hWndDlg, IDC_DIGIT0, STM_SETIMAGE, IMAGE_BITMAP, hDigit8);
0
 
LVL 3

Expert Comment

by:jaba
Comment Utility
Ohh , Sorry. Now i see it . You can find full information about WIN32 API messages , functions in Help System inside MSVC 5.0 , 4.2 , 4.2 , 4.0 . You can , also ( if you newbie and wont have problems with extended controls , win32 futures etc) get documentations /help on win16 api. Usially all message from win16 api and all functions supporting under win32 .
0
 

Author Comment

by:israel022697
Comment Utility
Look in the question history section below.

I'll post again just in case:

10x a lot.
                          If you can please tell me where can I find a good resource for all windows messages and actually a
                          good reference to the win 32 API I'll apreciate it.( I prefer a good book ).

                          I don't have much experiece grading these questions/answers so if you can tell me how much point
                          do you think it worth I'll grade it.
0
 

Author Comment

by:israel022697
Comment Utility
OK.

Something is wrong with their server, I cannot see the grading option now.

Try to reply or something so I could grade your question.
0
 
LVL 3

Accepted Solution

by:
jaba earned 50 total points
Comment Utility
Hmm . About book. I am not sure about this. I am working with Windoiws API few years and usially using Visual C++ Help . I seen few nice books for beginners, but they translated to russian and i not know about original Captions and etc. Try look to WWW.MICROSOFT.COM and seach for microsoft press books. May be it will help . But really you need small book with main concepts of windows programming , help and samples. Good look.
About point. 50 is ok

Sergey
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now