Solved

ActiveX Problem

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

810 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