|
|
CFile::GetLength throw an exception when processing the file which one's size is bigger than 0xFFFE!
so, How can I get the file size of a very big file which one's size is bigger than 0xFFFE?
|
|
|
|
|
Try GetFileAttributesEx[^].
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
You can use GetFileAttributes() as suggested below but I'd be more concerned about the exception. CFile::GetLength shouldn't have a problem with files > 64K
If you're using VC6 then you should avoid CFile::GetLength since it only supports files < 4G.
A universal function I always use:
__int64 FileSize(CString csFile)
{
WIN32_FIND_DATA fd;
__int64 iSize = -1;
HANDLE hFind = FindFirstFile((LPCTSTR)csFile, &fd);
if (hFind != INVALID_HANDLE_VALUE)
iSize = (((__int64)fd.nFileSizeHigh) << 32) + (__int64)fd.nFileSizeLow;
FindClose(hFind);
return iSize;
}
The default return value (-1) indicates a problem, use GetLastError() in that case.
|
|
|
|
|
adroitadroit20 wrote: CFile::GetLength throw an exception when processing the file which one's size is bigger than 0xFFFE!
0xFFFE == 63 kilobytes, CFile::GetLength should not throw an exception here. Try wrapping your function call in a try/catch block and check what the CFileException Class reports[^].
Best Wishes,
-David Delaune
|
|
|
|
|
sorry, that is a mis type.
The Value should be 0xFFFFFFFE
|
|
|
|
|
adroitadroit20 wrote: The Value should be 0xFFFFFFFE
Then you must be using Visual Studio 6 with MFC 6.0 as your development tools. You could use the previously mentioned API calls or you can use the GetFileSizeEx Function[^] which accepts a pointer to a LARGE_INTEGER structure.
Best Wishes,
-David Delaune
|
|
|
|
|
I'm opening a pdf document in IE.
I would like to have a feedback to me when the pdf has finish loading completely.
I've tried DocumentComplete, but it seems that the event is fired off when it starts to load, and NOT when it has loaded completed.
Does anyone has any suggestions to this?
(I'm using c++)
|
|
|
|
|
Have you checked that the document doesn't have any frames. DocumentComplete gets fired for each frame.
see: http://msdn.microsoft.com/en-us/library/aa768282(VS.85).aspx[^]
...cmk
The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack
|
|
|
|
|
Hi cmk
Thank you for your reply.
There isn't any frames in the document as it is an ordinary pdf document.
That's the puzzling problem, because i had thought that the DocumentComplete would get fired AFTER the pdf is loaded and NOT when IE starts to load it.
Here, I'm just wondering if DocumentComplete would refer only to HTML page, or any document that IE loads.
Anyone out there knows?
|
|
|
|
|
I draw a round button.
pDC->RoundRect(left,top,right,bottom,x,y);
Now, i want to set region for button. I use:
CRgn rgn;
rgn.CreateRoundRectRgn(left,top,right + 1, bottom + 1, x1, y1);
How to calculate value for x1, y1? I don't know which value of x1, y1 are logical.
|
|
|
|
|
x and y I suppose. What's the problem exactly ?
BTW, why right+1 and bottom+1 ?
|
|
|
|
|
if i use right and bottom, it doesn't bound all Rectangle. I want to calculate value of x1, y1 to fit round rectangle that i draw.
|
|
|
|
|
http://www.buckrogers.demon.co.uk/software/typecase_vc.zip (source code included) is a program that I wrote: it is like Windows Character Map but displays much bigger and clearer and can select any of the 256 Unicode character planes. It seems to work OK, except:
http://www.buckrogers.demon.co.uk/temp/typecase_bug00.gif is a screen capture of a run of Typecase.
The bug is: some characters (e.g. most characters in the top 4 rows in the image linked to here) do not display in the default font, but they do display in the font '@Arial Unicode MS' - with each character rotated 90 degrees anticlockwise. Please what is causing this?
Only certain groups of characters are affected. But character 2122 (trademark) displays the right way up in the default font and rotated 90deg anticlockwise in the font '@Arial Unicode MS'.
|
|
|
|
|
Check the fonts you are using in your rendering function(s). Have you inadvertently set a parameter wrongly for the display?
|
|
|
|
|
The whole program including the source texts is in the zip file at the link in my first message. I have looked through it many times.
|
|
|
|
|
Please, take the time to select the relevant piece of code and post it here. You are asking the question, so you should do your best to present it clearly. Almost nobody will go into a full project trying to find where the problem resides.
|
|
|
|
|
Anthony Appleyard wrote: The whole program including the source texts is in the zip file at the link in my first message.
I'm sure it is, but I have no idea of the construction of this program, which part sets the font, selects the characters etc., nor do I (or any of the other CodeProjecters) have the time or energy to figure it out. Use the VS debugger to step through the code as it sets up to display the characters in question, in order to discover whereabouts the error occurs.
|
|
|
|
|
|
Could you at least be bothered to read #7 here?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Done. Thanks for the advice.
else {SIZE K[256]; HFONT zaf; char*n;
sprintf(tit,"TYPECASE: Select a Unicode character from 0x%02x00 to 0x%02xff: %s %s",
nalph2,nalph2,alph[nalph2]+3,alph[nalph2]+21);
wc[1]=0; di=int(r.right/double(I)); dj=int(r.bottom/double(J+sb));
for(i=0;i<256;i++) {wc[0]=i+256*nalph2; GetTextExtentPoint32W(dc,wc,1,&K[i]);}
for(k=j=1,i=0;i<256;i++) {k=max(k,short(K[i].cx)); j=max(j,short(K[i].cy));}
h=short(.9*min(dj,j*di/double(k)));
yaf=CreateFont(h,0,0,0,LF.lfWeight,LF.lfItalic,0,0,1,0,0,0,FF_DONTCARE,font);
zaf=CreateFont(int(dj*.4/(p1616?1:4)),0,0,0,LF.lfWeight,LF.lfItalic,0,0,1,0,0,0,FF_DONTCARE,font);
of=(HFONT)SelectObject(dc,zaf); COLORREF oldpen=SetTextColor(dc,RGB(255,0,0));
for(j=0;j<J;j++) for(i=0;i<I;i++) if(m=i+j*I+256*nalph2,n=spec[m],n) {
alphnote(dc,i,j,di,dj,n,n+18);}
SetTextColor(dc,oldpen); SelectObject(dc,yaf);
for(j=0;j<J;j++) for(i=0;i<I;i++) if(m=i+j*I+256*nalph2,n=spec[m],!n) {
wc[0]=i+j*I+256*nalph2; TextOutW(dc,i*di+2,j*dj+2,wc,1);}
SelectObject(dc,of); DeleteObject(yaf); DeleteObject(zaf);
for(j=1;j<=J;j++) Line(dc,0,j*dj,I*di,j*dj);
for(i=1;i<=I;i++) Line(dc,i*di,0,i*di,J*dj);}
In CreateFont, the 4th arg is "The angle, in tenths of degrees, between each character's base line and the x-axis of the device.": here, correctly 0.
TextOutW(dc,i*di+2,j*dj+2,wc,1); prints the character.
Is "@Arial Unicode MS" a very new font with internal features that older write-text functions such as CreateFont and TextOutW do not handle properly? This trouble does not happen with my Windows Vista's default font.
|
|
|
|
|
Well, you have put this code extract between 'pre' tags but it is so badly formatted and spaced as to be virtually unreadable. You could start by reformatting such that each statement is on its own source line, and the code is correctly indented.
As I have stated before you need to use the debugger to isolate the point at which the particular character is being rendered, and capture the font that is being used at that point in order to give a clue as to which statement may be at fault.
For example in the statement:
zaf=CreateFont(int(dj*.4/(p1616?1:4)),0,0,0,LF.lfWeight,LF.lfItalic,0,0,1,0,0,0,FF_DONTCARE,font);
what are the values of dj, p1616, and font? Are they as expected by you and if not what values should they contain?
|
|
|
|
|
I have been testing and looking through the program, and this fault only seems to happen with fonts whose names start with a @ character: @Arial Unicode MS, @Batang, etc.
The "set orientation" parameter when I call CreateFont(), is set as the numeric constant 0:
yaf=CreateFont(h,0,0,0,LF.lfWeight,LF.lfItalic,0,0,1,0,0,0,FF_DONTCARE,font); // h = desired font size, font is a string containing the name of the font to be used
|
|
|
|
|
There are actually two issues here:
1. You are displaying Unicode characters in the range 0x2100 to 0x21FF in your sample (linked to in first article), which may or may not be correct.
2. Font names beginning with @ are designed for vertical characters so will be rotated in 'normal' orientation. I admit this information was not easy to discover - but I managed using Google and MSDN.
I was able to verify all of this by a very simple test program without all the convoluted function calls and parameters in your sample code.
modified on Wednesday, September 2, 2009 11:13 AM
|
|
|
|
|
Curiouser and curiouser. My program discussed here: its font selector lists these fonts:
* "@Arial Unicode MS", which shows the affected characters rotated 90deg anticlockwise;
* "Arial Unicode MS", which looks the same but shows the affected characters the right way up.
Are these two distinct fonts, or is there some strange system effect here?
|
|
|
|
|