|
If you goto the code in ViewPrnt.cpp lines 131 onwards, you can get a copy of the default MFC OnFilePrint() function. Copy this and paste it into your overriden OnFilePrint() function of your view class. You can then mode the code so that it prints directly to a file and deosn't request a filename from the user.
Roger Allen
Sonork 100.10016
I think I need a new quote, I am on the prowl, so look out for a soft cute furry looking animal, which is really a Hippo in disguise. Its probably me.
|
|
|
|
|
I have added a menu to my Dialog based app. I wanted to be able to set check marks based on a bool. So what I did was Added functionality to UPDATE_COMMAND_UI. I then call pCmdUI->SetCheck( m_bTest ? 1 : 0 ). I expect that when the bool value changes the check comes and goes. But alas this is NOT the case. Whatever I am not doing also causes all other pCmdUI-> commands to fail. Is this something that cannot be done in a dialog app? I think not. I just don't know what I am forgetting. It looks like the second least talked about item is menues, second to printing. Oh, I know the functions are being called, at least the UPDATE_COMMAND_UI is, based on MessageBox(""); So what ever I am missing has something to do with updating the menu. I have looked at examples and cannot find anything wrong with my function calls. ANY help is apreciated.
Darroll Walsh
Not one person lives in the present. Only the past. I can prove it. Just ask.
|
|
|
|
|
UPDATE_COMMAND_UI is not working in dialogs by default. I can not think of why MS did disable their control updating system in dialogs, but well - there are a lot of weird design flaws in MFC.
What I do im my dialogs (modal in a Doc/view-application, but should also work for dialog-based app) is to handle WM_KIKIDLE:
//called by MFC if 'nothing else to do'.
//Used to send a UPDATE COMMAND_UI-Message to all controls
// thereby simulating the menu-update system via UPDATE_COMMAND_UI messages
// Reference: Paul DiLascia in C++Q&A column
LRESULT CAdvProcDlg::OnKickIdle(WPARAM, LPARAM)
{
UpdateDialogControls(this, false);
return 0;
}
This is working like a charm. Some people complain about using up the processor, but I cant see it.
Hope this helps
|
|
|
|
|
OK I handle the ON_KICKIDLE. But the pCmdUI functions still fail to do anything.
Can I handle a dialog app menu in UPDATE_COMMAND_UI or do I manually need to retrieve the menu with a CMenu class? I hope not.
Thanks for the help.
Darroll
|
|
|
|
|
Maybe you find better help here.[^]
|
|
|
|
|
I have a problem with the position of the toolbars. For a better discription, open wordpad. Dock the toolbars side by side so that they both are in the same row. Now resize the main frame window so that to reduce the size from the right side to the left. Reduce to the smallest possible horizontal width. Notice that the second toolbar that you docked on the right of the first one has moved down. Now resize to increase the size. Notice that the toolbar is NOT moved back to right of the first toolbar. i.e. to its original position before reducing size.
I need to reposition it when the size is increased. Also, I need the docking support on all sides of frame, dynamic size and dock state toggle on double click, so simple rebar cannot be used.
MS Office uses the msoCommandBar which does all the desired, but i cant use it as i dont have its class, control or documentation.
The environment I am using is Visual C++ 6.0 with sp5.
The "Best" is what you can never achieve.
|
|
|
|
|
Hi Everyone:
I try to explan folows,and please help me to judge if it is correct or not.
<hr>
SetWindowOrgEx(hdc,0,50,NULL);
->map the logical point (0,50) to the device point (0,0)
-><a href="http://mail.ntust.edu.tw/~B9007036/Q_1.gif" target="_blank">result</a>
SetViewportOrgEx(hdc,0,50,NULL);
->map the logical point (0,0) to the device point (0,50)
-><a href="http://mail.ntust.edu.tw/~B9007036/Q_2.gif" target="_blank">result</a>
<hr>
But I don't know how to understand and explain when using function
"SetWindowOrgEx" and "SetViewportOrgEx" together in program like follow:
<hr>
case WM_PAINT:
hdc = BeginPaint (hwnd, &ps) ;
SetMapMode (hdc, MM_ISOTROPIC) ;
SetWindowExtEx (hdc, 276, 72, NULL) ;
SetViewportExtEx (hdc, cxClient, cyClient, NULL) ;
SetWindowOrgEx (hdc, 138, 36, NULL) ;
SetViewportOrgEx (hdc, cxClient / 2, cyClient / 2, NULL) ;
SelectObject (hdc, GetStockObject (NULL_PEN)) ;
SelectObject (hdc, hBrushRed) ;
DisplayTime (hdc, f24Hour, fSuppress) ;
EndPaint (hwnd, &ps) ;
return 0 ;
<hr>
Could someone tell me?Thanks!
The only educated men are self-educated.--J.Bennett
|
|
|
|
|
You should not use SetWindowOrgEx and SetViewportOrgEx together but one or the other! That was my first my first reaction when I look at your code and MSDN confirms it.
MSDN:Generally, you will use one function or the other, but not both. Regardless of your use
of SetWindowOrgEx and SetViewportOrgEx, the device point (0,0) is always the upper-left corner.
ÿVOTD:9 "Be happy, young man, while you are young, and let your heart give you joy in the days of your youth. Follow the ways of your heart and whatever your eyes see, but know that for all these things God will bring you to judgment." - Ecc 11:9
|
|
|
|
|
Hi.Ernest Laurentin
I have already read the MSDN that you say.But this source code named "DigClock" is written by Charles Petzold in Chapter 8 in BOOK "Programming Windows 5/e".
Code
I am very confused and curious.How do we explain when using "SetWindowOrgEx" and "SetViewportOrgEx" together.
Could someone help me?Thanks!
The only educated men are self-educated.--J.Bennett
|
|
|
|
|
Okay, for MM_ISOTROPIC, this is need since this is the only to way to map screen/viewport coordinate by yourself. This is a cool way to obtain Zooming effect for free since SetWorldTransform is not supported under Win 9x. This mode is provide for flexibility if you want to force the mapping of your drawing to a portion of the screen. In Charles Petzold example, he set the Viewport to the screen size (cxClient,cyClient) and the map the Window coordinates to 276x36. In that case all the drawing being done in the screen coordinates (276x36) will be mapped to the viewport. The trick with his code, he already calculates everything to fit his screen 6 characters + 2 colon (6x42 + 2x12 = 276!).
Hope that help!
ÿVOTD:9 "Be happy, young man, while you are young, and let your heart give you joy in the days of your youth. Follow the ways of your heart and whatever your eyes see, but know that for all these things God will bring you to judgment." - Ecc 11:9
|
|
|
|
|
Hi.
I understand what you say.But I don't explain and understand when using function "SetWindowOrgEx" and "SetViewportOrgEx" together.I have two examples using only one of them.Follows:
SetWindowOrgEx(hdc,10,10,NULL);
Illustrate
SetViewportOrgEx(hdc,10,10,NULL);
Illustrate
But how explain when using SetWindowOrgEx and SetViewportOrgEx together.I just want to know this.Thanks!
The only educated men are self-educated.--J.Bennett
|
|
|
|
|
How can I add a combo box (dropdown box) in a "CommandBand" (see article http://www.codeproject.com/ce/commandbar.asp from Bruce Hearder) or in the normal AppWiz created toolbar (=on the bottom of a pocket pc screen) in eVC++ 3.0 ???
--
Nice greets, Daniel.
|
|
|
|
|
I am looking for a thread safe container class similar to std::map. Is there any such available in standard C++ ?? If not then please tell me any such if you aware about ???
|
|
|
|
|
Standard C++ don't even mention threads.
C++ container classes should not be "thread safe" due to the inherent overhead it would create for everyone. If you want to access a container instance from multiple threads, you have to provide your own locking.
|
|
|
|
|
I like SourceSafe's file comparison feature and the way it displays differences much better than other products such as WinDiff. Unfortunately, we'll be dropping SourceSafe for something else for our next project, and we'll have to use WinDiff or whatever else we can find that does an ok job.
My question is: if I leave my copy of SourceSafe on my computer, is there a way I could somehow use the VSS protocol (or whatever else) from a program that I would write in order to use SourceSafe's file comparison feature? Would it be possible to compare two local files or would I need to add the file to SourceSafe first?
Thanks for any information you can provide!
|
|
|
|
|
if you want the best diff utility there is, get a port of unix "diff" for Win32. diff is so powerful it's almost alive.
STL is a religeon. Enquiries to Reverend Christian Graus
|
|
|
|
|
From what I remember, VSS implements a standard protocol known as RCS. So yes, with that in hands, you may get docs on how to read the VSS database by yourself.
Though chances are that in the end MS made the database proprietary for odd reasons such like security and scalability.
If you could do a diff with Araxis Merge, you would end much better I tell you.
MS quote (http://www.microsoft.com/ddk) : As of September 30, 2002, the Microsoft® Windows® 2000 DDK, the Microsoft Windows 98 DDK, and the Microsoft Windows NT® 4.0 DDK will no longer be available for purchase or download on this site. Support for development will ship at the same time as the Windows XP Service Pack 1 (SP1) release.
|
|
|
|
|
I use Windows Commander's "Compare by content" feature to compare single text files.
Pavel
Sonork 100.15206
|
|
|
|
|
|
i m having a problem in loading my customised bitmap(coloured) as cursor in my exe
i inserted a coloured bitmap in resource and & called LoadImage (...)
But did not get correct results
i can get a monochrome bitmap loaded but while loading a coloured Bitmap the function fails
Plz suggest me some solution to it
|
|
|
|
|
Hmmm! should not fail unless you not using correct parameter. Try using LR_DEFAULTCOLOR for colored bitmap or post some code with values for your LoadImage call.
I am in YYY
|
|
|
|
|
i tried it , but it didnt work
i tried it like this also
HCURSOR nCursor;
nCursor = AfxGetApp()->LoadCursor(IDC_CURSOR1);
SetCursor(nCursor);
here i created IDC_CURSOR1 as a monochrome cursor then it worked but when i created a coloured corsor it didnt work
|
|
|
|
|
Is an icon just a bitmap file of a certain size and color depth? The reason I'm asking is cuz I have Paint Shop Pro and it won't open up an .ico file for editing.
Was wondering if I could take a bitmap file and scale it down to the size of an icon but if it's a different format I'd need to know that. If it isn't then I can just save it as a bitmap and rename it to .ico extension.
|
|
|
|
|
VC+ 6 will edit icons. The difference is they have areas which take on the background color an areas which are transparent, but I think they are essentially a bmp.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002
|
|
|
|
|