Solved

ActiveX Problem

Posted on 2004-08-08
4
146 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
  • 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

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

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…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

919 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

13 Experts available now in Live!

Get 1:1 Help Now