[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 281
  • Last Modified:

Dynamically replacing pictures using dialog box with images in it

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
israel022697
Asked:
israel022697
  • 5
  • 4
1 Solution
 
jabaCommented:
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
 
israel022697Author Commented:
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
 
jabaCommented:
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
Microsoft Certification Exam 74-409

VeeamĀ® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
israel022697Author Commented:
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
 
jabaCommented:
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
 
jabaCommented:
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
 
israel022697Author Commented:
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
 
israel022697Author Commented:
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
 
jabaCommented:
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

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now