How to Load images dynamically.
-
I want to load an image to a control by downloading it at runtime. Can some body please tell me how to load the image at run time. (i need it for all types of images). Thanks Kishore
to load the bitmap file use something like :
HBITMAP hBitmap = (HBITMAP)::LoadImage(0, lpszFileName, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
(edited to add more text.)
Maximilien Lincourt Your Head A Splode - Strong Bad
-
i want to load a bitmap image from a specified location, at run time. For example: i want to load the image from the file "bitmap1.bmp" saved on desktop to a control on the UI. Kishore
Ok, so what's the problem? What code do you have so far?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
Ok, so what's the problem? What code do you have so far?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
I have no idea how to load the images from a file at run time. please give some sample code. Kishore
-
I have no idea how to load the images from a file at run time. please give some sample code. Kishore
Y K Kishore Kumar wrote:
please give some sample code.
See here.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
I want to load an image to a control by downloading it at runtime. Can some body please tell me how to load the image at run time. (i need it for all types of images). Thanks Kishore
If you want to load bmp files you can use of
LoadImage
but if you want to load other files like jpg you can use of CImage class and then use of a hbitmap for set it to controls. -
I want to load an image to a control by downloading it at runtime. Can some body please tell me how to load the image at run time. (i need it for all types of images). Thanks Kishore
Y K Kishore Kumar wrote:
I want to load an image to a control by downloading it at runtime. Can some body please tell me how to load the image at run time. (i need it for all types of images).
Search for IPictureDisp if you like using COM and search for CEnBitmap class by Dan.G. here.. that would solve your purpose! i feel
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
Never mind - my own stupidity is the source of every "problem" - Mixturecheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You
-
If you want to load bmp files you can use of
LoadImage
but if you want to load other files like jpg you can use of CImage class and then use of a hbitmap for set it to controls.Hamid. wrote:
if you want to load other files like jpg you can use of CImage class and then use of a hbitmap for set it to controls.
doesn't you think, CImage required ample amount of code and inclusion of header file to make it work in vc++.. but i believe it is one of good class provided by MS for image handlling. i believe C# also use same interface!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
Never mind - my own stupidity is the source of every "problem" - Mixturecheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You
-
I have no idea how to load the images from a file at run time. please give some sample code. Kishore
Y K Kishore Kumar wrote:
please give some sample code.
google is your friend .. dude. !
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
Never mind - my own stupidity is the source of every "problem" - Mixturecheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You
-
Hamid. wrote:
if you want to load other files like jpg you can use of CImage class and then use of a hbitmap for set it to controls.
doesn't you think, CImage required ample amount of code and inclusion of header file to make it work in vc++.. but i believe it is one of good class provided by MS for image handlling. i believe C# also use same interface!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
Never mind - my own stupidity is the source of every "problem" - Mixturecheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You
Yeah CImage has a header file that it gives some memory but I guess maybe he will have problem on next for jpg files so I suggest this class however he can uses of GDI+.
-
Yeah CImage has a header file that it gives some memory but I guess maybe he will have problem on next for jpg files so I suggest this class however he can uses of GDI+.
Hamid. wrote:
Yeah CImage has a header file that it gives some memory
did you intended to say memory leak!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
Never mind - my own stupidity is the source of every "problem" - Mixturecheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You
-
Hamid. wrote:
Yeah CImage has a header file that it gives some memory
did you intended to say memory leak!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
Never mind - my own stupidity is the source of every "problem" - Mixturecheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You
No its not memory leak but increase Mem Usage of a program when I worked with it I dont know why?
-
No its not memory leak but increase Mem Usage of a program when I worked with it I dont know why?
Hamid. wrote:
No its not memory leak but increase Mem Usage of a program when I worked with it I dont know why?
might be creating/putting image data in memory! thats why it's increase usage of memeory sometimes
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
Never mind - my own stupidity is the source of every "problem" - Mixturecheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You
-
Hamid. wrote:
No its not memory leak but increase Mem Usage of a program when I worked with it I dont know why?
might be creating/putting image data in memory! thats why it's increase usage of memeory sometimes
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
Never mind - my own stupidity is the source of every "problem" - Mixturecheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You
I dont know I tried to find problem but I couldnt.