|
|
|
Hi there
In C# is a method WriteLine in Debug class. How can I do that in a MFC win32 application.
|
|
|
|
|
duta wrote: How can I do that in a MFC win32 application.
Assuming a non-GUI application, try WriteConsole() or WriteConsoleOutput() .
If, however, you are referring to the debug window within the IDE, check out TRACE() .
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
first of all, it seems that you don't exactly know what you're talking about :
duta wrote: in a MFC win32 application
even though MFC is built upon Win32, an application is either MFC or Win32, not both.
moreover, even though it is possible to have a console in a MFC program, it is a framework designed for window oriented applications.
so to reply, but not to you exact question, you still can always use the C++ mechanisms to output to the standard stream :
std::cout << "Hello World !";
|
|
|
|
|
Actually that's not entirely correct. You can change your linker settings from /subsystem:WINDOWS to /subsystem:CONSOLE and you will get a console.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
VCF Blog
|
|
|
|
|
that's why i said "even though it is possible to have a console in a MFC program", but i felt the post owner wasn't that far in learning C++/MFC...
|
|
|
|
|
Damn you got me! Helps to read all the way to the end!
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
VCF Blog
|
|
|
|
|
many thx for your posts.
I've tried to switch to system:/console but I have this error:
error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
|
|
|
|
|
duta wrote: error LNK2019: unresolved external symbol _main...
So do you have a main() function?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
it's about a GUI using MFC.
I'm new in the field and I wish to learn. I need so see/write some variables but without using a label.
|
|
|
|
|
I find it. It's about TRACE()
I'm new and main problem is because I don't know how to use MSDN efficiently.
|
|
|
|
|
Dear Friends,
I need a progress bar which should have two values. Target and Actual. both values should be drawn on the same ctrl.
Like below
........Actual......[Target]
I already have used CMacProgressCtrl to display one value. Now i have to change it. can anybody help me out.
|
|
|
|
|
A very easy solution is to put a static control right above your progress control that indicates what 100% is. If you want to actually write on the progress control, however, you'll need to look at creating your own. Source code is plentiful, here for example.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hello!
I have a Win32 application and I would like to retrieve the command line arguments passed to another application. I'm actually trying to get the command line arguments used to start each instance of svchost.exe.
Is there an API for this or do I have to implement a complex machanism? I thought of OpenProcess and different "query process information" functions after that but I could not find any solution... Can anyone help?
Thanks in advance!
|
|
|
|
|
Here is one example.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Getting these compile errors
Linking...
MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _free already defined in libc.lib(free.obj)
MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _malloc already defined in libc.lib(malloc.obj)
I typed in NODEFAULTLIB:library
based on this warning
defaultlib "MSVCRTD" conflicts with use of other libs; use /NODEFAULTLIB:library
but it didnt resolve the problem.
thanks,
sb
|
|
|
|
|
Did you try google[^] ? There's a lot of similar questions...
Check also MSDN[^] (although it might be a bit different).
|
|
|
|
|
I suspect it's because free() and malloc() are already defined in libc.lib...
|
|
|
|
|
Hi,
i have got the following questin:
I have a SDI Project with a RichTextControl and an editbox in the toolbar.
I want to pass the value in the editboc(user input) to a funktion in the document.cpp.
I want to load some data in the document and then i want to update te view with this datas.
I know how to update the view with datas coming fram the document, but i don't know the right way to pass a value from the editbox in my toolbar to the document !!!???
Here is some code :
BOOL NEW_cToolBar::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message == WM_KEYDOWN && VK_RETURN == pMsg->wParam)
{
return TRUE;
}
else if (pMsg->message == WM_KEYUP && VK_RETURN == pMsg->wParam)
{
CString chrBuf;
m_Ctrl_EDIT.GetWindowText(chrBuf);
return TRUE;
}
return false;
}
void CApplicationView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
CTheReaderDoc *pDoc = GetDocument ();
CRichEditCtrl &rCtrl = GetRichEditCtrl();
rCtrl.SetWindowText (pDoc->m_cstrAusgabe);
rCtrl.SetFont(pDoc->m_ptrFont);
rCtrl.SetModify(TRUE);
}
Or is it better to pass the Value directly to the View without using a document ?
And when yes, how can I do that ?
Please help me !
Many thanx
Croc
|
|
|
|
|
You have loads of ways to do this, really, depending on your application.
What it looks like you should do is have a function in your document, eg:?
BOOL CMyDoc::UpdateSomeTextField (CString s)
{
if ( !some validation here )
return FALSE;
m_KeepString = s;
UpdateAllViews (NULL);
return TRUE;
}
and in your PreTranslateMessage function, call this member function. This will decouple your document from the toolbar, and remove the view from the equation.
Also, CFrameWnd has a function GetActiveDocument which will be a bit safer for you - and may make it easier when you move to an MDI model (if you choose).
Iain.
Iain Clarke appears because CPallini still cares.
|
|
|
|
|
Hi Mr.Clarke,
thank you very much for your reply.
I added this to the document.h:
.
.
.
.
public:
CString m_KeepString;
public:
BOOL bUpdatetextField(CString);
And this in the document.cpp:
BOOL CDocumentDoc::bUpdatetextField(CString s)
{
m_KeepString = s;
UpdateAllViews(NULL);
return TRUE;
}
But how can I call the bUpdatetextFiled from my toolbar :
BOOL New_cToolBar::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message == WM_KEYDOWN && VK_RETURN == pMsg->wParam)
{
return TRUE;
}
else if (pMsg->message == WM_KEYUP && VK_RETURN == pMsg->wParam)
{
????????? function call ???????????
return TRUE;
}
return false;
}
Many many thx
best regards croc
|
|
|
|
|
Hi ;
is there really no hope
best regards
CrocodileBuck
|
|
|
|
|
Err, some of us go home, and have a life...
Try:
CMainFrame *pMF = STATIC_DOWNCAST(CMainFrame, AfxGetMainFrame ());
CMyDoc *pDoc = STATIC_DOWNCAST(CMyDoc, pMF->GetActiveDocument ());
pDoc->UpdateMyField (s);
And check the debugger as you go, as this is from memory.
Iain.
Iain Clarke appears because CPallini still cares.
|
|
|
|
|
Hi Mr.Clarke,
>> Err, some of us go home, and have a life...
L*O*L yeah that's absolutely corect
Many, many, many thanx, now it will work ...
Thanx for your great help
very best regards
Croc
P.S.: Instead of AfxGetMainFrame() i have to use AfxGetMainWnd()
|
|
|
|