|
When using laser printer to print, there is always a margin on the paper.
How to get the size of the margin?
How to ignore the margin, i mean, make my print CDC full scaled to the paper. In other way, which function in MFC printing is to set the printing CDC size.
Thanks!
|
|
|
|
|
Hi eveeryone,
I'm creating scheduling app like MS Outlook. I need some tip or algorithm for arranging events in timeline without overlaping like Outlook does.
Best regards,
Alex
|
|
|
|
|
When I use the API in a DLL project, I got an error:
HANDLE hPrinter = NULL;<br />
PDEVMODE pDevMode = NULL;<br />
char szPrinter = {"HP LaserJet 9050 PCL 6"};<br />
<br />
BOOL bOpen = ::OpenPrinter(szPrinter, &hPrinter, NULL);<br />
if (!bOpen || hPrinter == NULL) return;<br />
<br />
long nSize = ::DocumentProperties(NULL, hPrinter, szPrinter, NULL, NULL, 0);
DWORD dwErr = GetLastError();<br />
if (nSize < 0)<br />
{<br />
::ClosePrinter(hPrinter);<br />
return;<br />
}<br />
<br />
pDevMode = (PDEVMODE)new char[nSize];<br />
if (pBuffer == NULL)<br />
{<br />
::ClosePrinter(hPrinter);<br />
return;<br />
}<br />
<br />
memset(pBuffer, 0, LENGTH_DEVMODE);<br />
long nReturn = ::DocumentProperties(NULL, hPrinter, szPrinter, pDevMode, NULL, DM_OUT_BUFFER);<br />
::ClosePrinter(hPrinter);<br />
if (nReturn < 0)
return;
1.On Windows XP system:
if nSize = 6132, the last error will be 0, and print will succeed.
if nSize = -1, the last error will be 1114, and print will fail.
After "DocumentProperties()", the last error maybe 0 and sometimes maybe 1114. 0 means success while 1114 means "A dynamic link library (DLL) initialization routine failed".
2.On Windows 2000 professional I never got the error.
How can I avoid to fail to print?
|
|
|
|
|
baogangfeng wrote:
On Windows XP system, sometimes the value of nSize(size of the buffer) is -1...
You should be calling GetLastError() to find out why.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Yes, I have done so.
1.On Windows XP system:
if nSize = 6132, error will be 0, and print will succeed.
if nSize = -1, error will be 1114, and print will fail.
After "DocumentProperties()", the last error maybe 0 and sometimes maybe 1114. 0 means success while 1114 means "A dynamic link library (DLL) initialization routine failed".
2.On Windows 2000 professional I never got the error.
What can I do?
|
|
|
|
|
hiho@ll
i'm using OnLButtonUp to get the coordinates of a mouseclick
the problem:
OnLButtonUp from MSDN: Specifies the x- and y-coordinate of the cursor. These coordinates are always relative to the upper-left corner of the window
so i thought using GetWindowRect and just adding the values point.x+=rect.left AND point.y+=rect.top will convert the relative coordinates to absolute
the problem is
for example if my window is in the middle of the screen and i click on the top of the screen (the absolute y position should be between 0 or 10)
i get an relative point.y coordinate -22!!!!
which means i clicked 22 pixel above my window? but i clicked a few hundred pixels above my window!
so how can i convert the relative coordinates to absolute?
|
|
|
|
|
I think you need to be using ClientToScreen. For example:
CPoint ptScreen = point;<br />
ClientToScreen (&ptScreen);<br />
Hope that helps, 'bod.
|
|
|
|
|
|
ThinkingPrometheus wrote:
so how can i convert the relative coordinates to absolute?
Use Api ScreenToClient() and ClientToScreen() , for more info consult MSDN.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
I already designed a dialog to send message to another PC using IP address.I already write the send site code but I do not know how to test it. Izit using cable to connect or...... can someone help me..
|
|
|
|
|
Hello,
You can create a stub process that listens on the port you send the data to. This stub process verifies a certain byte order to arrive.
On your dialog side, determine which data you want to send. This data will be verified by the stub process.
The two processes can only be on the same machine if you send on a different port than the stub process recieves.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
there's no need to connect another PC to test a dialog between two processes (one client and one server). you can just use the local loop :
127.0.0.1 or \\localhost
cheers,
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Thank God you posted this. Telling someone to create a stub process to test an ip app. I was going to flip if someone had not posted something as simple as testing on the same pc using the localhost.
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
I do not know how to use the local loop. How to create a stub process and what is stub?
|
|
|
|
|
your server and you client are supposed to discuss through by IP network, aren't they ?
so, instead of using two distinct computer to be able to test, you use the internal IP address, which is 127.0.0.1 .
this works on every machine because it is defined in the IP Protocol standard. this particuliar Address is also recognized under localhost host name, and that's what's been call the local loop.
so, to test your programs, just put them on the same machine, start the server to listen on the localhost on the port it has to, and then run the client(s) which have to connect to the server on its ip address (locahost again)...
understand better now ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
in trying to use the wave class in a program, i had this error message.
I need help on how to resolve it. Thanks
error LNK2001: unresolved external symbol "public: struct tWAVEFORMATEX __thiscall CWave::GetFormat(void)const " (?GetFormat@CWave@@QBE?AUtWAVEFORMATEX@@XZ)
|
|
|
|
|
You probably need to add a source file to your project that will be compiled along with your code or you have to link to a library (see the linker settings).
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
or just missed the header to include...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
This would have caused a compiler, not linker, error.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
hum, yes, you're right... sorry
(5 for you )
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Make sure you are including the appropriate .lib file in your Imports
|
|
|
|
|
there's no nee to say again what's been posted just before you...
read the answers before posting a response.
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
when we compile & making exe is has no error. but when executing it gives error assertion failed.
plz will u give code for transfer file using tcp from one pc to another in vc++.
|
|
|
|
|
manishgandhi wrote:
plz will u give code for transfer file using tcp from one pc to another in vc++.
File Transfer [^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
manishgandhi wrote:
...it gives error assertion failed.
This is not a whole lot to go on. Perhaps you could provide the code snippet that caused the assertion to fire.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|