|
Hi All,
I need to integrate MapPoint software into my MFC database application. Basically what i want to acheive is to
get the data from the database and display it in the map. Application has to invoke the map and draw the route on it.
Any ideas will be appreciated.
Thanks,
John
|
|
|
|
|
Using the MFC AppWizard in Visual C++ 6.0 I created an SDI app with CRichEditView as the base class, and included the standard printing and print preview options. When printing or using the print preview, the text is always formatted for 8-1/2 x 11 paper oriented portrait, regardless of what is selected for these options in the print setup. For example, if landscape orientation is requested, the text is printed landscape, but it is formatted too narrow for the page, and it runs off the bottom of the page. What do I need to do so that the printable area is resized when the print setup options change?
|
|
|
|
|
Did you consider having a look in the wordpad example source?
I guess you may find it here. wordpad is yust a RichEditView.
G. Steudtel
|
|
|
|
|
I had looked at the code for the WordPad example, but I couldn't isolate the problem. I found that if I commented out the line
theApp.NotifyPrinterChanged();
from CWordPadView::OnPageSetup() it acted the same as what I have described. I can't seem to trace the cause of this behavior.
|
|
|
|
|
Hi,
the problem is not so hard to solve. You found all the footprint of the path to follow, except for the last.
If you have a close look at the source, you will find it sends a message m_nPrinterChangedMsg which will be intercepted eventually by the wordpadview class (CWordPadView).
In here a new device context for the printer is created and passed to the CRichEditView via OnPrinterChanged.
Having then a look at the help for CRichEditView::OnPrinterChanged reveals, that by default the printing will be on a paper of size 8.5" to 11".
So all you have to do, is create a printer device context, and send it to your CRichEditView.
You must destroy this printer device after printing. See CWinApp::CreatePrinterDevice .
You see, you found the place, where to start searching, and just stopped a millimeter before reaching the goal.
Never give up to early.
Regards
G. Steudtel
|
|
|
|
|
Thanks. I am new to Visual C++, so the MFC things are difficult for me to understand and trace through. I'll try to implement what you have described. Thanks again.
|
|
|
|
|
Hello,
how can I convert a CString to an int?
For char pointer strings this is easy (using the atoi function), but how to do it with CString?
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
Hi, try this
Cstring str;
str="4711";
int number = atoi(str.GetBuffer(str.GetLength()));
|
|
|
|
|
Works perfectly. Thanks!!!
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
Don't use GetBuffer() and GetLength(). just use atoi() and cast the cstring to const char * (optional)
#include <beer.h>
|
|
|
|
|
There's no need to use GetBuffer() or GetLength().
|
|
|
|
|
I normaly convert direkt too, but in a former case i had a problem with that so i thought this would be the save way
|
|
|
|
|
why not just int number = atoi(str); ?
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
|
I'm trying to adapt the size of window so it can fit with different resolutions based on the monitor size?
|
|
|
|
|
dc.GetDeviceCaps(HORZRES)
dc.GetDeviceCaps(VERTRES)
will tell you the size of the display
-c
|
|
|
|
|
Can I do the following in the OnDraw function?
CRect rc;
SystemParametersInfo(SPI_GETWORKAREA,0,rc,0);
|
|
|
|
|
yes, but don't.
OnDraw is called pretty much all the time, and you don't want to do things in the OnDraw function that will cause drawing to be required (such as resizing the window) - that leads to trouble.
-c
|
|
|
|
|
If I use this method, will it matter which function I put this in?
dc.GetDeviceCaps(HORZRES)
dc.GetDeviceCaps(VERTRES)
All I need to adapt to different resolutions is to GetDeviceCaps?
What is dc?
Thank's.
|
|
|
|
|
Hi
How can I change screen resolution or color depth(etc.) using MFC ??
Thanks
|
|
|
|
|
Search codeproject for "Easily change screen resolution".
Trust in the code Luke. Yea right!
|
|
|
|
|
I have to change the standard MFC icon located in the top left portion of the main window to another icon.
|
|
|
|
|
Simply provide a new .ICO file in the res folder.
|
|
|
|
|
I have a file which is a type Icon, I have placed that in the res folder.
Does it have to be .ICO?
Once I place the file in the res folder, how do I actually import it in my program so it replaces the IDR_MAINFRAME image of MFC?
|
|
|
|
|
Note the name of the current IDR_MAINFRAME icon (e.g., myproject.ico). Delete that file. Rename your .ICO file to the name of the old (MFC) file. Recompile.
|
|
|
|