|
uus831 wrote: What about sending std::string?
Same as CStringT
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Got a weird one for everyone.
We have ported our MFC MDI application to VS 2005 and it is is out in beta test with some managed extensions in DLL's.
Most everyone is happy during the beta though we have a handful of users at one company reporting our new snappy product is an obsolete dog, six seconds to display a MFC drop down menu, etc.
XP 3.2GHZ hyper-threaded systems with 2GB of memory and multiple monitors 3-4
Only our application is being reported as slow, others are working fine.
We had them turn off the virtual memory page file and our application started running fine until they loaded a bunch of other applications and left ours quiescent for about 20 minutes. On re-accessing our application it would be initially slow and then pick back up its normal speed.
At this point in looking in the task manager one instance of our application would show as using 50mb of memory and the other would show using 6-8mb of memory and climb back as the user performed operations.
No other site has showed this memory imbalance between instances.
It’s like every time they need our application we are not in memory and have to be reloaded from disk. No where else have we seen this type of imbalance between instances or that we have been pushed out of memory so extremely.
Any idea's what can be causing this?
|
|
|
|
|
What did you send for Beta? Debug or Release.
Did you include (Secret)ErrorReporting Structures with your Beta Version, What did they say,
Can you switch them on again.
What made you decide that the Beta Test was finished, and to go for release.
Regards,
Bram van Kampen
|
|
|
|
|
Hi Everyone,
I am working on a VC++ 6.0 project which require me to write to an existing excel file.
I tried to search, but am not able to find out any sample code.
Can any one guide me on this?
Please direct me to some sample code.
Regards,
krish
|
|
|
|
|
You can either use the Excel ODBC driver, or Excel Automation. I've provided an example of the latter a few times in this forum.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi
Thanks for the quick responce.
Can you point me to some sample code?
Regards,
Krish
|
|
|
|
|
krish99 wrote: Can you point me to some sample code?
Search this forum for excel.application going back to 1-Jan-2007.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
|
Thanks for the sample.
Can i use Microsoft Excel 11.0 Object Library/ Microsoft Excel 10.0 Object Library with C++/VC++6
with out .Net Environment?
If i can use, where can i download Microsoft Excel 11.0 Object Library?
Regards,
Ramchandraraju KK
|
|
|
|
|
Hi
In our application the subkey will be dynamically changed, so we can't give subkey name directly. so based on the subkey name, the corresponding subkey value should be retrived. if possible please provide me a sample program to get the subkey values.
|
|
|
|
|
hmmm....what the hell are you talking about?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
Ohhhh REGISTRY subkeys
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Gee, wasn't it obvious?
|
|
|
|
|
Oh right, I thought it was a similar question to one I'd answered a few days ago, but I didn't notice that it was the same person...
Regards,
--Perspx
Don't trust a computer you can't throw out a window
-- Steve Wozniak
|
|
|
|
|
I have a serious problem which i am not being able to figure. This program finds all the permutations of a given string using recursion. The diagnostic outputs show that the values of the 'choice' and 'final' character arrays is not maintained at a position (I don't know why). Please help.
#include <iostream.h>
#include <conio.h>
#include <stdio.h>
#include <string.h>
using namespace std;
class Permutation
{
private:
static char s[20];
int width,l;
public:
void input();
void compute();
void recur(char choice[],char final[],int);
};
char Permutation::s[20];
void Permutation::input()
{
cout<<"Enter the string:";
gets(s);
cout<<"Places to arrange:";
cin>>width;
};
void Permutation::compute()
{
l=strlen(s);
char s1[20];
recur(s,s1,0);
}
void Permutation::recur(char choice[],char final[],int p)
{
int i,j,chk,c=0;
if(p==width){
cout<<"OUT: "<<final;
cout<<endl;
return;
}
for(i=0;i<l;i++){>
chk=0;
for(j=0;j<strlen(final);j++){>
if(s[i]==final[j])
chk=1;
}
if(chk==0){choice[c++]=s[i];}
}
choice[c]='\0';
for(i=0;i<c-1;i++){>
final[p]=choice[i];
final[p+1]='\0';cout<<"Beforein:\t "<<choice<<" -\t "<<final<<" -\t "<<p+1<<" -\t"<<i+1<<" "<<c<<endl<<endl;
recur(choice,final,p+1);
cout<<"Returned: \t"<<choice<<" - \t"<<final<<" - \t"<<p+1<<"-\t"<<i+1<<" "<<c<<endl<<endl;
}
}
int main()
{
Permutation arrange;
arrange.input();
arrange.compute();
getch();
return 0;
}
</string.h></stdio.h></conio.h></iostream.h>
|
|
|
|
|
What is "Places to arrange"?
Could you please give an example of expected input-output?
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]
|
|
|
|
|
Ok, that was hasty programming, "places to arrange" means the spaces in which we have to arrange it. eg. 'pineapple' can be taken 2 at a time or three at a time to form a string (pi,ne,ea etc).
Enter a string:care
Places to arrange:3
so we can have:
are,car,ear,rac ...etc..etc..
|
|
|
|
|
Well, I had troubles following the logic of your program hence rewrite my own version based on the requirements. It is almost plain C , if you feel its output correct then you can easily incapsulate it in a class.
#include "stdafx.h"
#include <string.h>
void choose(char in[20], int len, int width, int level);
int main(int argc, char* argv[])
{
char in[] = "abcd";
choose2(in, 4,3,0);
return 0;
}
void swap(char & a, char & b)
{
char t = a;
a = b;
b = t;
}
void choose(char in[20], int len, int width, int level)
{
int i;
char out[20];
memcpy( out, in, 20);
if ( level == width)
{
for (i=0; i<level; i++)
{
putchar(out[i]);
}
putchar('\n');
return;
}
choose(out, len, width, level+1);
for (i=level+1; i<len; i++)
{
swap(out[level],out[i]);
choose(out, len, width, level+1);
}
}
BTW the program is far from being optimized.
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]
|
|
|
|
|
I really appreciate the the code you compiled. It is simplified.I would like to state my problems very clearly with the code I wrote.The crux of the problem is my inability to understand why the recursion procedure is not following the pattern it was supposed to:
class Permutation
{
private:
static char s[20];
int width,l;
public:
void input();
void compute();
void recur(char choice[],char final[],int);
};
char Permutation::s[20];
the above is the class definition, easy enough.
void Permutation::input()
{
cout<<"Enter the string:";
gets(s);
cout<<"Places to arrange:";
cin>>width;
};
function to enter the values.
void Permutation::compute()
{
l=strlen(s);
char s1[20];
recur(s,s1,0);
}
this is the function which calls the recursive function
RECURSIVE PART:
1.
void Permutation::recur(char choice[],char final[],int p)
choice[]: contains all possible letters which can take the position
eg. care - for the first position > c,a,r,e is stored as 'care' when the first is set to 'c' then for the second position is 'a,r,e' and so on..
final[]: stores the string to be printed..when all the spaces are filled , it is printed
p: holds the position where a character has to be inserted from the choice[] to final[]
2.
int i,j,chk,c=0;
if(p==width){
cout<<"OUT: "<<final;
cout<<endl;
return;
} >
this is the base conditon: if the width is reached it prints the string
3.
for(i=0;i<l;i++){>
chk=0;
for(j=0;j<strlen(final);j++){>
if(s[i]==final[j])
chk=1;
}
if(chk==0){choice[c++]=s[i];}
}
choice[c]='\0';
This is the part in the recursive function which finds all the possible characters which can be put into a space...it checks the initial string and compares it to final[] ...the choice[] are the ones which aren't present in final.
4.
for(i=0;i<c-1;i++){>
final[p]=choice[i];
final[p+1]='\0';cout<<"Beforein:\t "<<choice<<" -\t "<<final<<" -\t "<<p+1<<" -\t"<<i+1<<" "<<c<<endl<<endl;
recur(choice,final,p+1);
cout<<"Returned: \t"<<choice<<" - \t"<<final<<" - \t"<<p+1<<"-\t"<<i+1<<" "<<c<<endl<<endl;
}
}
The chart of the recursive function is shown here:
http://i452.photobucket.com/albums/qq241/ronjay_2008/Misc/chart.jpg[^]
the characters assigned for a position on final[] are taken from choice[]
4.
int main()
{
Permutation arrange;
arrange.input();
arrange.compute();
getch();
return 0;
}
Simple class construction
5. What I did not understand:
Since I wasn't getting the output, I added diagnostic check in the recursive function to check how the values were changing on each step. I knew that in the stack for each recursive iteration a separate instance of the array is created (choice[],final[] and p),but the output did not conform.
check this:
http://i452.photobucket.com/albums/qq241/ronjay_2008/Misc/OUTPUT.jpg[^]
The part in yellow shows the state at an earlier iteration. Therefore, when 'recur' return to that state later, it should have printed the same values of choice[] and final[] which is not so. Only p,i and c are consistent. Whatever happened to choice[] and final[]? They should have retained their original values which according to the ouput it hasn't.
Maybe, there is minor error which i have overlooked. Please sort this.
If you want the .exe file its here:
output_permutation.exe
|
|
|
|
|
Hi All,
I tried to identify with depends.exe .(COM dlls can be known from this tool .)
But could not identify.
Can someone help me in this regard.
Thanks
Appala Naidu Uppada
Appu..
"Never explain yourself to anyone.
Because the person who likes you does n't need it.
And the person who dislikes you won't believe it."
|
|
|
|
|
you could try calling LoadLibrary on the file, then call GetProcAddress on the handle, to see if the EXE exports DllGetClassObject.
|
|
|
|
|
That only works for DLLs though.
|
|
|
|
|
which part doesn't work in EXEs ?
|
|
|
|
|
I mean, is there any tool like Depends available to identify the EXE is a component?
Appu..
"Never explain yourself to anyone.
Because the person who likes you does n't need it.
And the person who dislikes you won't believe it."
|
|
|
|
|