|
Thank you for this fast answers.
@Hamid:
No, i dont have a preview.
I can't print directly to the print dc, because i don't only draw a single bitmap. The memory dc is used to draw a background and some texts. Printing this directly to the printer dc (sizes differes for each printer) needs a special calculation I don't think this could be done as good as working with a memory dc.
Drawing in tiles sounds good, but I would get the same error, or not? I also have to use 'StretchBlt()'.
Thanks
Greetings
Marco
|
|
|
|
|
I've tested printing in tiles. It doesn't work.
I think this problem realy needs to get solved by using two dc's with similar sizes.
|
|
|
|
|
You really need to lookup mapping modes in MSDN.
Lookup MM_ANISOTROPIC and MM_ISOTROPIC. Pay particular attention to CDC::SetWindowExt() and CDC::SetViewportExt() and how you setup a single DC to do all the dirty work for you.
If you are printing a bitmap, drawing primitives, text, or anything else, the mapping mode functions allow you to draw to a single DC and have the output translated to the devices coordinate system.
A world coordinate system of 2000x2000 needs to be drawn on a printer page 8 1/2 inches by 11 inches at a DPI of 1200? A screen with resolution of 1024x768? 1280x800? No problem.
You need to start thinking in terms of mapping modes and extents when you translate between different metrics or coordinate systems.
Hope that helps.
|
|
|
|
|
If I have my memory and the printer dc, do i have to setup only the printer dc (using map modes, SetWindowExt and SetViewportExt)?
Or do I have to setup my memory dc as well?
I tried thinking in terms of mapping modes and extents, but i didn't work so far (But i will try)
bob16972 wrote: A world coordinate system of 2000x2000 needs to be drawn on a printer page 8 1/2 inches by 11 inches at a DPI of 1200? A screen with resolution of 1024x768? 1280x800? No problem.
Sorry, i didn't unterstand that.
|
|
|
|
|
I found an interesting article: link
And here my code so far:
dPrintDC->SetMapMode(MM_ANISOTROPIC);<br />
<br />
dPrintDC->SetWindowOrg(0, 0);
dPrintDC->SetWindowExt(sBackgr.cx, sBackgr.cy);<br />
<br />
dPrintDC->SetViewportOrg(0, 0);
dPrintDC->SetViewportExt(rArea.Width(), rArea.Height());
'dPrintDC' is my print dc object
'sBackgr' is the size of my memory dc.
'rArea' is the rectangle of my print dc.
But 'StretchBlt()' returns the same error !?
|
|
|
|
|
Meisterzunge wrote: As msdn says, we can't use 'StretchBlt()' when the source and target dc sizes differs much.
This doesn't apply when StretchBlting from a screen-compatible memdc to a printer dc. Try StretchBlt and I think you'll get the results you're looking for.
When creating a screen-compatible memdc, you may want to give it the same ratio of width to height as a printer dc as follows:
HDC hdc = GetDC(0);
prn_dat.w = GetDeviceCaps(prn_hdc,HORZRES);
prn_dat.h = GetDeviceCaps(prn_hdc,VERTRES);
prn_dat.dw = GetDeviceCaps(hdc,LOGPIXELSX);
prn_dat.dw /= GetDeviceCaps(prn_hdc,LOGPIXELSX);
prn_dat.dh = GetDeviceCaps(hdc,LOGPIXELSY);
prn_dat.dh /= GetDeviceCaps(prn_hdc,LOGPIXELSY);
w = mulr(prn_dat.w,prn_dat.dw);
h = mulr(prn_dat.h,prn_dat.dh);
(The values in prn_dat are floating point and mulr is just my own routine for multiplication with rounding which may or may not be necessary. When you create a memdc use w,h as dimensions for the bitmap.)
|
|
|
|
|
Visual C++ 2003 MFC MDI app.
I have a docking control bar that has a tree view in it.
Is there a standard keyboard sequence to switch between the MDI views and the control bars and to switch between the control bars in a frame.
I know <ctrl> + <F6> and <ctrl> + <shift> + <F6> switch between the child panes but I can't figure out how to switch to the control bar that has the tree view in it using the keyboard.
Any ideas?
|
|
|
|
|
Hi.
In the project that I am working, I need to develop a listener that checks a folder and files.
Well, on CLIENT this listener will have detect ANY internal change in ANY file in the folder and instantly will synchronizer with SERVER, like a ShadowCopy, and different of a snapshot, for keep integrity between CLIENT-SERVER, ok?
Can anyone give me a hand? Libraries, and similar components.
I'm working in c++ builder, but visual studio components also help.
Regards,
|
|
|
|
|
Caetano.n.a wrote: In the project that I am working, I need to develop a listener that checks a folder and files.
While not a direct answer to your question, here is a brief example of FindFirstChangeNotification() . Other examples are just a click away.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi,
My client side does not wake up when I send magic packet from Server side using my application.
Though if I send magic packet using free ware utility, client side wakes up properly. What could be probable reason for this?
At client side, I'm using Windows 2000 SP4.
At server side, I'm using Windows 2003 R2.
|
|
|
|
|
I don't know the answer, but do you have checked these circumstances:
* correct port
* correct packet (each little failure will not work)
* propably the protocol ( TCP/IP or UDP )
I wish you good luck
|
|
|
|
|
Thanks for reply.
But whenever I execute Client side on Windows XP, it wakes up correctly. So i think there wont be any problem in port, protocol.
Is there any special way to handle Wake on LAN feature on Windows 2003 R2?
|
|
|
|
|
Do you mean "WOL" with starting the whole computer by LAN?
It seems that you mean something other, because WOL has nothing to do with
Windows, only with the power-supply and mainboard
|
|
|
|
|
hai friends,
my problem is like this.
in my program, (say for example) i will allow the user to select a file, any where in the computer.
now after file selection, i have to create one file in the folder, where my program is available.
i donot give any path while creation. i will simply use open(file1,write).
but this file is created, in the folder, where the selected file is available.
is there any api, which can fetch me the path of the current working folder, such that, i can save my folder there?
thanks for your views.
|
|
|
|
|
Im not sure do you need to GetModuleFileName ?
|
|
|
|
|
vov, hamid,
i tried it. it gave me the filename which iam running, like, d:\myapp\debug\myapp.exe.
this will do for me. what all i want from this string is upto debug. may be i can do some parsing logic here to remove the myapp.exe.
i would be pleased if you can suggest that for me.
got my 5?
thank you.
|
|
|
|
|
See PathRemoveFileSpec()
Real men drive manual transmission.
|
|
|
|
|
Yeah you can use of CString::Left for get full string of some strings of left.
(one thing that it doesnt relative to your answer see my thread on the lonuge I saw a good site with nice wallpaper of milky way )
|
|
|
|
|
nice of ur wallpapers.
why don't you attempt for my algorithm in corresponding forum.
|
|
|
|
|
Im sorry but I dont understand what you said?
|
|
|
|
|
i mean
please go to algorithms forum and try to attempt my post.
thanku
|
|
|
|
|
_splitpath[^] in the CRT lib.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
thanks for your reply roger.
i shall definitely look into it if all my other choices disappoint me.
|
|
|
|
|
Try GetCurrentDirectory()
|
|
|
|
|
Try with...
CString m_szNewFileName = "";
char FileName[MAX_PATH];
GetModuleFileName(NULL, FileName, MAX_PATH);
m_szNewFileName = FileName;
m_szNewFileName = m_szNewFileName.Left(m_szNewFileName.ReverseFind('\\'));
m_szNewFileName += "DesiredNewName.ext"
CFile f (m_szNewFileName, CFile::modeCreate | CFile::modeWrite);
it worked good for me.
This would create the new file in the forlder where the App.exe is.
And afterwards you can delete the file with:
if (f.Open (m_szNewFileName, CFile::modeRead))
{ f.Close ();
f.Remove (m_szNewFileName);
}
EDIT: Nice, my post is the newest one, but has the answers of the post just above (older than mine) :P
-- modified at 5:21 Monday 29th October, 2007
-- modified at 5:22 Monday 29th October, 2007
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|