|
Hrm, intresting..
Out of curosity, in TaskManager Process tab, go View/ Select Columns.. and Check GDI Objects, see how much work you are really putting on the GDI system.
|
|
|
|
|
It only shows 50 when opened with nothing running, ~92 GDI objects when running the performance I was playing with. This is well under some of the other procs running (Firefox: 131). My application uses about 15.5K memory when running that proc, as well.
Now, that major clue. There are two of them, actually.
1) Out of curiousity, I ran Jooleem while my application was running. All of a sudden Task Manager showed my proc usage creeping up to about 10%, from 0%. Shut Jooleem down and restarted my program and played it. Proc usage was at 45%.
Rebooted. Ran my program five times. Each time Task Manager showed it about 0~2% proc usage. During sixth time, ran Jooleem again. My proc usage immediately went up to 10% again. Shut Jooleem off. Without shutting my program down, I restarted the task it was performing. TM showed my app to be using 45% of the proc time. Shut my program down and restarted it. It was still at 45%.
So finally a breakthrough.
2'nd clue) It definately seems to have something to do with the graphics. If my application is being shown on the screen, and then I cover it up with Firefox or another program, the proc usage goes to 0%. Bring my program to the front, and proc usage spikes to 45% again.
I am not using anything other than plain GDI for my graphics. No DirectX, no OpenGL, no nothing. My app is using DirectMusic, but I don't see how that could be tying into the graphics. I'm not saying that it is impossible, I'm just saying that I don't know how it could be. I don't link to anything other than dxguid.lib.
I guess a third clue is that the problem is somehow able to transmit itself to my relaunched application, no matter how many times I shut it down and restart it. It takes a shutdown or a log-off and log-on to make the problem go away.
Even with these clues, I don't know what to do next. Leave it? Say it is some other program's problem? I would still like to know what is really going on, but I don't want to delve into the guts of Jooleem just to find out, and I am scared that is the only thing that would eventually unearth the problem. Maybe someone else has a better idea?
David
Debugging - The high art and magic of cussing errors into 'features'
|
|
|
|
|
ps - The same thing happens to other programs as well. I have noted it happening with Audobe Audition, so not only my program is affected. This makes me think this behavior has more to do with the internals of the multimedia system, and is something deep within Windows itself, but I may be wrong.
Debugging - The high art and magic of cussing errors into 'features'
|
|
|
|
|
I want to compare a IP against an IP range. I want to know how to implement this, involving also the mask for each IP. Ex: The range is [IPa->MaskA....IPb->MaskB], and i want to know if IPx->MaskX is in interval.
|
|
|
|
|
Hi
bit AND used to check if source and destination IP is in a rang.
S-IP 192.168.0.1 = 11000000.10101000.00000000.00000001<br />
D-IP1 192.168.0.2 = 11000000.10101000.00000000.00000010<br />
D-IP2 192.168.10.3 = 11000000.10101000.00001010.00000011<br />
Mask 255.255.255.0 = 11111111.11111111.11111111.00000000
S-IP AND Mask = 11000000.10101000.00000000.00000000<br />
D-IP1 AND Mask = 11000000.10101000.00000000.00000000<br />
S-IP AND Mask = D-IP1 AND Mask
S-IP AND Mask = 11000000.10101000.00000000.00000000<br />
D-IP1 AND Mask = 11000000.10101000.00001010.00000000<br />
S-IP AND Mask <> D-IP2 AND Mask
Iman Ghasrfakhri
|
|
|
|
|
Hi,
I have a combobox in my dialog.
And I added a control varaible, app_addr_state, for it.
Also, I created a function to do something with it.
void registration_Dialog::add_50_states_string (
CComboBox cbox )
{
..............
}
I tried to call it inside the OnInitDialog( )
add_50_states_string ( app_addr_state );
However, I got the following error when I compiled it.
> cannot convert parameter 1 from 'CComboBox' to 'CComboBox'
I am a bit confused.
Does anyone know what's the problem?
Thanks,
Kevin
|
|
|
|
|
You probably need to pass a reference to the combobox. It sounds like you are trying to pass a 'CComboBox', and this would pass it by value (creating a copy of the CComboBox). Try 'void registration_Dialog::add_50_states_string (CComboBox & cbox)' and see if that works.
(You could also pass by pointer, but references are cleaner in this case.)
Debugging - The high art and magic of cussing errors into 'features'
|
|
|
|
|
It works after changing it to "pass by reference".
This way is cleaner and less overhead.
Thanks,
Kevin
|
|
|
|
|
I was wondering what the easiest way to get only the filename from the FileName property of the Save/Open dialogs in Visual C++? I've created a string variable and set it to SaveDialog1.FileName but that contains the path AND the filename. I know I could go through and find the first \ from the end of the variable and remove anything before it but there has to be an easier, less time consuming, way of doing this. In Delphi there was a property of the Save/Open dialogs that would automatically return only the filename and not the path, but, as far as I can tell, there is not one for Visual C++. Any help and/or ideas would be greatly appreciated!
Thanks,
Tom Sapp
http://www.sappsworld.com
-- modified at 23:52 Friday 28th October, 2005
|
|
|
|
|
There may be a better way than the following in VC. I don't know, though, as I don't use VC. The following helper functions have worked for me, and you are welcome to them. Maybe somebody else can give us both that better way. 'wString' is a typedef for std::basic_string<tchar>, which becomes std::string, so you can just replace 'wString' with 'std::string', and it should work for you. If you find any errors in this, all I can say is that I never claimed to be perfect.
David
bool rmw::fileExists(const wString & fileName) {
WIN32_FIND_DATA d;
HANDLE file = FindFirstFile(fileName.c_str(), &d);
bool retVal(true);
if (file == INVALID_HANDLE_VALUE) retVal = false;
FindClose(file);
return retVal;
}
wString rmw::getPathFromStr(const wString & str) {
int pos = str.find_last_of(TEXT("\\"));
return wString(str.substr(0, pos));
}
wString rmw::extractFileName(const wString & str) {
int pos = str.find_last_of(TEXT("\\"));
return wString(str.substr(pos+1, str.length()));
}
wString rmw::extractFileExt(const wString & str) {
int pos = str.find_last_of(TEXT("."));
if (pos == -1) return "";
return wString(str.substr(pos, str.length()));
}
wString rmw::trimFileExt(const wString & fileName) {
wString fileExt = rmw::extractFileExt(fileName);
int len = fileExt.length();
return fileName.substr(0, fileName.length()-len);
}
wString rmw::extractFileDir(const wString & fileName) {
int pos(fileName.find_last_of(TEXT("\\")));
wString t = fileName.substr(0, fileName.length()-pos);
return t;
}
(Gotta love that STL!)
Debugging - The high art and magic of cussing errors into 'features'
|
|
|
|
|
char path[_MAX_PATH];
char filename[_MAX_FNAME + _MAX_EXT];
char drive[_MAX_DRIVE];
char dir[_MAX_DIR];
char fname[_MAX_FNAME];
char ext[_MAX_EXT];
_splitpath(path,drive,dir,fname,ext);
_makepath(filename,"","",fname,ext);
Software Zen: delete this;
|
|
|
|
|
I've had SOME success getting rid of compiler errors putting this macro redefinition in the project settings
WINVER=0x0501 _WIN32_WINNT=0x0501 _WIN32_IE=0x0600
but I'm still getting the message
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\stdlib.h(256): error C2381: 'exit' : redefinition; __declspec(noreturn) differs
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\Windows.h(24): fatal error C1012: unmatched parenthesis : missing ')'
This only happens when I try to open graphics projects using glut. Any ideas?
Normality is a weakness...
|
|
|
|
|
i want to make a program that will respond to spoken commands from the user to open programs and do other tasks in windows. i dont know how to do any speech recognition programming. i downloaded the microsoft speech sdk 5.1 but dont know where to go from here.
any help that anyone can provide would help greatly. code samples are extremly helpful.
thank you in advance for the help
- Kyle
|
|
|
|
|
|
do you know what header replaced the speech.h in microsofts speech rec. 5.1?
that code doesnt work without it, i get all kinds of errors.
- Kyle
|
|
|
|
|
|
Hi, I can read the input data from the parallel port. I have a thread that is reading continously the parallel port and updating a variable with the data.
I want to know if there is a better way to do it, because I need a quick response in my application (software side).
I have two push buttons connected to the parallel port (parallel port is already configured as bi-direccional) so, I want to detect the order in which I press the buttons, if the combination is correct it will display a message.
Could somebody please help me?
Thanks in advance.
|
|
|
|
|
|
Hello
I'm not sure if this is a beginners forum, but I will start here. I am a beginning C++ student and have a couple of mini-projects invloving fractions that I need some guidance on.
First the assignments:
1. Write a Fraction-Reduction program that takes in any fraction (maybe with denominator not equal to 0 or 1), and reduces it lowest terms. The function prototype will take two integer variables passed by reference.
2. Write a function that takes in any number and returns its whole and fractional parts as outputs. Like 6.44 would return int 6 and float 0.44.
My trouble:
On #1: I understand how reference passing is working, that the variables values in main's variables can be changed by the function. What I cant figure out is how to write something that will find the greatest common factor of any two numbers entered. I understand the math behind it but I cant translate that math to the program, and get it the correct place in main or the function and have it work.
On #2: This problem came from the chapter on reference parameters also. So is there a way to do this problem with the user entering one single float? Or is the trick to cin what the user enters in a format that allows to be updated invidually by reference from a function?
If my code is needed I can post it. If there is another forum I need to be at, please let me know. Thank you sincerely for any help.
JB
|
|
|
|
|
j4express wrote: 2. Write a function that takes in any number and returns its whole and fractional parts as outputs. Like 6.44 would return int 6 and float 0.44.
find the ceil or floor of the no depending on less or greater than zero val, Now you get the integer part, now subtract the original no with the integer part and you get the decimal part.
-prakash
Learning Symbian | Personal views
|
|
|
|
|
#1> This is some really old code laying around in the depths of my harddrive, but it should be exactly what you are looking for. It's not really a programming problem as much as a math problem, luckily Euclidean did all the work for us many years ago.
Euclidean algorithm for finding the Greatest Common Denominator:
void GCD(int &Nume, int &Denom)
{
int a= Nume;
int b= Denom
int temp = a % b;
while (temp > 0)
{
a = b;
b = temp;
temp = a % b;
}
Nume= Nume / b;
Denom= Denom /b;
}
#2> Ok, this one is easier than it seems. So lets say we the float 6.44 from the user. Now the easy part, casting a floating point into an integer will automaticall truncate the number, therefore leaving us with only the whole number, simple subtraction does the rest.
float f1 = 6.44f;
int Int1= (int) f1;
f1= f1 - Int1;
|
|
|
|
|
Hello,
i have downloaded the GGNFS from here: http://www.math.ttu.edu/~cmonico/software/ggnfs/
But when I try to compile I get the following errors:
------ Build started: Project: matbuild, Configuration: Debug Win32 ------
Compiling...
matstuff.c
m:\GNFS\src\matstuff.c(112) : warning C4244: '=' : conversion from 'double' to 's32', possible loss of data
matbuild.c
m:\GNFS\src\matbuild.c(662) : warning C4244: '=' : conversion from '__w64 int' to 's32', possible loss of data
m:\GNFS\src\matbuild.c(708) : warning C4267: '+=' : conversion from 'size_t' to 's32', possible loss of data
m:\GNFS\src\matbuild.c(898) : warning C4267: '=' : conversion from 'size_t' to 's32', possible loss of data
m:\GNFS\src\matbuild.c(908) : warning C4267: '+=' : conversion from 'size_t' to 's32', possible loss of data
m:\GNFS\src\matbuild.c(1012) : warning C4267: '=' : conversion from 'size_t' to 's32', possible loss of data
m:\GNFS\src\matbuild.c(1020) : warning C4267: '+=' : conversion from 'size_t' to 's32', possible loss of data
m:\GNFS\src\matbuild.c(1183) : warning C4244: '=' : conversion from 'double' to 'long', possible loss of data
combparts.c
blanczos64.c
m:\GNFS\src\blanczos64.c(318) : error C2065: 'asm' : undeclared identifier
m:\GNFS\src\blanczos64.c(318) : error C2143: syntax error : missing ';' before 'volatile'
m:\GNFS\src\blanczos64.c(471) : error C2143: syntax error : missing ';' before 'volatile'
m:\GNFS\src\blanczos64.c(570) : warning C4244: '=' : conversion from 'u64' to 'int', possible loss of data
m:\GNFS\src\blanczos64.c(832) : error C2143: syntax error : missing ';' before 'volatile'
m:\GNFS\src\blanczos64.c(884) : error C2143: syntax error : missing ';' before 'volatile'
m:\GNFS\src\blanczos64.c(932) : error C2026: string too big, trailing characters truncated
m:\GNFS\src\blanczos64.c(980) : error C2026: string too big, trailing characters truncated
m:\GNFS\src\blanczos64.c(1029) : error C2026: string too big, trailing characters truncated
m:\GNFS\src\blanczos64.c(1077) : error C2026: string too big, trailing characters truncated
m:\GNFS\src\blanczos64.c(1125) : error C2026: string too big, trailing characters truncated
m:\GNFS\src\blanczos64.c(1175) : error C2026: string too big, trailing characters truncated
m:\GNFS\src\blanczos64.c(1226) : error C2026: string too big, trailing characters truncated
m:\GNFS\src\blanczos64.c(1278) : error C2026: string too big, trailing characters truncated
m:\GNFS\src\blanczos64.c(1331) : error C2026: string too big, trailing characters truncated
m:\GNFS\src\blanczos64.c(1384) : error C2026: string too big, trailing characters truncated
m:\GNFS\src\blanczos64.c(1435) : error C2026: string too big, trailing characters truncated
m:\GNFS\src\blanczos64.c(1488) : error C2026: string too big, trailing characters truncated
m:\GNFS\src\blanczos64.c(1541) : error C2026: string too big, trailing characters truncated
m:\GNFS\src\blanczos64.c(1622) : error C2143: syntax error : missing ';' before 'volatile'
m:\GNFS\src\blanczos64.c(1729) : error C2143: syntax error : missing ';' before 'volatile'
m:\GNFS\src\blanczos64.c(1762) : error C2143: syntax error : missing ';' before 'volatile'
m:\GNFS\src\blanczos64.c(1796) : error C2143: syntax error : missing ';' before 'volatile'
m:\GNFS\src\blanczos64.c(1833) : error C2143: syntax error : missing ';' before 'volatile'
m:\GNFS\src\blanczos64.c(1865) : error C2143: syntax error : missing ';' before 'volatile'
m:\GNFS\src\blanczos64.c(2010) : warning C4244: 'function' : conversion from 'u64' to 'size_t', possible loss of data
m:\GNFS\src\blanczos64.c(2014) : warning C4244: 'function' : conversion from 'u64' to 'size_t', possible loss of data
m:\GNFS\src\blanczos64.c(2020) : warning C4244: 'function' : conversion from 'u64' to 'size_t', possible loss of data
m:\GNFS\src\blanczos64.c(2021) : warning C4244: 'function' : conversion from 'u64' to 'size_t', possible loss of data
m:\GNFS\src\blanczos64.c(2121) : warning C4244: 'function' : conversion from 'u64' to 'size_t', possible loss of data
m:\GNFS\src\blanczos64.c(2125) : warning C4244: 'function' : conversion from 'u64' to 'size_t', possible loss of data
m:\GNFS\src\blanczos64.c(2131) : warning C4244: 'function' : conversion from 'u64' to 'size_t', possible loss of data
m:\GNFS\src\blanczos64.c(2132) : warning C4244: 'function' : conversion from 'u64' to 'size_t', possible loss of data
Generating Code...
Build log was saved at "file://m:\Gnfs\ggnfs.vc\matbuild\Debug\BuildLog.htm"
matbuild - 24 error(s), 17 warning(s)
I have no clue what's wrong. Could anyone help me ?
With best regards,
Benedikt
|
|
|
|
|
RedDragon2k wrote: m:\GNFS\src\blanczos64.c(318) : error C2065: 'asm' : undeclared identifier
I believe you'll need __asm for this.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
RedDragon2k wrote: m:\GNFS\src\blanczos64.c(318) : error C2065: 'asm' : undeclared identifier
is that an
asm
{
...
};
block ?
if so, try replacing "asm" with "_asm"
(yeah, what David said)
Cleek | Image Toolkits | Thumbnail maker
-- modified at 15:56 Friday 28th October, 2005
|
|
|
|
|
Hello,
When I leave my computer for 30 minutes, the monitors are turned off (power-save mode), but the computer remains on and ready for networking/serving.
I would like to code a small app to force the monitors/displays to power-saving mode immediately (at the press of a button) while keeping the rest of the system on. Could someone point me in the right direction in the MFC library?
thanks,
JennyP
|
|
|
|
|