|
If you just want to print the file in text format, what about using "stdprn"?
- NS -
|
|
|
|
|
USE system("print filename");
|
|
|
|
|
Hi
Using system is one of the way to handle this, but this method is not generic for other types of devices like scanner or USB stick etc.
We know that any device should be opened then read/write and finally to be closed. Can we write a C++ code to open any device and read/ write into it (e.g. printer) ?
With thanks in advance.
barun
barun
|
|
|
|
|
Hello
My code copies an exe onto a USB flash drive using normal File copy functions, however it is quite possible that the USB flash drive might get disconnected during file copy and may not be copied properly (hence gets corrupted) So, when the user plugs in the USB flash drive next time he / she wont be able to use it. Is it possible programatically to identify a corrupted exe once the exe has been copied onto the USB flash drive ?
Thanx
|
|
|
|
|
Checksumming (e.g. MD5). Tools like MD5sum are readyly available in the internet.
But the corrupted exe will very properly not start, so it can't check itself.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
Although there is no Direct way to do this, letme specify some alternatives.
1. calculate the Check sum of the File before you save and validate it after your file copy operation is complete. (Less Error prone but effective)
2.Verify the Size of the file copied.
haribabu
|
|
|
|
|
Can anybody tell me why I'm unable to step inside ntdll with the MS debugger?
I am trying to hook NtCreateSection and replace the section with my own, but I'm getting access violation return codes. So I try stepping into the mthod in order to see what is going on, but I immediatly land on a JUMP instruction and get thrown back out. The code then fails with an "unable to read this address" pop-up. Stepping over the call causes no problems.
Anyway, I have a section created from a file with the PAGE_READONLY flag set, I tried changing this to PAGE_WRITECOPY which succeeds but I'm still unable to map the section. ( No access rights ). But the section is created with ALL_ACCESS_RIGHTS.
Any ideas?
|
|
|
|
|
You can, but there won't be much to see as most of it just contains code to transition to kernel mode (where a user mode debugger can't follow).
Steve
|
|
|
|
|
Yeah, I figured that out after decompiling the dll. I never found the solution to the problem though, I have a feeling the DACL was being set high while the section was being passed between user/kernel modes, preventing me access to it.
|
|
|
|
|
|
After 4 painful days ... got it!
(to many #include in the project ... )
tnx anyway
Russell
|
|
|
|
|
After 4 painful days?? It's only been 30 mins
|
|
|
|
|
|
You should have asked in the first 30 minutes
Even though nobody answered, you would have solved it
and you could have taken 4 days off!
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
_Russell_ wrote: Why are you telling this to me only now?
To rub it in (salt in the wound), of course
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Please any one can tell me what is lfOrientation in LOGFONT structure. i can't find any visible difference by changing any values of it. output is mostly same. my code is as bellow,
for (int i=0; i<3600; i+=150) {
LOGFONT lf;
::ZeroMemory (&lf, sizeof (lf));
lf.lfHeight = 2400;
lf.lfWeight = FW_DEMIBOLD;
lf.lfEscapement = i;
lf.lfOrientation = 600; // No change of any value
::lstrcpy (lf.lfFaceName, _T ("Times New Roman"));
CFont font;
font.CreatePointFontIndirect (&lf);
CFont* pOldFont = dc.SelectObject (&font);
dc.TextOut (0, 0, CString (_T (" This is my Output")));
dc.SelectObject (pOldFont);
}
|
|
|
|
|
as far as i know, orientation refers to angle wrt. x axis.
not sure weather degrees or radians.
try it out by gradually incrementing the the values from 0 to 360 in a loop.
|
|
|
|
|
i tried it but it won't work and Angle is given by lfEscapement member of LOGFONT structure.
|
|
|
|
|
both refer to angle only but with some difference.
you can refer the following url
for more information.
http://msdn2.microsoft.com/en-us/library/2ek64h34(VS.80).aspx
|
|
|
|
|
Thnks, But still change of lfOrientation not making any difference...
|
|
|
|
|
Bhavesh Bagadiya wrote: Please any one can tell me what is lfOrientation in LOGFONT structure.
Straight from MSDN:
It specifies the angle, in tenths of degrees, between each character's base line and the x-axis of the device.
"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
|
|
|
|
|
I just did a small test, and lfOrientation does barely anything.
lfOrientation changes the angle of the whole string.
lfEscapement
Specifies the angle, in tenths of degrees, between the escapement vector and the x-axis of the device. The escapement vector is parallel to the base line of a row of text.
Windows NT/2000/XP: When the graphics mode is set to GM_ADVANCED, you can specify the escapement angle of the string independently of the orientation angle of the string's characters.
When the graphics mode is set to GM_COMPATIBLE, lfEscapement specifies both the escapement and orientation. You should set lfEscapement and lfOrientation to the same value.
Windows 95/98/Me: The lfEscapement member specifies both the escapement and orientation. You should set lfEscapement and lfOrientation to the same value
So, set both values to the same thing, Unless you want some very wacky effects under GM_ADVANCED.
I just had a play in my OnDraw method...
::SetGraphicsMode (*pDC, GM_ADVANCED);
NONCLIENTMETRICS ncm;
ncm.cbSize = sizeof (NONCLIENTMETRICS);
CString s;
s = "Hello";
ncm.lfStatusFont.lfOrientation = 450.0;
ncm.lfStatusFont.lfEscapement = -450.0;
pDC->TextOut (0,0, s);
and see the results!
One rotates the string, the other rotates individual characters.
If in doubt, do little test programs - it's the only way to learn.
Iain.
ncm.lfStatusFont.lfOrientation = 450.0;
ncm.lfStatusFont.lfEscapement = -450.0;
|
|
|
|
|
Thanks I'm really new to Visual C++ MFC Programming. so again Thanks for suggestion !!!!
|
|
|
|
|
How specify the order of files during compiling (using VS2003)?
Russell
|
|
|
|