Solved

Dynamically replacing pictures using dialog box with images in it

Posted on 1997-07-14
9
273 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
ID: 1400846
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
ID: 1400847
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
ID: 1400848
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
ID: 1400849
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 3

Expert Comment

by:jaba
ID: 1400850
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
ID: 1400851
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
ID: 1400852
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
ID: 1400853
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
ID: 1400854
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

867 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

25 Experts available now in Live!

Get 1:1 Help Now