7 Urgent VC++ questions
Posted on 1997-11-06
I am developing a "map" system with VC++ 5.0 under Win95: Using client window to display a map, including streets and crosses and etc. I met some basic problems but don't know how to solve.
Background: This application is a multi-windows one. In the default child window, I embed a CFormView class ( a dialog) to display some parameters to let user to select sth.: which
county and districts etc. After selecting them, click a "View Map" button on this dialog or the same function button in Toolbar, another child window will be created to display the map. I use a CMDIChildWnd Class, say "MapChild" to create the map child windows and within this class, I program some functions: ZoomIn, ZoomOut, Move Map, Center Map and etc.
1. I can't print the map with a printer. The "File->Print" didn't work at all. Then, from the help, I know that only CView Class can use the "File->Print". So I try test the print in CFormView dialog, however, even in the CFormVeiw class, I can't print the dialog with parameters. Only the origial child window created by APP Wizard can be printed. However, it is a blank window-nothing can be seen.
I hope to print the map. Then, I try to create the map child window by a CView class, say "MapChildView". Then, I moved all functions in "MapChild" (Zoomin, zoomout and etc.) to "MapChildView". Then, not only I can't print the map either, I can't make the "zoomin, zoomout etc." work in both "MapChild" and "MapChildView". How to print the map while I can also use those functions"
2. When I maximize the "Map Child Window", the title bar disappeared: I can't see its title, the small icon in the left-top corner, and the minimum & maximum & close button in the right-top corner. In order to access other child windows, I have to use "Windows->Tile(or cascade") to make the map window smaller. Why? How to solve?
3. When I exit the application by "File->exit" or just click the close button in the parent window, the applicaiton is still in RAM, i.e., when I press "Ctrl+Alt+Del" to run the "close program", I can still see the map application name in the task list. So, if I build the application within VC++ complier again, it will display "Can't link map.exe" or "map.exe is in use". Anyway, I can't delete "map.exe" or move it--the application is just like being run, although I can't see the interface and access the program--because I have closed it and exit the applicatoin!
4. How to make the buttons in toolbar as switches? i.e., when I click the button in toolbar once, the button can keep down; click again, it go up. In which class I should implement it and call which function?
5. How to make the command in the the menu be checked or unchecked?
6. I use "pDC->DrawDragRect(lpRect, size, lpRectLast, sizeLast, NULL, NULL ); " to draw move dynamic rectangle ( in Zoomin, select a rectangle to expand), but no rectangle was drawed. How to do that?
7. I want to copy a complicate dialog from another application to this one, but it seems that the dialog in resource file "*.rc" can not be copy as a whole. Now, I can only copy "static" to "static", a "radio" to "radio" and etc. instead of copy a whole dialog to a dialog. You know, that will be tiresome. How can I copy a dialog as a whole?
My job was stuck here. Could you help me? Thank you very much!