Solved

ActiveX Problem

Posted on 2004-08-08
4
162 Views
Last Modified: 2013-11-20
I used ActiveX Microsoft Form button to create a button with picture.. will there be any problem with this method? or i should instead code the button with the coding below :

CString szFilename ("C:\Talla\yourimg.bmp");
HBITMAP hBmp = (HBITMAP)::LoadImage(
                NULL,
                szFilename,
                IMAGE_BITMAP,
                0,
                0,
                LR_LOADFROMFILE|LR_CREATEDIBSECTION
                );

Because i using ActiveX and found that it is easy to use.. but i'm afraid there might be some problem cos sometimes things easy does not mean good... Thanks
0
Comment
Question by:mwcmp
[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
  • 3
4 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 11752717
The only problem I can see is that you should use double backslashes in your path names, e.g.

CString szFilename ("C:\\Talla\\yourimg.bmp");
HBITMAP hBmp = (HBITMAP)::LoadImage(
               NULL,
               szFilename,
               IMAGE_BITMAP,
               0,
               0,
               LR_LOADFROMFILE|LR_CREATEDIBSECTION
               );
0
 
LVL 86

Expert Comment

by:jkr
ID: 11752730
BTW, see also http://www.codeguru.com/Cpp/G-M/bitmap/article.php/c1681/ ("Creating a bitmap object from a BMP file") and http://www.codeguru.com/Cpp/G-M/bitmap/article.php/c1693/ ("Creating a DIB section from a BMP file")
0
 

Author Comment

by:mwcmp
ID: 11755822
but which method is better? using ActiveX or the coding method?
0
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 11755897
Well, 'LoadImage()' is an SDK/API method and has nothing to do with ActiveX. And, it's hard to tell which is better. Both are OK.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
modThree challenge 4 155
Line meaning 9 97
sumHeights2  challenge 7 139
Not needed 13 134
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

734 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