Re: How to load resorces of a form that is not loaded
- From: "Eduardo" <mm@xxxxxx>
- Date: Mon, 6 Oct 2008 22:43:41 -0300
Hello expvb:
I think VB just stores the entire FRX file, not as separate image
resources, so you have to decode it somehow, which is a lot of work.
Well, there is not matter, I'll do the lot of work.
I fact, that what you said is the only way I have now clear that I can
achieve what I want.
I thought to put some key string first, and then all the images together in
a single custom data as a property of a control.
Then, when I have to load the data, search the exe for the key string. But
the drawback of that is that if the exe is too big, it will take some time
to find the key string
I read the other thread, which seems that you have images, and your OCX
users could create multiple instances of the control, but you want these
controls to share the images to save memory.
To save exe size.
I don't want each instance of my control to save the same images to the exe.
I am not sure if the images are supplied by you, or by your users.
Not by me. If they were supplied by me, they would be in the resource file
of my ocx.
They are added by the users at design time.
They could add the images to any instance of the control, because all the
instances of the control will share the same images through a bas module
(where they will be stored in memory at design time).
If they are supplied by you[...cut]
If the images are provided by the user, then it's better to use separate
files, such as BMP files.
That's the way I'm doing it now. But I want to simplify the life of the user
storing the images on the exe.
[...cut]
You can save the pictures in the user's EXE. In this case, binary
property's are saved in FRX files in the user's project. You can store
these pictures in global variables, and do a comparison and store only if
the data is unique. Global variables in standard modules are accessible by
all instances of your control. Try this for instance:
In Module1:
Public CreatedCounter As Long
In UserControl:
Private Sub UserControl_Initialize()
CreatedCounter = CreatedCounter + 1
MsgBox "CreatedCounter = " & CreatedCounter
End Sub
For pictures, you can use a Collection to store file names, or use a
dynamic array of StdPicture.
Yes, at design time I store the images in a bas module, but when the user
compiles, I want to store in the exe only one time each image.
I can do that, I think, saving the images in a property of the control (with
the PropertyBag) in the first instance of the control that executes the
WriteProperties event, and don't save them in the other instances.
But when the exe runs, I don't know what instance of the control will load
first, so I need to load the images from the only instance of the control
that saved them in the exe.
.
- Follow-Ups:
- References:
- How to load resorces of a form that is not loaded
- From: Eduardo
- Re: How to load resorces of a form that is not loaded
- From: Eduardo
- Re: How to load resorces of a form that is not loaded
- From: expvb
- How to load resorces of a form that is not loaded
- Prev by Date: Re: Double quote issue with VB6, Access and text files
- Next by Date: How can I get PC id of one machine on my network from another PC o
- Previous by thread: Re: How to load resorces of a form that is not loaded
- Next by thread: Re: How to load resorces of a form that is not loaded
- Index(es):
Relevant Pages
|