Solved

use DLL resource to fill picturebox

Posted on 1998-12-05
2
134 Views
Last Modified: 2012-08-14
i use Borland REsource Workshop to make a DLL resource.
i got 1 bmp file (file type BMP, file name BMP1) and 1 JPEG file (file type JPG, filename JPG1). (note bmp is default support by the borland workshop, while jpeg is user define).

how can i use the above picture file to fill let say picturebox1 in VB ?

i have asked this question at many different forums and mailing lists, but now yet been answered for year. hope someone can answer this question here.

thanks for help
keong
0
Comment
Question by:hckhiu
[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
2 Comments
 
LVL 8

Accepted Solution

by:
MikeP090797 earned 170 total points
ID: 1448393
I am not sure about the JPEG, but you can do this to get the BMP:
1. LoadLibrary to load the dll.
2. FindResource to get the resource handle
3. LoadResource to load the resource itself, to get the handle to the bitmap
4. CreateDC and SelectObject with the returned handle to select the bitmap into the new device context.
5. BitBlt to output it

Tell me if you need any help
0
 
LVL 15

Expert Comment

by:ameba
ID: 1448394
The best way is to use .RES format in Resource Workshop, and add .RES file to your VB project.
There is VB example in your vb5\samples\PGuide\ATM directory.
It shows how to load picture, cursor, sound or string from your Resource file.

For dlls, it is not that simple. LoadResource is complicated (you must also use LockResource and UnLockResource...). There are easier API functions for each type of resource (e.g. LoadBitmap, LoadIcon, LoadCursor...)

0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

705 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