rbrunton
08-02-2004, 09:14 AM
Greetings,
I have been trying to display a graphic from a resource without enough success.
I've tried two approaches. The first attempts to read a JPEG image as a resource. I have follwed the example in HELP and the TIPS section of the site. Two problems arize, one of which I think is just a typo. That is with the function IS3ReadJPG. In the example the line is HGLOBAL hRGB = IS3ReadJPG(hSrc, &uW, &uH, 24, NULL, 0); and I receive the error message that IS3ReadJPG doesn't take 6 parameters. The ImgSource documentation supports that indicating only five.
When I use the function with only five parameters (HGLOBAL hRGB = IS3ReadJPG(hSrc, &uW, &uH, 24, 0);) I receive an error code 9 (incorrect format). I'm assuming that my problem here is that I haven't imported the JPEG properly as a resouce. In VC.NET I right-click on the resource editor page and choose "Add Resource" and then "Import". I am allowed to import the JPEG file and am asked to identify the type of resource. I type JPEG and it is displayed as "JPEG" (with quotes) and the resource ID is IDR_JPEG1. I then use the line
if (hRsrc = FindResource(hInstance, MAKEINTRESOURCE(IDR_JPEG1), "JPEG")) ...
All of this executes properly until the read statement at which point hRGB is returned as a NULL value.
The second approach is to import the resource as a BITMAP. I can then display it, but I haven't been able to resize it to fit the available window. In order to do that it appears that I need to convert it to a DIB, but that has also eluded me.
Any help with either approach would be greatly appreciated.
Ron
I have been trying to display a graphic from a resource without enough success.
I've tried two approaches. The first attempts to read a JPEG image as a resource. I have follwed the example in HELP and the TIPS section of the site. Two problems arize, one of which I think is just a typo. That is with the function IS3ReadJPG. In the example the line is HGLOBAL hRGB = IS3ReadJPG(hSrc, &uW, &uH, 24, NULL, 0); and I receive the error message that IS3ReadJPG doesn't take 6 parameters. The ImgSource documentation supports that indicating only five.
When I use the function with only five parameters (HGLOBAL hRGB = IS3ReadJPG(hSrc, &uW, &uH, 24, 0);) I receive an error code 9 (incorrect format). I'm assuming that my problem here is that I haven't imported the JPEG properly as a resouce. In VC.NET I right-click on the resource editor page and choose "Add Resource" and then "Import". I am allowed to import the JPEG file and am asked to identify the type of resource. I type JPEG and it is displayed as "JPEG" (with quotes) and the resource ID is IDR_JPEG1. I then use the line
if (hRsrc = FindResource(hInstance, MAKEINTRESOURCE(IDR_JPEG1), "JPEG")) ...
All of this executes properly until the read statement at which point hRGB is returned as a NULL value.
The second approach is to import the resource as a BITMAP. I can then display it, but I haven't been able to resize it to fit the available window. In order to do that it appears that I need to convert it to a DIB, but that has also eluded me.
Any help with either approach would be greatly appreciated.
Ron