Tech or Treat! Write an article about your scariest tech disaster to win gadgets!Learn more

x
?
Solved

Dynamically replacing pictures using dialog box with images in it

Posted on 1997-07-14
9
Medium Priority
?
280 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
Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

 

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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
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…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

647 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