|
Hi,
Thanks for your inputs..
Here are my answers:
Try switching the number to 500 or so, to give the CPU more time to execute other threads/programs. Or try to avoid the loop.
If I make Sleep(500), CPU time is not consumed, but the thraeding operation slows down..
Is there any other option without using sleep, to avoid eating up the CPU time.
Thanks
Madhavi
|
|
|
|
|
ledallam wrote:
During this raeding and displaying operation CPU usage is shown as 100%
its normal, if you are making a fast loop, you will end up with something like this.
if you dont want to slow the system down you may try to give that thread low priority, you will see 100% CPU usage the same way, but if some other process requests CPU time, your thread will "slow down" their work beacuse the OS will give CPU time to the process with higher priority.
|
|
|
|
|
Does anyone out there know where to start looking?
I want it fairly flexible so I can update the version and time stamp etc. for building my own custom make files from Visual C++
Cheers all,
Al.
"When I left you I was but the learner, now I am the master" - Darth Vader
|
|
|
|
|
Your question is somewhat vague. What exactly are you trying to accomplish? It hints at needing a touch utility, but I can't be for sure at this point.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
as David wrote, touch will change the date and time of a file.
normally, when a file is edited ( and saved ) , its time will automatically be modified; so no real use to modify the date itself.
or are you talking about the $Date$ or $Revision$ version control tag ?
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Hi Guys,
Thanks for replying to my message so soon. Sorry about the vague message I was just leaving work. Basically, I'm creating my own make file generator that scans the current .vcproj file for dependencies - which it does. However, I don't want it to be generating a makefile *every* time it compiles because the dependencies probably wouldn't have changed (unless a new file had been added or removed, but then it gets saved and a new time stamp), so my idea was to check if the .mak and .vcproj date and time stamps were the same, if they weren't my utility would generate the .mak file and set the date and time stamps to be the same as the .vcproj. I know I could just check if the .mak file is older than the .vcproj but I wanted proper versioning to be linked in as well and am currently extending my io class so it can do pointless things like this for any future tasks I might have . I'm using C++ (no MFC or anything) to do it, but google seems to give me a billion things I really don't want at all.
Hope you can help, thanks for taking the time to look over this message,
Al.
"When I left you I was but the learner, now I am the master" - Darth Vader
|
|
|
|
|
I eventually found this 'undocumented' function (well it is documented, but yet again its the last thing MSDN wants to pull out from its library) which does *exactly* what I want it to do. _futime(int, _utimbuf) allows you to modify the time accessed and modified of a file that you have currently loaded with a valid os descriptor handle (use _futime(char*, _utimbuf) for MFC or people who don't have an os descriptor handle - specify the filename and path of the file to change instead). The _utimbuf has two components (for access and modify sections of the file properties) that must both be valid for it to succeed. Its that easy! But yet again the absolute heap of crap that is MSDN pulls out a billion results that include everything BUT what your looking for. I only stumbled across this by complete and utter fluke. When are we gonna see a comprehensive and intelligent help engine with VS? I have .NET 2003 and its nowhere near as intelligent as Delphi v5 help engine which is now nearly 5 years old!
But at least code project is cool.
"When I left you I was but the learner, now I am the master" - Darth Vader
|
|
|
|
|
Hi,
I am new in using Visual C++ 6.0. I want to create a project which can accept Chinese Resoure file. I am trying to create a project with "Chinese as language for resource", but I don't see an option for Chinese Language. I do see "French, Germany, Italy etc...".
I appreciate if some one can help me in this.
Thanks
V V
|
|
|
|
|
I found a way to do this, so don't worry to answer this.
|
|
|
|
|
Hai,
I'm working on a C++ application.I declared two int variable as public.But when I assign those variables in one the member functions and try to use that value in the other member function, I could'nt get those values.When I debug the application I get some junk values assigned to those variables.What am I missing here?
Thanks in advance.
|
|
|
|
|
Hello,
Post some code so we can see whats going on...
Multiply it by infinity and take it beyond eternity and you'll still have no idea about what I'm talking about.
|
|
|
|
|
hai, Sorry for that..
class myclass
{
public :
int var1 ; int var2;
int cnt;
myclass(void);
myclass(int myvar);
int myfunc1();
int myfunc2();
}
myclass::myclass(void)
{ var1=0;var2=0; }
mycalss::mycalss(int myvar)
{this->cnt = myvar;}
int mycalss::myfunc1()
{
.....
var1 = 6758; //here I assign values to these variables
var2 = 674;
.....
}
int mycalss::myfunc2()
{
....
if(var1<7000 && var2> 500)/// Here I couldnt get those values that I assigned in func1()
....
}
while calling these function in main I call as
myclass myC;
myC.myfunc1();
myclass myC1(dcnt);
myC1.myfunc2();
what am I missing??
Thanks again.
|
|
|
|
|
Hello,
In your code exemple, you create 2 instances of myclass. Since the 2 variables var1 and var2 are not static, they are not shared between the 2 instances of myclass.
Exemple:
myclass A;
A.myfunc1();
myclass B;
if you declare var1 and var2 static, they'll be shared among all instances of myclass. (you can even access the value static variables without an instance of the class like this: myclass::var1!)
Hope that this will help you out.
Multiply it by infinity and take it beyond eternity and you'll still have no idea about what I'm talking about.
|
|
|
|
|
Hai,
Thanks a lot..But when I declare the var as static it gives me LNK2001 error.
ie..
error LNK2001: unresolved external symbol "public: static int mycalss::var1" (?var1@myclass@@2HA)
where I went wrong??
thanks.
|
|
|
|
|
Now that var1 is static member, how/where are you initializing it?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hai,
I did'nt change anything in the code expect for I declared the var1 & var2 as static and used them as myclass::var1 and myclass::var2 in the funcs.
what should I do?? Thanks a lot.
|
|
|
|
|
Ann66 wrote:
I did'nt change anything in the code expect for I declared the var1 & var2 as static...
My point exactly. Static member variables must be defined and initialized outside of the class declaration.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclang/html/_pluslang_static_data_members.asp
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Ya ..It worked..thanks a lot
|
|
|
|
|
Hello,
Declare your var like this:
<br />
class myclass<br />
{<br />
public:<br />
static int var1, var2;<br />
};<br />
You can access the vars like this
<br />
myclass::var1 = 1;<br />
myclass::var2 = 8457;<br />
Multiply it by infinity and take it beyond eternity and you'll still have no idea about what I'm talking about.
|
|
|
|
|
It worked..thanks a lot..
|
|
|
|
|
I'm writing some sort of firewall, using the hook driver from microsoft.
I want to take the packet received up to the user mode ap to make the filtering there, cause that way, using user mode api i can know which process is holding a connection.
I know this method will slow down the connection... but it's just an experiment
Then... I'd like to know if for every packet there's a new instance of the driver, or they're queued. cause if they are queued the method above, would be slow AND i'll miss some packets
Thank you in advance for your help
|
|
|
|
|
It depends on the type of your driver...
Yours sincerely,
Alex Bash
|
|
|
|
|
|
Hi Guys,
I have a class derived from CStatic that I used to create my own custom static display. I try to use SetBitmap to insert an image into the control as a background and then I draw the text on top of that. The problem is that sometimes the button doesn't show the image that I set into it. Sometimes it shows windows controls(minimize button, maximize button, or just garbage), but this only happens sometimes. I cannot reproduce the problem consistently so maybe I am leaking resources or something, I don't know. Here is my code. Can anyone tell what is wrong?
void CStatusDisplay::SetButton(CString cszFilename, UINT nIDResource)
{
CBitmap cbBitmap;
HBITMAP hBitmap;
HBITMAP hOldBitmap=NULL;
if(cszFilename!="")
{
if(LoadBitmapFromFile(cszFilename, cbBitmap))
{
hBitmap = (HBITMAP)cbBitmap.Detach();
hOldBitmap = SetBitmap(hBitmap);
}
else
{
AfxMessageBox("Error loading bitmap in display status");
}
}
else
{
if(cbBitmap.LoadBitmap(nIDResource))
{
hBitmap = (HBITMAP)cbBitmap.Detach();
hOldBitmap = SetBitmap(hBitmap);
}
else
{
AfxMessageBox("Error loading bitmap in display status");
}
}
if(hOldBitmap!=NULL)
DeleteObject(hOldBitmap);
}
//This gets called in OnPaint!!
void CStatusDisplay::Draw()
{
CClientDC dc(this);
CRect rect;
GetClientRect(&rect);
CMemDC2 memDC(&dc, &rect,TRUE);
//memDC.FillSolidRect(&rect, RGB(72,82,107));
//memDC.FillSolidRect(&rect, RGB(255,0,0));
DefWindowProc(WM_PAINT, (WPARAM)memDC.m_hDC, (LPARAM)0);
//add some text on top of that
CFont font;
LOGFONT lf;
memset(&lf, 0, sizeof(LOGFONT));
lf.lfHeight = m_nFontSize;
if(m_bBold)
lf.lfWeight = FW_BOLD;
if(m_bItalics)
lf.lfItalic = TRUE;
strcpy(lf.lfFaceName, m_cszFontName);
font.CreateFontIndirect(&lf);
CFont* def_font = memDC.SelectObject(&font);
memDC.SetBkMode(TRANSPARENT);
memDC.SetTextColor(m_crTextColor);
UINT uFormat = NULL;
if(m_cszAlign == "left")
uFormat = DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER |DT_LEFT | DT_END_ELLIPSIS;
else if(m_cszAlign == "lefttop")
uFormat = DT_SINGLELINE | DT_NOPREFIX | DT_TOP |DT_LEFT | DT_END_ELLIPSIS;
else if(m_cszAlign == "center")
uFormat = DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER |DT_CENTER | DT_END_ELLIPSIS;
else if(m_cszAlign == "wordbreak")
uFormat = DT_NOPREFIX | DT_VCENTER |DT_CENTER | DT_WORDBREAK;
memDC.DrawText(m_cszStatus, &rect, uFormat);
memDC.SelectObject(def_font);
BOOL bRet = font.DeleteObject();
}
CStaticDisplay::OnPaint()
{
CPaintDC dc(this);
Draw();
}
|
|
|
|
|
I am trying to create an owner draw List Box in a dialog so I can have the option of displaying lines in bold font. I am using the OnDrawItem but this function does not get called by the framework. Why is this so?
|
|
|
|