|
My app uses a CDocument. I serialize all of my CObjects using << and >>.
I have added a CEditView and want to serialize whatever is typed into the view.
I created a sample app using CEditView and the default architecture used (CEditView*)m_listview.GetHead()->SerializeRaw(ar) to write/read the text in the CEdit view. This is no good for me since I'm writing binary with everything else that I write to the file.
Anyone know how to Serialize a CEditView as Binary?
|
|
|
|
|
Hi,
I can't seem to find how to set the transparent background for my treeview. I'm already using NM_CUSTOMDRAW to draw the items.
Any hints?
thanks!
|
|
|
|
|
Don't quote me on this, cause I'm not sure. Try SetLayeredWindowAttributes()
If I write code in my sleep, does that make me brilliant, or just a lazy programmer?
My articles
www.stillwaterexpress.com
BlackDice - the programmer formerly known as bdiamond
|
|
|
|
|
Thanks! but this function is not supported by Win8x/ME and I need something that will work with all platforms...
|
|
|
|
|
Hi All
I have an application, which I have to extend with a prining-function.
The application has two MultiDocTemplates, one on the right side, one on the left site.
+-------------------------------------+-+
|myApp |
+-------------------------------------+-+
| MultiDoc1 | MultiDoc2 |
| | - CDocument |
| | - CMDIChildWnd |
| | - CFormView |
| | |
+-----------+---------------------------+
The window (MultiDoc2: CWnd) on the right side has two splitter controls as shown here:
+---------------------------------------+
| SplitterControlTop |
| |
+---------------------------------------+
| |
| SplitterControlBottom |
| |
| |
| |
| |
| |
+---------------------------------------+
CProcessView.cpp: This is the View of the MultiDocTemplate on the right side. Here I have implemented the print function, and as you see in the function OnDraw, I can print the frame title.
...
IMPLEMENT_DYNCREATE(CProcessView, CFormView)
/**
* Standard constructor
*/
CProcessView::CProcessView()
: CFormView(CProcessView::IDD)
{
//{{AFX_DATA_INIT(CProcessView)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_hWndSubView = 0;
...
void CProcessView::OnDraw(CDC* pDC)
{
CProcessDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
pDoc->GetNextView(pos);
pDC->TextOut(20,20, pDoc->GetFrameTitle());
}
How can I now print eighter the content of the top or bottom SplitterControl?
Thanks Adrian
|
|
|
|
|
I would like my MDI application, once it started, it will automatically perform some specific tasks such as popup a dialog, run a few controls, add a record, etc. and when done automatically exit the application.
|
|
|
|
|
exit();
If I write code in my sleep, does that make me brilliant, or just a lazy programmer?
My articles
www.stillwaterexpress.com
BlackDice - the programmer formerly known as bdiamond
|
|
|
|
|
exit();
If I write code in my sleep, does that make me brilliant, or just a lazy programmer?
My articles
www.stillwaterexpress.com
BlackDice - the programmer formerly known as bdiamond
|
|
|
|
|
PostMessage(WM_CLOSE) to the main frame is what happens when you close an application manually.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I have a lot of code passing in const CString& and I am wondering, which is faster, the const CString& or else forcing the conversion to LPCTSTR and passing that as the argument. I don't even need the CString-ness of the data within the functions, just access to the raw character array. Anybody here profiled this before or looked at the assembly to know which is quicker?
|
|
|
|
|
If the routine that is being called only needs to work with the LPCTSTR and doesn't need to call GetLength, then LPCTSTR is faster. However, once you start treating string as a CString in the called routine, const CString by ref is faster. What really kills speed is just passing it by CString. Thus a copy gets created each time.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Does anybody know how to read the value DPI "Settings" displayed under
Control Panel->Display Properties->Settings->Advanced.
On a german windows installation it's called "Schriftgrad" under
Systemsteuerung->Anzeige->Einstellungen->Erweitert.
MS
|
|
|
|
|
How about from:
HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics\AppliedDPI
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
|
Guys/Gals,
I'm trying to find out how I can measure the amount of time a function takes to execute.
Somewhere along the line in my lengthy code , some function call is eating up more time that it should be.
How can I keep keep track of how long each function takes from the time it started executing to end of its execution.
Basically Im trying to figure out which part of the code is eating up the time.
Any ideas/thoughts would be greatly appriciated.
Thanks
|
|
|
|
|
You could write some trace info in your function to the file eg.:
functionname start : time
functionname end : time
Then you can find out maybe? There'll probably be a better way, but this could work.
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
|
|
|
|
|
Have you seen GetTickCount() ?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Depending on precission you may want to look at QueryPerformanceFrequency() and QueryPerformanceCounter()
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 Walliams (Little Britain)
|
|
|
|
|
Seeing as I have a small class that will give you a TRACE of the time it takes to execute I have posted it.
#if !defined(AFX_CLASSTIMER_H__FAFE8946_4D39_4CB7_921D_0202D60ABE26__INCLUDED_)
#define AFX_CLASSTIMER_H__FAFE8946_4D39_4CB7_921D_0202D60ABE26__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class AFX_EXT_CLASS CClassTimer
{
CClassTimer();
public:
CClassTimer::CClassTimer(CString sTimerName, bool bMessageBox = false);
virtual ~CClassTimer();
virtual void OutputNow(CString sOutput, bool bInterim = true);
virtual void SetStart();
virtual void SetInterim();
private:
CString m_sTimerName;
__int64 m_nTimerFrequency;
__int64 m_nStartTick;
__int64 m_nInterimTick;
bool m_bMessageBox;
};
#endif // !defined(AFX_CLASSTIMER_H__FAFE8946_4D39_4CB7_921D_0202D60ABE26__INCLUDED_)
#include "stdafx.h"
#include "ClassTimer.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
CClassTimer::CClassTimer()
{
}
CClassTimer::CClassTimer(CString sTimerName, bool bMessageBox )
: m_sTimerName(sTimerName),
m_bMessageBox(bMessageBox)
{
LARGE_INTEGER Frequency;
Frequency.QuadPart = 0;
if (!QueryPerformanceFrequency(&Frequency))
{
TRACE(_T("Failed to get the high performance counter frequency\n"));
return;
}
m_nTimerFrequency = Frequency.QuadPart;
SetStart();
}
CClassTimer::~CClassTimer()
{
OutputNow(m_sTimerName, false);
}
void CClassTimer::SetStart()
{
LARGE_INTEGER TimerTick;
VERIFY(QueryPerformanceCounter(&TimerTick));
m_nStartTick = TimerTick.QuadPart;
m_nInterimTick = m_nStartTick;
}
void CClassTimer::SetInterim()
{
LARGE_INTEGER TimerTick;
VERIFY(QueryPerformanceCounter(&TimerTick));
m_nInterimTick = TimerTick.QuadPart;
}
void CClassTimer::OutputNow(CString sOutput, bool bInterim )
{
LARGE_INTEGER TimerTick;
QueryPerformanceCounter(&TimerTick);
__int64 nStart = m_nInterimTick;
if (!bInterim)
nStart = m_nStartTick;
CString sPrompt;
sPrompt.Format("%s - %ld us\n",
sOutput,
(ULONG) ((TimerTick.QuadPart - nStart) * 1000000 / m_nTimerFrequency)
);
if (m_bMessageBox)
AfxMessageBox(sPrompt, MB_OK);
TRACE(sPrompt);
if (bInterim)
{
SetInterim();
m_nStartTick += (m_nInterimTick - TimerTick.QuadPart);
}
}
Rip out the bits that you do not like.
Basically if you create an instance of CClassTimer at the top of the function. When the function exits it will trace out how long it took.
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 Walliams (Little Britain)
|
|
|
|
|
|
As long as you can run your program in the visual studio development emvironment, why not use the Profiler? It does a better job than doing gettime(), and is really easy to use. (Look in the Help.)
But on one of my PCs at work, the profiler refuses to run for some reason.
|
|
|
|
|
Hi,
For a project I need to show scheduled items on a timeline(like a Gantt-chart)in a dialog.
I have been searching the web now for a few days but could not find anything useful.
Found only one article that could help me but the code supplied was incomplete (missing lib-file)(article "CTimelineEditor" on Codeguru, author:Jeffrey M. Barber)
Cannot believe I am the first one encountering this 'challenge'.
Can anyone please help me finding a solution for my problem?
thanks in advance,
|
|
|
|
|
I would use Chris Maunder's MFCGridCtrl class (found here on CP). It's very modifiable. I was thinking of deriving a class from it just for that purpose that could show timelines for various items.
If I write code in my sleep, does that make me brilliant, or just a lazy programmer?
My articles
www.stillwaterexpress.com
BlackDice - the programmer formerly known as bdiamond
|
|
|
|
|
Hi
What function do i need to run an exe program. I need to call another exe program from my Visual C prog.
Thanks
|
|
|
|
|
try ShellExecute()
If I write code in my sleep, does that make me brilliant, or just a lazy programmer?
My articles
www.stillwaterexpress.com
BlackDice - the programmer formerly known as bdiamond
|
|
|
|