|
|
Without seeing your actual code that is creating/opening the record set, it's hard to offer any sort of answer.
As you are navigating through the result set, you can use the IsDeleted() method before allowing access to the record.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
The problem may be elsewhere since you haven't shown all the code in your Open() call (if that
IS the entire Open() call it is incorrect) but you can use CRecordset::IsDeleted() when traversing
the recordset.
|
|
|
|
|
Hi All,
I have a problem, its eating lot of time .
i have 24 bit Bitmap file . i want to convert tht file to 8 bit Bitmap file .
can any one know algorithm to convert it . i want to do it in using c-code . NOT USING ANY SOFTWARES OR ANY EDITORS (LIKE PAINT BRUSH)
how can i do it ? can any one suggest me a way .
i will be thank full if you give me any links to do it .
Regards
Vijay
|
|
|
|
|
The easiest way is to create a new bitmap of the same size but with an 8 bit colordepth, then BitBlt your 24-bit bitmap to the new 8-bit bitmap. The OS will take care of the color conversion for you.
Another way is to cteate a DIB from your 24-bit bitmap, loop through the bits and convert each to it's 8-bit equivlent. Doing it this way, you must remember that an 8-bit image has a pallette and each pixel is the index into the pallette, whereas a 24-bit has no pallete and each pixel holds the color.
|
|
|
|
|
Hi Walder ,
Thanks for your time for replying me .
you suggested me 2 ways to me
if i want to use the Another way "Creating DIB " . When i convert 24 bit to 8 bits equivlent wht would be the formula for converstion(24 bit to 8 bit ) and more over how can i get the color platte for that conversion . "Will the OS will do it for me , or i should need to write a code to create a color table "
Regards
Vijay
|
|
|
|
|
There is no direct formula for converting.
Look at the GDI references for bitmaps on MSDN. The BITMAPINFO contains a BITMAPINFO header which details the bitmap, and an array of RGBQUAD structures which is the colors used in the pallette. To convert using a DIB, first create that array of RGBQUAD structures, and use it to create a pallette ( The colors you use depend on you).
Then for each RGB pixel value in the 24-bit bitmap call GetNearestPaletteIndex(), this will give you the index of the color in the pallette you just created. Use this index as the pixel value in your new 8-bit bitmap. Ultimatly you want to build a new array of pixel values.
To save, all you need to do is create a new BITMAPINFO and BITMAPINFOHEADER for the new image, using the new array of RGBQUAD's and the new array of pixel values.
To get you started, look at Chris Maunders DIB wrapper here[^].
If you let the OS do the convertion for you, it will use the standard color pallette. In most case this is not a problem, but the standard pallette contains a range of all the colors from white to black. If your bitmap contains mostly the color green for example, you will lose a lot of colors since the pallette has colors you don't want to use.
Most paint programs will scan the image before doing a bitdepth conversion, and create a pallette that contains only the colors in the bitmap. You will still lose a lot of colors but not as many as with using a standard pallette.
|
|
|
|
|
Thank you very much for your help BOSS.
|
|
|
|
|
|
why do you want to do this ? Do you want it to be smaller, or is there another reason ?
I'm asking because if the reason is for a toolbar or similar, you can use 24 bit images, if you set it up right
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Hi Christian,
No i want to convert to PRN format , which i have done for 8 bit.
|
|
|
|
|
OK, then just let BltBlt convert it for you
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Also, if mapping to the system palette doesn't give you the quality you want then try a halftone
palette. Even better, there's the Gervautz-Purgathofer octree color quanitization algorithm.
Check out this MSJ article: Wicked Code [^]
|
|
|
|
|
Hi!
I would like to know whether the value of dmPaperSize in DEVMODE structure for custom papersize varies with the printer used. How is it possible to know the dmPaperSize for custom paper size for a particular printer.
Thanks
|
|
|
|
|
vcpgmr wrote: is it possible to know the dmPaperSize for custom paper size for a particular printer
Hi,
Did you try like this?
pDevModeOutput->dmFormName = NewFormName;
pDevModeOutput->dmPaperSize = DMPAPER_USER;
pDevModeOutput->dmPaperLength = CustomLength;
pDevModeOutput->dmPaperWidth = CustomWidth;
Krishnakumar
|
|
|
|
|
Hi!,
Thank you for the reply.
Yes I had tried the way you said, but its not working. Are there any other variables/properties which we need to set before setting value to DocumentProperties
Thank you
|
|
|
|
|
|
how to write and read into files using vc++ for smartphones
i am able to write into file.
i am not able to read and append the file.
after reading how do i print that data on smartphones?
please send me the sample code.
|
|
|
|
|
Can you show us the code that you have tried that does not work?
|
|
|
|
|
Hi
All
I create one DLL with unicode support and i want to use this DLL in my other non unicode application in MFC/VC++, but while using this i get error message of "Application.exe error memory can not read" so anybody have solution to this plz send me.
Thanks
Atool
Atool
|
|
|
|
|
M. Atul wrote: so anybody have solution to this plz send me.
create both dll with unciode support.
I doubt the error comes when u try to call a function of the dll having some TCHAR as parameter..
nave
|
|
|
|
|
I am not using two DLL, i am using one unicode dll and i want to call it in other non unicode client application. In client application i call one fun from DLL which takes DWORD parameter and return CString values.But when i run client application there is error as " Application.exe error memory could not read"
When i debug client application i got error in messagebox where i display CString values which is return from DLL function.
Thanks
Atool
Atool
|
|
|
|
|
M. Atul wrote: I am not using two DLL
M. Atul wrote: and return CString values
here is the pblm. CString internally keeps a pointer of type LPTSTR.
in a unciode define dll it becomes LPTSTR = whcar_t*
in a non unciode application it become LPTSTR - char*
In your case a wchar_t pointer is interpreted as char* pointer after u have got the retun value from the function.
solution:
Change the return type from CString to wchar_t*.
// in dll
wchar_t* fun( DWORD dw )
{
return somepointer;
}
// in client application
CString cs = fun( 2 );
-- modified at 1:49 Friday 2nd February, 2007
nave
|
|
|
|
|
Thanks Naveen R for help
I change in code as u said , though i have problem when i run client application there is message that memory could not read. Is there any need for project setting to run unicode dll in Non unicode client application.
Regards
Atool
Atool
|
|
|
|
|
no. Only thing is that u should not use TCHAR, LPTSTR etc which have different meaning in unicode and non unicode application.
Can u show me the code in that function of dll and how is it called from the client?
nave
|
|
|
|