Solved

Dynamically replacing pictures using dialog box with images in it

Posted on 1997-07-14
9
277 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 

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
 
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

726 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