|
ya i tried this too. I set a limit to 32. may be let me explain a bit about japanese fonts using English keyboard. the OS will wait until a user presses enter to confirm the char. otherwise all the typed characters will be in buffer. So once i reach 32 charecters, i can still type characters without pressing enter. if i press enter, anything more than 32 chars will be truncated off.
Regards,
Ram
|
|
|
|
|
Normally, SetLimitText() will not allow more than the specified characters. It doesnot require pressing enter key. Iam not sure about japanese fonts. If SetlimitText doesnot work i thing u need to handle many windows events like WM_KEYDOWN, ...
|
|
|
|
|
As you earlier said that the control comes to onchangeeditbox() only when you press ENTER key, then let the control come to this function. Afterwards you can take the data of Edit box in some array and do the necessary manipulation in array i.e make the data 32 character long....and then display the data in this modified array in Edit box.
|
|
|
|
|
hi i am loading an bmp image in a button. in windows vista the image background color differs from the dialog color. how to rectify this. pls help me
|
|
|
|
|
You loaded a bitmap on the button now what is different of background?
|
|
|
|
|
image shows a different color with dialog box
|
|
|
|
|
But you load an image for button,right?
|
|
|
|
|
yes but the image is not transparent with button in vista. Incase of windows xp its looking fine
|
|
|
|
|
Does this help?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hello and good day to all,
I am currently working on a project where I can patch together a number of bitmaps and make them as one. It also has options of resizing the bitmap before saving it by removing some bytes here and there. Because of the limitation in CreateCompatibleBitmap() on large files, what I do is I store the needed data on BITMAPINFOHEADER and BITMAPFILEHEADER and I also have a char * for saving the actual data of the bitmap.
Here is where the problem starts. I have a 3200 x 3200 and easily saves it on a bitmap, then I can also reload and resize and make it into half (1600 x 1600) then saves it and it works(I can see it in the explorer). However, when I resize it to a third of a size (1067 x 1067), the bitmap file (when opened in explorer) won't show and even load. But when I resize it to a fourth of the original size it shows. These problem also occurred on the one-sixth of the original.
BmapFHeader.bfType = 'MB';<br />
BmapFHeader.bfSize = (gBitMap.width * gBitMap.height * 3) + 54; <br />
BmapFHeader.bfReserved1 = 0x00;<br />
BmapFHeader.bfReserved2 = 0x00;<br />
BmapFHeader.bfOffBits = 54;<br />
<br />
BmapIHeader.biSize = 40;<br />
BmapIHeader.biWidth = gBitMap.width;<br />
BmapIHeader.biHeight = gBitMap.height;<br />
BmapIHeader.biPlanes = 1; <br />
BmapIHeader.biBitCount = 24; <br />
BmapIHeader.biCompression = BI_RGB;<br />
BmapIHeader.biSizeImage = gBitMap.width * gBitMap.height * 3;<br />
BmapIHeader.biXPelsPerMeter = 0x00;<br />
BmapIHeader.biYPelsPerMeter = 0x00;<br />
BmapIHeader.biClrUsed = 0x00;<br />
BmapIHeader.biClrImportant = 0x00;
Above is the BITMAPINFOHEADER and BITMAPFILEHEADER and I write it to the file, and afterwards I write the data. I double checked every parameter but all of them seems correct. Its just weird that it works on certain sizes while does not work on some. I am hoping that someone here might know the answer. Please help me out! Thank you very much!
Edit: Already solved! 24bitmaps that I am processing needs to have a row which is divisible by 4. Many thanks to Whitesky for the immediate attention and help, Naveen.R for the suggestions, and specially to Paresh Chitte for the great articles that solved my problem. Thanks also to the others for the time and effort!
-- modified at 3:15 Monday 9th July, 2007
|
|
|
|
|
|
Thanks! I already read this one though. But unfortunately it did not solve my problem. It's just weird that there are certain sizes of the bitmap that it can't display.
|
|
|
|
|
Does CImage::Save solve your problem of course it saves uncompressed bitmap but you have other choices like jpg,...
|
|
|
|
|
I just use WriteFile() and write the BITMAPFILEHEADER and BITMAPINFOHEADER and then the char * containing the data. I am thinking maybe I got something wrong off my bitmap header, but it works on other values like 3200x3200 and 1600x1600. But when it comes to 1067x1067 it does not. I checked the char * to see whether I got the size of data wrong but it is right. Checking the bitmap file that I produced(1067x1067) it seems right. I just dont get it why it doesnt display. I pasted below the header of the bitmap file for reference. Thank you for the help and time!
42 4D E1 1D 34 00 00 00 00 00 36 00 00 00 28 00 00 00 2B 04 00 00 2B 04 00 00 01 00 18 00 00 00 00 00 AB 1D 34 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
|
|
|
|
It seems your problem solved.;)
|
|
|
|
|
Yes it has been! Thanks a lot for all your help and time to solve this problem!
|
|
|
|
|
Try to keep height and width of your bmp in multiple of 4.
Hope this will help you.
Regards,
Paresh.
|
|
|
|
|
Yes it does help! though the application's requirements are to display it in different multiples. Really tough. I'm just wondering why the bitmap won't work on other multiples besides 2 and 4. Thanks a lot for the help though!
|
|
|
|
|
|
Wow nice articles! I might find the answer in one of them. Thanks Paresh for the help!
Edit: Your right! It must be on a multiple of 4! Nice research on the articles! Thanks a lot for the help!
|
|
|
|
|
Llasus wrote: I'm just wondering why the bitmap won't work on other multiples besides 2 and 4
For bitmap's the pixels that represent one row should be a multiple of four.
Suppose you have a bitmap of bit dept 24 and width 150. In that case the total byte required to represent on row is
( 24/8 )*150 = 450. But this is not divisible by four. In this case you have to add dummy bytes in the end of each row. In the above example the number of dummy bytes will be
int nBytesNeed = 4 - (450%4);// = 2
so append a 2 bytes at the end of each row. Thus for each row the number of bytes will be 452.
|
|
|
|
|
Yupyup! I realized that just earlier. Im gonna do some revisions for my code now for that extra padding needed. Thank you for your help!
|
|
|
|
|
I wanted to write some code or use a library to take the screen as an array of pixels and to locate a specific pixel by x-y axis of the screen, so for example I am running a program on the side which displays its output as graphics, like a card game, now I want to read the cards, in order to do this I will have to read the pixel at a specific location and see if it matches with a different array to "figure" out which card was displayed, and then have the program take the appropriate action. For example if it is poker and the cards are good to press a button to call/raise instead of folding and vice versa. Basically I need to read the screen, or a window and interpret the visual state.
|
|
|
|
|
Im not sure do you need to GetPixel ?
|
|
|
|
|
Just a suggestion. You can start by studying all about CDC.
CWnd* MyDlg;<br />
CDC* MyDC;<br />
<br />
MyDlg = GetDlgItem(IDC_DISPLAYPANEL);
MyDC = MyDlg->GetDC();
From here by getting the CDC of your dialog, you can obtain it's bitmap by using CreateCompatibleBitmap() and obtain the data you'll need from your Bitmap object. Haven't tried it yet, though I am sure that these are the ones you will be needing for your application. Hope that helps.
|
|
|
|