|
I've just fixed a bug in one of our internal programs that was failing to release a COM interface (IXMLDOMNode returned by IXMLDOMDocument::createNote if you're interested) which resulted in a memory leak. The leak was occuring 192 times every 15 seconds the program was running and, given that it's a background task designed to run continously, you can seen the number of leaks quickly rises to a huge number (over 46000 per hour).
What I need to know is, should a Windows 2008 Terminal Server be able to handle that kind of problem and what resouce limits could the server have been hitting? The private bytes count was only up to 200MB which is nothing when the machine has 14GB. We've had some strange slow downs on that particular server (to the point where it needs to be restarted) and I'm trying to work out if this particular program could have been the cause.
|
|
|
|
|
I have integrated a close button on my Windows form written in Visual C++, and when the user clicks that button, it deletes the generated batch files from the program and then exits the application. The problem lies in the fact that the API also has that little red x up in the corner... How can I force the API to "clean" the subdirectory and delete the batch files that were generated before the program closes just concerning the built in close feature on all Windows applications? (By the close feature, I am referring to the X symbol in the upper right hand corner of the form)
|
|
|
|
|
turkmeistr1 wrote: The problem lies in the fact that the API also has that little red x up in the corner...
An API is a function or a set of functions. What do they have to do with a UI component?
turkmeistr1 wrote: How can I force the API to "clean" the subdirectory and delete the batch files that were generated before the program closes...
From where are you doing this clean-up?
Are you using MFC?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Sorry, I'm new to Visual C++ and am not familiar with terminology. Basically, I have a UI and I want it to execute the same code for this button (code shown below) when the user clicks the close button in the upper right hand corner that is built into the form.
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
if (File::Exists("cmd\\getmac.bat"))
File::Delete("cmd\\getmac.bat");
if (File::Exists("cmd\\showip.bat"))
File::Delete("cmd\\showip.bat");
if (File::Exists("cmd\\tracert.bat"))
File::Delete("cmd\\tracert.bat");
if (File::Exists("cmd\\reset.bat"))
File::Delete("cmd\\reset.bat");
if (File::Exists("cmd\\restart.bat"))
File::Delete("cmd\\restart.bat");
if (File::Exists("cmd\\ping.bat"))
File::Delete("cmd\\ping.bat");
Application::Exit();
}
|
|
|
|
|
turkmeistr1 wrote: Sorry, I'm new to Visual C++ and am not familiar with terminology.
Or the difference between Unmanaged and Managed C++.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Sorry, didn't realize this was a flaming thread. I'll do my best to ask for help somewhere else.
|
|
|
|
|
#include <conio.h>
#include <iostream.>
#include <windows.h>
using namespace std;
char password1[25];
int x=1;
int i=0;
int q;
int main()
{
do{
cout << "Enter a test password: " ;
for(i=0;i<25;i++){
password1[i]=getch();
if(((password1[i]>=65)&&(password1[i]<=90)) || ((password1[i]>=97)&&(password1[i]<=122))
|| ((password1[i]>=48)&&(password1[i]<=57)) || ((password1[i]>=35)&&(password1[i]<=38))
|| ((password1[i]>=40)&&(password1[i]<=42)) || ((password1[i]==33))||((password1[i]==64))
|| ((password1[i]==94)) || ((password1[i]==32))){cout << "*";
i+1;}
if(password1[i]==13){i-1; goto end;}
else{i-1;
cout << "";}
}
end:
for (i; i < strlen(password1); i++){
password1[i] = '\0';}
cout << "\nYour password is ";
for(q=0;q<i;q++){cout><< password1[q];}
Sleep(2000);
if(password1[q]='p','a','s','s','w','o','r','d','\0'){goto end1;}
system("cls");
}while(x=1);
end1:
cout << "\nIT WORKS!";
getch();
return 0;
}</windows.h></iostream.></conio.h>
I cannot seem to get the program to check the password properly, it either doesn't work. Or anything works
|
|
|
|
|
gamefreak2291 wrote: if(((password1[i]>=65)&&(password1[i]<=90)) || ((password1[i]>=97)&&(password1[i]<=122)) || ((password1[i]>=48)&&(password1[i]<=57)) || ((password1[i]>=35)&&(password1[i]<=38)) || ((password1[i]>=40)&&(password1[i]<=42)) || ((password1[i]==33))||((password1[i]==64)) || ((password1[i]==94)) || ((password1[i]==32))){cout << "*"; i+1;}
Have you considered isdigit() , isalnum() , isalpha() , isxdigit() , etc? It won't necessarily solve your problem (I've not looked to see what the actual problem is), but making it easier to read won't hurt.
gamefreak2291 wrote: if(password1[q]='p','a','s','s','w','o','r','d','\0'){goto end1;}
Is this supposed to do something?
gamefreak2291 wrote: }while(x=1);
Look at this line real close. Also, your i+1 and i-1 statements are not doing what you expect.
gamefreak2291 wrote: for(q=0;q<i;q++){cout><< password1[q];}
Does this even compile?
What warning level are you using?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
no, i have not considered the others, because it took long enough to get the ascii values going.
DavidCrow wrote: if(password1[q]='p','a','s','s','w','o','r','d','\0'){goto end1;}
yes, that takes you to the end which prints that the password works.
DavidCrow wrote: }while(x=1);
okay, im looking at it. It does exactly what it is supposed to, that bit of code is only in the program at this point for debugging purposes, it allows the user to keep trying to get the correct password.
As for i+1, and i-1.. i++ and i-- was not working properly, I changed them to +1 and -i, then had them print to make sure they were working.
And of course it compiles. the reason why "for(q=0;q<i;q++){cout><< password1[q];}" is in the code is because password1[i] allows you to enter 25 characters max, and if you only enter 5 characters, the rest of them are filled in with null terminators. However, I don't want my password to be full of null terminators, so if i input 5 characters, i is currently 5, so i have q=i; then i fills out with the rest of the array with null terminators. Then the program prints password1[q] from 0-5, which is really like printing password1[0], password1[1], password1[2], password1[3], password1[4], and password1[5]. I previously had the program print the entire array however it was over lapping on multiple tries, so now it only prints the needed numbers.
Thanks again for the help
|
|
|
|
|
gamefreak2291 wrote: okay, im looking at it. It does exactly what it is supposed to, that bit of code is only in the program at this point for debugging purposes, it allows the user to keep trying to get the correct password.
better get a good C programming book.
This signature was proudly tested on animals.
|
|
|
|
|
Welcome again in the CP's memorable quotes page.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
gamefreak2291 wrote: if(password1[q]='p','a','s','s','w','o','r','d','\0'){goto end1;}
I suspect that line should read
if (0==strcmp(password1, "password")) { goto end1;}
That's how you compare two strings, anyway.
What you've done is assign 'p' to the q'th character in password (probably overwriting the null terminator, I suspect). The rest of the expression is repeated application of the comma operator[^].
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi,
if you are using windows as your operating system, when right click on a file, there is a menu for "Open with...", and then in side that menu, there is a menu for "Choose program..." When you select "Choose program..." a dialog with the name of "Open with" pops up. In there you can choose programs from "recommended programs" or you can choose programs from "other programs" section.
I am wondering how does Windows know what the recommended programs are?
also if somebody was to write or manipulate a diagram or program that shows recommended programs for a file, how would this be written in c++ code?
the compiler im using is vc++ 6.0's compiler.
thank you guys very much in advance.
I appreciate your help.
|
|
|
|
|
Have you looked in:
HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Create a File Processing System which allows for Random Access to Binary Files. The System should manage a file with a maximum of Ten (10) Records. A Record should consist of the following: (1) First Name (2) Last Name (3) Age (4) Sex (5) Salary(Use appropriate datatypes for each field.) The System should provide a menu which enables the user to: (1) Add (2) Delete (3) Modify, a Record.
|
|
|
|
|
When I was at school, I never did my homework. There's no reason why I should do *your* homework way long after I've completed my school.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
I used to dig forums and such, but I never posted the homework subject in a forum and asked for ppl to do it.
Seriously, don't expect someone to answer this.
|
|
|
|
|
Tony_P wrote: Seriously, don't expect someone to answer this.
Seriously, you should be replying to the OP, instead of me.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Hi,
I'm trying to write a wav file to the sound card, but how are you supposed to do this? You can find various libraries to play all kind of music but what's hidden behind those libraries?
Basically, what should I do to directly send data to the sound chip? I can't find much information about this...
Thanks,
Tony
|
|
|
|
|
I think your best bet would be DirectSound API [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
That's again an API. Is there a way to do something like fopen("soundcard","w") ?
|
|
|
|
|
AFAIK, you can't (unless you go in kernel mode).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Too bad then 
|
|
|
|
|
Are you looking for something like Sample Audio Drivers[^]?
Do not trust a computer...
Always check what computer is doing
regards,
Divyang Mithaiwala
Software Engineer
|
|
|
|
|
Well I was trying to write a MP3 player I could easily port to the Nintendo DS by going very low level (ie: fwrite to the sound card). But well, if can't speak directly with the sound device I guess this isn't going to work.
|
|
|
|
|