|
No, not according to MemProof 9.48. It does tell me thousands of times that I am attempting to free an unexisting resource. I have found that most of those come from deep within the RougueWave STL that shipped with my ancient compiler, and there is nothing I can do about them. But the same blitting proc hit occurs when I compile the app with Code::Blocks and VS2003 Toolkit, so it can't be the old compiler's fault in this case.
The more I play with it, the more I am totally perplexed. As I said, it worked as I thought it should when I rebooted this morning. About ten times later (just hitting 'Play' in the app some of those times, shutting the app down and restarting it other times), after I had been on the Internet, and had several other programs running, the proc time again jumped to the unacceptable levels for a commercial app of its nature. So I logged off and logged back on, without rebooting, and the behavior was fixed. Tried re-running the applications that I had ran before, and re-running the app. I could not get the behavior to come back! Arrrgggghhhhh!
I think I'm suffering from the 'Ghost in the Machine'! I guess I'll just have to depend upon everyone having a 1.2GHz proc to run my program, so they can keep the Ghost happy. (I'm kidding - I really want to figure this out before shipping.)
David
Debugging - The high art and magic of cussing errors into 'features'
|
|
|
|
|
Hard to say.
By the way, did you try to use DIBs? Just give it a try!
SkyWalker
|
|
|
|
|
I have never played with them, as they intimidated me. I'll start the Google machine, and undertake another learning experience. Can't see why that would cure the problem, but, as you say, you never know.
Thanks,
David
Debugging - The high art and magic of cussing errors into 'features'
|
|
|
|
|
Take the DDB2DIB() from this article:http://www.codeproject.com/opengl/anyTex.asp[^]
...and belive me.. I developed a control for panning / zooming maps and it works really fast (almost independent on if the application is maximized or not).
Yours
SkyWalker
-- modified at 15:22 Saturday 29th October, 2005
|
|
|
|
|
Thank you. I am looking into it.
Debugging - The high art and magic of cussing errors into 'features'
|
|
|
|
|
Not quite plug-n-dib, as I am using neither OpenGL, nor MFC, but I'll figure it out...
Debugging - The high art and magic of cussing errors into 'features'
|
|
|
|
|
Ok - question time. My application is a MIDI software sequencer, and the windows can be piano views, event views, or other views. I chose to create these views on the fly, as the user can make the 'bars' take more or less space, and each view will be changed. These views can be quite long. A quick calculation shows that a six minute performance can have up to 135,000 pixels in width, and these views can be up to 1000 (or more) pixels in height. In addition, there are an unknown number of windows, as the user can have as many tracks in the performance as they desire (until their computer craps out, of course).
From that, you can see why I chose to create these views on the fly, and only create what needs to be blitted. It would just be too slow if I didn't, and it would take WAY too much memory.
So my question is what would a DIB buy me in this scenario? I am creating the scene using the device that it will be blitted to, so it doesn't make sense to me to put a DIB intermediary in there. That would just make Windows perform many more operations behind the scene, in order to blit what I am blitting. It would take the DDB for the device, convert it to DIB, and then blit it to the DDB stage again, for the exact same device that was used to originally create it. Every scrollbar change and every window resize would result in a huge increase in processor usage to do this background processing. Just reblitting the screen would be slowed down as well, as the WM_PAINT handler would have to go through the entire process.
Please don't take this as me not liking what you have done, or your advice. I am simply trying to get my thoughts down in a cohesive manner, in order to learn more efficiently.
Thank you,
David
Debugging - The high art and magic of cussing errors into 'features'
|
|
|
|
|
I would say the problem is how much Windows must clip the screen output. When the window is maximized the only surface that needs to be drawn is your window, but when you are not maxed, Windows must draw the windows under yours and then clip out your Windows client area from them.
|
|
|
|
|
I think this is part of the problem at times, except that it doesn't explain why the proc is at 7%, and then at other times the proc is at 55%, doing the exact same things. Another program leaking resources? My program leaking resources? What is it, exactly, that causes the proc usage to suddenly jump, when restored to the same window size as before? I have tried running a large number of apps while running my app, and I did not trigger the problem. I'll keep trying to find the trigger.
Thanks for the input.
David
Debugging - The high art and magic of cussing errors into 'features'
-- modified at 21:02 Saturday 29th October, 2005
ps - when the problem occurs, closing all other windows does not fix it.
|
|
|
|
|
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
|
|
|
|
|
|