|
|
Thanks ... will have a look at it tomorrow.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Maximilien wrote:
I wanted to have the document loaded with all the views closed, and still have the "Window" ( with the new window command ) menu available.
How about the simple solution of adding the commands you want to the main menu (usually IDR_MAINFRAME)?
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Hello...
I like to support custom text printing in my application (without an edit control)...
The wtl examples that i found at codeproject only support text printing with edit controls...
I implemented the CPrintJobInfo class but unfortunely when it draw the text to the dc (in the PrintPage method) it only print the first drawing operation...
For example .:
bool CMainFrame::PrintPage(UINT nPage, HDC hDC)
{
CDCHandle dc = hDC;
CString text = _T("A Test");
dc.TextOut(0,0,text,text.GetLength()); // This text is only visible on page
dc.TextOut(0,20,text,text.GetLength());
dc.TextOut(0,40,text,text.GetLength());
return true;
}
I hope anybody can help me ...
|
|
|
|
|
Ehmmm... I have found the bug or better my own mistake...
I forget the different resolutions between the screen and printer dc...
The distance between the 3 strings was to small to see them completly...
For example.:
dc.TextOut(0,0,text,text.GetLength());
dc.TextOut(0,400,text,text.GetLength());
dc.TextOut(0,800,text,text.GetLength());
woks...
|
|
|
|
|
I am new to MFC and I am trying to make a program that can input data in Edit boxes and then be able to save it.... I am using the CFormView class..
I add my edit box- example: m_first_name and it adds the
IDD_Text(PDX,FNAME,m_first_name)
My question is how do I get the data in that edit box to my CDocument class to serialize and save it?
void CExampleDoc::Serialize(CArchive& ar)
{CObject::Serialize( ar );
if (ar.IsStoring())
{
ar<<m_first_name;
todo:="" add="" storing="" code="" here
="" }
="" else
="" {
="" ar="">>m_first_name;
// TODO: add loading code here
}
}
I know the above wont work because m_first_name is not apart of the CDoc class...
Thanks for any help given!
|
|
|
|
|
|
then add code in your View to send the data to the Doc.
I have the m_first_name in the CFormView class....
CString m_first_name ;
The problem is I am not sure how to send it to the Doc....
I have been trying to use pointers and anything that has come to mind but nothing seems to work...
Is there an example somewhere that could point me in some direction?
I am lost....
|
|
|
|
|
add a public function in your Doc, CMyDoc::SetFirstName(CString str) .
in your View:
CMyDoc *pDoc = GetDocument();
if (pDoc) pDoc->SetFirstName(m_first_Name);
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
In view in DDX.. fuction call
GetDocument()->SaveName(m_first_name)
or OnKillFocus()
GetDocument()->SaveName(m_first_name)
create respective memer in CDocument derived class add fuction which set mem var
which is comming from your View
Then do what ever you doing in Serialize.
Resume
Only pass to the document value of control which you got in view.
View has controls, document suppose to keep data from that controls.
Ok?
|
|
|
|
|
You see Cris did same think that I mean but sorter and erlyer. That means he is defenitly smarter.
))
|
|
|
|
|
Thanks for the help... I am starting to get a clear picture on how to do it...
|
|
|
|
|
Is there any easy way to create event\message maps in Visual studio 2003.I counld not find the class wizard.Any help plz.
|
|
|
|
|
The class wizard does not exist anymore in 71. You will need to map any events and messages VB-Style, via the properties window.
I Dream of Absolute Zero
|
|
|
|
|
i havent used VB, can u plz give me somelink that will help me..
Thanks
|
|
|
|
|
This[^] will explain the steps necessary.
I Dream of Absolute Zero
|
|
|
|
|
What is the definition of a smart pointer?
|
|
|
|
|
Smart pointer def[^]
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
Better read in any COM book it is very simple thing it will take 10 min to understand.
|
|
|
|
|
Per MSDN:
Smart pointers are created when you use the new #import directive to "import" a type library. When you use #import , the Visual C++ compiler reads the type library from the file you specify.
All you really need to do is to use #import and use the smart pointer types it creates for you.
Visual C++ then creates two files which it automagically #includes in your compilation. They're stored in your output directory and are named with the same base name as the type library with the extensions ".TLH" and ".TLI." For instance, our program has the #import :
#import "..\NonATLObject.tlb" and it generates two files in the output directory (DEBUG for debug builds), NonATLObject.TLH and NonATLObject.TLI.
Read more here.
While I don't provide a definition, see a small example here.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
I have an MFC .exe that makes calls into a non-MFC .dll
There is one call that i make that returns an int, but i have some COM interface error when i return.
.dll
__declspec(dllexport) int GetXMLRESPONSE()
{
int NUM = 0;
// Create XMLDOMDocument
hr = CoInitialize(NULL);
hr = pDocument.CreateInstance("Msxml2.DOMDocument.4.0");
//I do some document parsing etc here,
//Then at the end before i return i do a CoUninitialize();
CoUninitialize();
//Function blows up when i execute the return
return Num;
}
If i were to take all the COM stuf out, it returns fine. Is there something i should be doing or not doing?
|
|
|
|
|
Try just AfxOleInit instead CoInitialize/CoUnInitialize
also check S_OK == hr to find problem
|
|
|
|
|
1. It's not good for a DLL to call CoInit() - that should be the responsibility of the caller. If your function is called from a thread that is already in an apartment, your CoInit() will do nothing.
2. I'm guessing pDocument is a smart pointer. You're probably not calling Release() on it before CoUninitialize() .
--Mike--
Visual C++ MVP
LINKS~! Ericahist | 1ClickPicGrabber | NEW~! CP SearchBar v3.0 | C++ Forum FAQ
Shots do not hurt other players... yet
|
|
|
|
|
How can I get status of the queue from another thread?
I have one worker thread A and UI thread B.
Now I need in A find status of message queue of B.
Thanks.
|
|
|
|
|
Ideally, thread A should post a message to thread B asking about it's queue status. Thread B should then respond by posting a message back to thread A with the status. Make sense?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|