Solved

ActiveX Problem

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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…
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.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

708 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

14 Experts available now in Live!

Get 1:1 Help Now