|
willbin wrote: And we really want to know what leads to the HIGH CPU USAGE?
When your code does stuff, that's all.
willbin wrote: I just consider the large amount of user objects occupies the CPU.
No - why would it ? They occupy memory. The CPU is occupied if stuff is being done, not if stuff is in memory.
Does your project have many threads ? If not, then something must be seriously wrong if your CPU maxes out when you're not doing anything. Otherwise, you have active threads, you need to work out why and if you can change that.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Christian Graus wrote: Otherwise, you have active threads
yes.There is a timer event in the project. I removed the timer, the CPU Usage is reduced.
THANKS Christian.
//////////////////////////////
|
|
|
|
|
Hi all,
Anyone experienced with MS RTC Client API?
I came accross the following issue:
Developed a server APP where each client is initialized with InitializeEx(RTCIF_DISABLE_MEDIA). Then I connect with office communicator using account A on the same backend LCS instance.
When I send a message from A (office communicator) to any account B connected with my APP, office comm complains "The following message could not be sent...".
MSDN says I sould answer to incoming sessions of type APPLICATION with pSession->AnswerWithSessionDescription();
I used code like this:
<br />
HRESULT OnRTCSessionStateChangeEvent(IRTCSessionStateChangeEvent2* pEvent)<br />
{<br />
RTC_SESSION_TYPE enType;<br />
RTC_SESSION_STATE enState;<br />
<br />
IRTCSession2* pSession;<br />
pEvent->get_Session(&pSession);<br />
<br />
pSession->get_State(&enState);<br />
pSession->get_Type(&enType);<br />
<br />
if (enType == RTCST_APPLICATION && enState == RTCSS_INCOMING)<br />
{<br />
BSTR type, desc;<br />
pSession->GetRemoteSessionDescription(&type,&desc);<br />
pSession->AnswerWithSessionDescription(type,desc);<br />
SysFreeString(type);<br />
SysFreeString(desc);<br />
}<br />
if (enState == RTCSS_CONNECTED)<br />
{<br />
}<br />
else<br />
{<br />
pSession->Release();<br />
}<br />
}<br />
Some more thoughts:
1) With the above code I cannot use pSession->SendMessage(NULL, myMsg, 0). It fails with error code INVALID SESSION STATE. I am interested only in IM kind of communication, not in media exchange
2) How can I detect more info about an incoming session. The desc variable above only contains some SDP data, nothing about who (WHAT APPLICATION) originated the request
Any help wpuld be appreciated. Thanks
Cristi
Discover beauty in whatever you're doing
|
|
|
|
|
I have an application displaying an activex component which is in vc++. The component contains some tooltips which need to be printed. The tooltips are created using the CWindow class which takes in the class name in the ctor as TOOLTIPS_CLASS. Is it possible to print the tooltips?
|
|
|
|
|
|
Hi,
how to identify dbf version dbase II,dbase III,dbase IV. before open the database using CDaoDatabase member Open(). Any one help me out.
Thanks In Advance!
Have A Nice Day!
Murali.M
|
|
|
|
|
Here's a description for what the dBASE II file format looks like: http://www.clicketyclick.dk/databases/xbase/format/db2_dbf.html#DBII[^]
The first field in the header is the version field. For dBASE II it's apparently a 2. I'm willing to bet money that the field is 3 for dBASE III, and 4 for dBASE IV. You can always verify this by examining files you have.
Basically, all you have to do is to read the first byte of the file, and inspect its value!
--
Verletzen zerfetzen zersetzen zerstören
Doch es darf nicht mir gehören
Ich muss zerstören
|
|
|
|
|
Dear All,
I am working with Registry entries. i am calling this fn RegEnumValue inside while loop until it retuns ERROR_NO_MORE_ITEMS. Index value is incermented in each iteration. still ..
here the function RegEnumValue is returning the same valuename record again and again.
Help me that how to read all valuename records?
thanks.
|
|
|
|
|
Can you post code, what you have tried?
|
|
|
|
|
Here it is .,
do{
Err=RegEnumValue(Root1,Cnt++,ValName,&nCnt,NULL,NULL,Buffer,&BufferSize);
if(MemberVariable==ValName){
RegSetValueEx(Root1,ValName,0,REG_SZ,(BYTE*)&MemberValue,MemberValue.GetLength());
}
nCnt=10;
}while(Err!=ERROR_NO_MORE_ITEMS);
|
|
|
|
|
Sakthiu wrote: Err=RegEnumValue(Root1,Cnt++,ValName,&nCnt,NULL,NULL,Buffer,&BufferSize);
modify it to,
Err=RegEnumValue(Root1,Cnt,ValName,&nCnt,NULL,NULL,Buffer,&BufferSize);
Cnt++;
|
|
|
|
|
I would advise you to use two loops. MSDN states that the registry should not be modified while enumerating values. Although your code works now, microsoft may release a patch/update that will prevent it from working later.
Use the first loop to build an array of the keys to be modified, and use the second loop to go through this array updating your values.
|
|
|
|
|
I have also found that it helps to reset the BufferSize parameter to actual buffer size on each iteration. It is an IN/OUT parameter, so it gets messed up each iteration.
Any sufficiently gross incompetence is nearly indistinguishable from malice.
|
|
|
|
|
DWORD dwIndex=0;
TCHAR lpValueName[MAX_PATH]={0};
TCHAR lpValue[MAX_PATH]={0};
BYTE lpData[MAX_PATH]={0};
long lEnumFlag=ERROR_SUCCESS;
MapIDToValue mapIdToValues;
while(lEnumFlag==ERROR_SUCCESS)
{
DWORD dwValueName=MAX_PATH,dwData=MAX_PATH;
lEnumFlag=RegEnumValue(hRegKey.m_hKey,
dwIndex,
lpValueName,
&dwValueName,
NULL,
NULL,
lpData,
&dwData);
if(lEnumFlag==ERROR_SUCCESS)
{
long lID=_ttol(lpValueName);
lstrcpy(lpValue,(const TCHAR*)lpData);
mapIdToValues.insert(MapIDToValue::value_type(lID,lpValue));
dwIndex++;
}
}
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
map-mode for CView DC is default (MM_TEXT), for printer is:
//-------------------------
int iMapMode=dc.SetMapMode(MM_ANISOTROPIC);
const int iLogX=dc.GetDeviceCaps(LOGPIXELSX);
const int iLogY=dc.GetDeviceCaps(LOGPIXELSY);
dc.SetViewportExt(iLogX,iLogY);
dc.SetWindowExt(100,100);
//-------------------------
lfHeight of LOGFONT is -11.
after the LOGFONT has been selected to DCs, I use GetTextExtent() function to obtain text's height.
for CView DC, text height is 14.
for printer DC, text height is 12.
how to change lfHeight of LOGFONT to keep same height for text in both CView and printer DCs?
|
|
|
|
|
Your text height is being scaled based on your window/viewport settings.
You've hardcoded 100,100 for the window extent so I guess you can adjust those up or down until
GetTextExtent() returns equal values for both DCs.
Why do you think they should be equal?
Mark
|
|
|
|
|
Hi all,
How can I add My own control , say a combo box one print preview controll bar.
In print preview control bar we have by default 7 buttons , they are Print,Next Page,Prev Page,Two Page,Zoom In,Zoom Out, Close .
I need to put my own controll, say a combo box along with the 7 button I have mentioned above, How it is possible .
Please Help me.
Thanks in Advance.
George K Jolly
|
|
|
|
|
Do you have MSN?
I want to have many friends
|
|
|
|
|
Hi All,
I m creating a MFC Dll -> Regular Dll with statically linked MFC.
In this Dll project, I have a Dialog Box. I tried to create a Web Browser on this dialog box in two ways:
1: Insert ActiveX control
2: Using CHtmlView class
In both cases, I failed. No compilation err generates.But,
--->> If I use first way (Web Browser Control) even dialog box not created.
--->> If I create CHtmlView object at runtime using Create(..) function, Assertion Faied err generates when I call Create function for CHtmlView object.
CODE IS AS BELOW:
/*********************************************/
//Global function in DLL App class #####################
BOOL __stdcall ShowFiles()
{
CDlg dlg;
dlg.DoModal();
return TRUE;
}
/*********************************************/
/*********************************************/
//In Dialog class ###############################
BOOL CDlg::OnInitDialog()
{
CDialog::OnInitDialog();
CRect rect;
GetWindowRect(&rect);
//m_View declared in .h file
m_View.MoveWindow(&rect);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
int CDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDialog::OnCreate(lpCreateStruct) == -1)
return -1;
HINSTANCE m_hInst = AfxGetResourceHandle();
TRY
{
HINSTANCE m_hInst2 = ((CDllApp*)AfxGetApp())->hI; //theApp.m_hInstance
AfxSetResourceHandle(m_hInst2);
CRect rect;
GetWindowRect(&rect);
m_View.Create(NULL,_T(""),WS_CHILD|WS_VISIBLE,rect,this,AFX_IDW_PANE_FIRST);
m_View.ShowWindow(SW_MAXIMIZE);
}
CATCH_ALL(e)
{
e->ReportError();
}
END_CATCH_ALL
AfxSetResourceHandle(m_hInst);
return 0;
}
If any one has the soultion, plz reply ASAP.
Thanks in advance,
_______________
-------//-----
//____//
//-----
____// \\
---// \\AKESH
|
|
|
|
|
Hi all,
I need to compile a file from command line and wait for its execution.
What is the method?
I tried _spawnl but its not working.
Please help me.
Regards,
Nabi
|
|
|
|
|
In C++ the easiest way is to use the system CRT function.
#include <process.h>
int main()
{
system("Notepad.exe");
return 0;
}
Steve
|
|
|
|
|
It's great.
I also have this question.
I want to have many friends
|
|
|
|
|
kevinalphaxz wrote: I want to have many friends
That's not a question!
|
|
|
|
|
if i try to include fstream.h and vector.h like this
#include <fstream.h>
#include <vector.h>
some error occured, what should i do?
|
|
|
|
|
The standard library include files don't end in ".h". Use #include <vector> instead, for example.
Steve
|
|
|
|
|