|
One solution is CStdioFile.
Kuphryn
|
|
|
|
|
You need a pointer to the document template you want to open a document for. In MFC these templates are stored in a CDocManager class object pointer which is part of your CWinApp object. You could do this:
CDocManager *pDocMan = AfxGetApp()->m_pDocManager;
POSITION pos ;
pos = pDocMan->GetFirstDocPosition();
while (pos)
{
CDocTemplate *pTemplate = pDocMan->GetNextTemplate(pos);
pTemplate->OpenDocumentFile(filename); // or NULL ofr an empty document
}
I may have some of the function names wrong here as its from memory.
Roger Allen
Sonork 100.10016
In case you're worried about what's going to become of the younger generation, it's going to grow up and start worrying about the younger generation. - Roger Allen, but not me!
|
|
|
|
|
Roger has one way of doing it...
We use CWinApp::OpenDocumentFile(LPCTSTR lpszFileName). Does the same thing, but automatically.
J
May the bear never have cause to eat you.
|
|
|
|
|
I have VC++ .NET and the class wizard is not working properly. I can't add Code Project code to the application I am working on because the "add member variable" feature is always grayed when I right-click an object in the resource editor. WHY DOES IT DO THAT?! I'M ABOUT READY TO RIP MY COMPUTER APART! Please Send Help! Is it a settings problem, or just Microsoft's way of slowly driving me insane?
-- Steve
|
|
|
|
|
Make sure you have already created a class for the resource you are trying to add member variables to by double clicking on the resource your editing or right clicking and choosing "add class."
- Anatari
|
|
|
|
|
background : I need to be able to handle the close button of a miniframe window of a CControlBar; the only way ( that I Found ), is to hack it in the system with the undocumented : m_pFloatingFrameClass member of CFrameWnd :
if ( pBar )
{
if( !pBar->Create("wow", this, IDC_OBJECT_TOOLBAR) )
{
TRACE0("Failed to create object bar\n");
return -1;
}
pBar->SetBarStyle( pBar->GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC );
pBar->EnableDocking( CBRS_ALIGN_LEFT | CBRS_ALIGN_RIGHT );
EnableDocking(CBRS_ALIGN_ANY);
m_pFloatingFrameClass = RUNTIME_CLASS(FloatingBarFrame);
DockControlBar(pBar, AFX_IDW_DOCKBAR_RIGHT|AFX_IDW_DOCKBAR _LEFT);
pBar->LoadState(s);
}
this works sometimes ( and in another case ) ?!?^!^?!^!%!@@$!@#$!%
question I have, can LoadState of the CControlBar and the LoadBarState of the CFrameWnd break the m_pFloatingFrameClass ? I still don't full understand why it doesn't really work ...
Any ideas ( maybe the turkey will help ! ) ?
Thanks.
Max.
|
|
|
|
|
Well, I moved forward ... I've used this comment[^] to help with the floating minibar thing, it's a bit to much hardcoding, but at least know where everything is ...
Max.
|
|
|
|
|
hiya, how do u tab from one edit box to another edit box on a dialog program, by pressing the 'return (enter) key'??
thanks,
grahamoj.
|
|
|
|
|
you can use GetNextDlgTabItem to find the next control in the tab order. so, override OnKeyDown, when you get a VK_RETURN, find the CWnd for the control that currently has focus, then use GetNextDlgTabItem to find the 'next' control.
-c
There's one easy way to prove the effectiveness of 'letting the market decide' when it comes to environmental protection. It's spelt 'S-U-V'.
--Holgate, from Plastic
|
|
|
|
|
BOOL CYourDialog::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN)
{
CWnd *pWnd = GetFocus() ;
CEdit *pEdit = static_cast<CEdit*>(pWnd) ;
if (pEdit != NULL)
pMsg->wParam = VK_TAB ;
}
return CDialog::PreTranslateMessage(pMsg);
}
Roger Allen
Sonork 100.10016
In case you're worried about what's going to become of the younger generation, it's going to grow up and start worrying about the younger generation. - Roger Allen, but not me!
|
|
|
|
|
I'm trying to insert an object from a file into a document. How does the filename get passed to the ole server to open it up to display into the container application.
thanks
|
|
|
|
|
help me for program that a non rectangular splash screen class with Alpha blending (Article discussions)
|
|
|
|
|
The way to do this is to pop up a dialog that is not a regular shape. There are plenty of articles on the web for how to do that.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
If i for example have this string: "192,168,135,97,51,156" is it possible to split that into 6 integers containing the values delimited by the comma?
thanks all
|
|
|
|
|
strtok should do the thing ...
also, could do it by hand with CString ( and/or std::string )
Max.
|
|
|
|
|
strtok is the one, but be careful if you have "blank" tokens e.g. "1,2,3,,5".
strtok will say there are 4 values here rather than 5 (4 numbers and one blank token).
Dave.
|
|
|
|
|
Yes strtok
Cheers
Carlos Antollini.
Pi Five[^]Creator
Sonork ID 100.10529 cantollini
|
|
|
|
|
Be aware that strtok is destructive to the original string
|
|
|
|
|
Hi everybody,
How to OpenPrinter(...) for network-printer or print-server, which connected directly to lan????
Thanks,
iLYA
http://www.printsniffer.com
|
|
|
|
|
hi everyone,
how do you delete a node from a treeview control? i had a sdi, based on treeivew, and i bind double click to the node deletion command.. i tried double click on my program, but nothing happens. if i reload my program, the previously double clicked node is gone.. does treeview refreshes by itself after i ran DeleteItem() function? i've also tried running UpdateAllViews(NULL), but it causes my program to crash for some reason..
this is how i coded my OnDoubleclick()
void CmyView::OnDoubleclick(NMHDR *pNMHDR, LRESULT *pResult)
{
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*) pNMHDR;
GetTreeCtrl().DeleteItem(pNMTreeView->itemNew.hItem);
UpdateAllViews(NULL); // this line causes my program to crash
*pResult = 0;
}
|
|
|
|
|
UpdateAllViews doesn't have anything to do with your tree control not updating, so you can remove that line.
It's possible the tree control doesn't expect you to delete the node you double-clicked on in the handler for the double click notification. You could try posting a user-defined message to your view in the double click handler, and then delete the item in the handler for the user-defined message.
Software Zen: delete this;
|
|
|
|
|
hi, how do u add an item to start menu?
norm
|
|
|
|
|
The start menu is just a directory. Just put files in it example in win2000 is : /Documents and Settings/UserName/Start Menu/
|
|
|
|
|
thanks, got that one working
norm
|
|
|
|
|
Why don't you just ask "u" instead of posting a question here? I mean, how would we know what "u" does and how he/she/it does it?
|
|
|
|