|
This is for SDI, but can be adapted to SDI
the basic idea is to create all views and hide all but the one visible. The Doc/View architecture already takes care of managing multiple views (if used correctly)
Clickety[^]
or maybe our friend[^] can help
we are here to help each other get through this thing, whatever it is Vonnegut jr.
sighist || Agile Programming | doxygen
|
|
|
|
|
To build an MDI application with two views
1. Build an MDI application by using MFC AppWizard. AppWizard will create a skeleton MDI application with a single view.
2. Add a new class derived from the CView class.
3. Add debug and nondebug versions of the GetDocument function.
Use the GetDocument functions from your existing view class as a model.
4. Include the header file for the document class in the source file of the new view class.
5. Place the command handlers in the CChildFrame class.
It is easier to access the view or the document from CChildFrame rather than from the view class. Use the CFrameWnd::GetActiveView and CFrameWnd::GetActiveDocument functions to access the views and the document.
6. Add a handler for the OnDraw event of the new view class.
At this point, you must decide whether you want users to select the type of view at application startup, or whether you want to have your application start with a default view. In either case, the user can select another view at run time.
void CMainFrame::OnWindowItalics()
{
if (0 == m_pItalicsTemplate)
{
m_pItalicsTemplate = new CMultiDocTemplate(
IDR_XXXXTYPE,
RUNTIME_CLASS(CXXXXViewsDoc),
RUNTIME_CLASS(CChildFrame),
RUNTIME_CLASS(CItalicsView));
}
CMDIChildWnd* pActiveChild = MDIGetActive();
CDocument* pDocument;
if (NULL == pActiveChild ||
(pDocument = pActiveChild->GetActiveDocument()) == NULL)
{
TRACE0("Warning: No active document.\n");
AfxMessageBox(AFX_IDP_COMMAND_FAILURE);
return; // command failed
}
CFrameWnd* pFrame = m_pItalicsTemplate->
CreateNewFrame(pDocument, pActiveChild);
if (NULL == pFrame)
{
TRACE0("Warning: failed to create new frame.\n");
return; // command failed
}
m_pItalicsTemplate->InitialUpdateFrame(pFrame, pDocument);
}
|
|
|
|
|
After a serialization problem which occured because of changes in sp6, I now ran into another problem with regard to localized resources.
With sp5 I could create my application using US English resources in appwizard and then change into any language I wanted for any resource I needed from the properties dialog of each resource.
Now, whenever I make the change, I get garbled letters!!!
Anybody else ran into this? Any way around it?
Have no fear of perfection - You will never reach it
|
|
|
|
|
Does anyone have experience of using HP_HEADERSORTARROW? I am assuming that it should be used with DrawThemeBackground. I have found that it is not supported in any of the standard XP styles, so I am having to draw my own header arrow. Onw thing I would like to know is how to use it, so I can have code in there which uses it when available.
This though means that if the text doesn't fit next to it then the arrow draws over the top of it. I don't really want to draw anything I don't have to, ie text, background, just to get the arrow.
What I'm really after is an XP-styled sort-header control.
Any ideas?
"The way of a fool seems right to him, but a wise man listens to advice" - Proverbs 12:15 (NIV)
|
|
|
|
|
OK, I've done a bit more searching, and found out that I can use HDF_SORTUP and HDF_SORTDOWN. See this[^] and this[^].
"The way of a fool seems right to him, but a wise man listens to advice" - Proverbs 12:15 (NIV)
|
|
|
|
|
I can't seem to find an official way to add new keywords to the C++ highlighting engine. Are there any unofficial tricks you'd like to share?
--
Ich bin Joachim von Hassel, und ich bin Pilot der Bundeswehr.
Welle: Erdball - F104-G Starfighter
|
|
|
|
|
Do you mean the "User Keywords" or the standard C++ keywords?
For the former: I have a usertype.dat file in
C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE That file is just the "User Keywords", one per line. Change their syntax highlighting color via
Tools > Options > Environment > Fonts and Colors > Display items > User Keyword For the latter: I don't think that's doable.
--
The Blog: Bits and Pieces
|
|
|
|
|
Is there an easy way to determine the directory that my CWinApp is running out of?
Joel Holdsworth
|
|
|
|
|
Look at GetCurrentDirectory()
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Antony M Kancidrowski wrote:
Look at GetCurrentDirectory()
Which could be anything. There is only one CWD for the whole system and any process can change it at any time. It's never safe to assume anything about the CWD. GetModuleFileName() is what's needed here.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Sorry, I didn't read the question as what is the location of the executable.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Your answer is abs right for the problem at hand, however, the current directory is maintained for each process, not system-wide as you suggest.
HTH
Bikram Singh
|
|
|
|
|
bikram singh wrote:
...the current directory is maintained for each process, not system-wide...
Indeed. Admittedly, it has been about 11 years since I've had the need to use that particular function. Things change over time, I guess.
Further reading finds that SetCurrentDirectory() is not thread safe, but it is process safe.
Thanks,
DC
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
You need to use something like the following, which gets the full path of the executable:
CString sModulePath;
HINSTANCE hInstance = AfxGetInstanceHandle();
GetModuleFileName(hInstance, sModulePath.GetBuffer(MAX_PATH), MAX_PATH);
sModulePath.ReleaseBuffer();
You can then chop the string up using GetFullPathName()
"The way of a fool seems right to him, but a wise man listens to advice" - Proverbs 12:15 (NIV)
|
|
|
|
|
|
hai,
I am trying to develop an application,in that i am using one library file,
when i run the application ,a messagebox which is not in my application,but on the library file gets displayed,(i have no coding for that library).
how can i get rid of that messagebox.
is it possible to hide that message box in my application..
thanks a lot in reading my query,
M.Kailasam
|
|
|
|
|
Is the message box telling you anything of importance?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
if the message box is part of the normal flow of the application ( in the library ), like a Yes/No message box, I don't think you can remove it; if it's a warning/error message, maybe you need to fix the cause of the warning/error that may be in your code.
Or maybe it's a debugging message that only appears in debug mode ?
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Find that msg box with findwindow API and send WM_QUIT message to that msg box.
with regard
LegolasX
|
|
|
|
|
Thanks a lot sir,
but still i have some problems..
i wil tell in detail..
I am using a library file in my application.
code is:
m_pVax is an object to the class in the library file.its class name is "CCheck".
void CVCSampleDlg::OnButtonClick()
{
m_pVax->Checkuser("Help");
....
}
when we click that button that function "checkuser" executes it display whether it is valid or not.
now i no need to display that msgbox.
if we remove that "m_pVax->checkuser("Help")" code it shows some error msg..
so ,i have to use that function,but no need that msgbox..
can u plz help me ;
thank u ..
M.Kailasam
|
|
|
|
|
I want to setup hotkeys in my application to control vobsub to show ,hide or shift the subtitles for DivX video because the VobSub doesn't offer this service and it's not convenient to control the it by mouse. As I know ,usual hotkey software use hook API to implement such function, but I don't know VobSub's interface and don't know how to get it. I need your help!
|
|
|
|
|
For helping translation of an application, i've written an utility that compares 2 french resource (.rc) files (the previous and the last version); then only the terms that were changed or added are displayed, and one can type the translation. As translation is depending on context, i'd like to display the resource (menu or dialogbox) from which the terms to be translated come from.
I've found utilities that extract and display resources from executables or .res files, but it's not possible to control these utilities to make them display one dialogbox (for example : display dialogbox whith ID = 123).
Does someone know such an utility, or, better, how can i myself display a dialogbox from a .rc (or .res) file ?
JPG
|
|
|
|
|
Hi, I think if what you require is an way to view resources then you can do the following.
1) use FindResource/FindResourceEx to locate the required dialog box in your resource.
2) Use CreateDialogIndirect or likes to create and show an dialog box in its running condition. (Use an dummy wndproc for it).
Frm
goyalmayank@hotmail
Mayank Goyal
|
|
|
|
|
I have a phone application that sits minimized in the system tray. When the handset is lifted, I want the window to be displayed and activated.
Currently I use...
pdlg->SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE);<br />
pdlg->SetForegroundWindow();<br />
pdlg->SetFocus();
If another application is active, when I lift the handset, this code shows the window, and makes the window title bar flash, but does not grab the input focus or activate the application.
Can someone help please? TIA
I feel like I'm diagonally parked in a parallel universe
Jerry Davis
http://www.astad.org http://www.jvf.co.uk
|
|
|
|
|
try:
pdlg->ShowWindow(VALUE);
With VALUE= SW_FORCEMINIMIZE
Windows 2000/XP: Minimizes a window, even if the thread that owns the window is hung. This flag should only be used when minimizing windows from a different thread.
SW_HIDE
Hides the window and activates another window.
SW_MAXIMIZE
Maximizes the specified window.
SW_MINIMIZE
Minimizes the specified window and activates the next top-level window in the Z order.
SW_RESTORE
Activates and displays the window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when restoring a minimized window.
SW_SHOW
Activates the window and displays it in its current size and position.
SW_SHOWDEFAULT
Sets the show state based on the SW_ value specified in the STARTUPINFO structure passed to the CreateProcess function by the program that started the application.
SW_SHOWMAXIMIZED
Activates the window and displays it as a maximized window.
SW_SHOWMINIMIZED
Activates the window and displays it as a minimized window.
SW_SHOWMINNOACTIVE
Displays the window as a minimized window. This value is similar to SW_SHOWMINIMIZED, except the window is not activated.
SW_SHOWNA
Displays the window in its current size and position. This value is similar to SW_SHOW, except the window is not activated.
SW_SHOWNOACTIVATE
Displays a window in its most recent size and position. This value is similar to SW_SHOWNORMAL, except the window is not actived.
SW_SHOWNORMAL
Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when displaying the window for the first time
Maybe it helps, maybe it doesn't...
Good luck!
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|