|
im using CFileFind to search for certen file types (EG. .log .tmp .bak" the way i have it is after it finds a file it run another loop to check all the file types im looking for is there a better and fast way to check if the file found matches what im looing for? is there a way to put all the file types in a string and check it once for each file found instead of the loop? and im checking each file found against 2 other list a file exclue and path exclude list. as it is it takes about 6 mins to scan all of my harddrives.
|
|
|
|
|
Could you use "FindOneOf" in CString?
For example I am looking for a numeric value in my string using this:
CString subWeight = "0123456789";
int found = strText.FindOneOf(subWeight);
Vaclav
|
|
|
|
|
For each file found, call PathFindExtension() to get its extension. Then just compare that extension with those in your list (e.g., .log, .tmp, .bak).
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
its not just extensions im searching for for some ill find the whole thing like "readme.txt" for some i need to find just the first part like "readme" for the rest it will be the extension i have it where it breaks the word down from "readme.txt" to "readme" ".txt" and i check all 3 but it is very slow running the loop for every file found right now there is about 30 different things im searching for so for each file found the loop runs 30 times and there is 3 list so for each file and folder found the loop really runs about 40 times thats why i need a way to check all 30 at once.
|
|
|
|
|
locoone wrote: ...i need a way to check all 30 at once.
You can't get around this requirement. In other words, if you are looking for .log, .tmp, and .bak files, you will need to do three checks for each file found.
Does this help?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I understand how to set the modified flag in a CPropertyPage derived class and how it affects the ApplyNow button etc...
However, I would like to query that value if the CPropertySheet derived class returns IDOK to see if a refresh of the properties, client area, etc... is really necessary.
Does anyone know how to query the modified flag, directly or indirectly, that gets set in the CPropertyPage when calling CPropertyPage::SetModified() ?
|
|
|
|
|
I haven't seen any way to get the modified state of a property page.
If you override OnOK in the page class(es) you could set some flag.
OnOK should only be called for dirty pages, and only when the user doesn't cancel.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
That's probably what I'll do. I was quite surprised to see the message get sent in the CPropertyPage::SetModified source but I couldn't find where it was going or how to query it.
thanks again for helping.
|
|
|
|
|
bob16972 wrote: However, I would like to query that value if the CPropertySheet derived class returns IDOK to see if a refresh of the properties, client area, etc... is really necessary.
Then can't you just check the return value of DoModal() ? If it's IDOK , refresh accordingly.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Heh! Funny, I somehow assumed that the OP wanted changed info for individual pages.
If it was just the return value for the sheet ...
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I'm trying to optimize too much methinks.
I've been working on this project too long and I'm starting to attempt to save clock cycles where they really don't matter anyway.
I'd take a vacation but I just took one a few months ago so I guess I'm just pushing myself too hard.
Anyway, sorry about the post and thanks for the help.
|
|
|
|
|
Heh no problem. Sometimes little things like that can make a UI more pleasing for the user.
It's always a tradeoff for me, between dev time and how much it adds to the interface
Cheers!
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Yes, you are right. I was just thinking about the situation where apply had been hit already, then later the OK button after no new changes were made. A second full refresh of the values seemed like it would be overkill but I guess now that you mention it, it seems silly of me to even worry about it and just do the refresh.
My quest to optimize is starting to cause me to waste time in general.
Sorry about the post and thanks for the wake up call.
|
|
|
|
|
Hi all. I am feeling very stupid. I cannot find any article/sample code showing me how to do a simple thing like using a CStatic groupbox in Visual C++ 2005. I am adding controls on top of a groupbox in the designer, but when running the application, the groupbox hides all the controls. MSDN is (as usual) of very little help. Anyone able to show me how to see the controls? When disabling/enabling the groupbox, how do you automatically disable/enable the controls inside it? Thank you.
|
|
|
|
|
You may have to set the groupbox control's Transparent property to true.
If the problem is Z-order, you can use Format/Tab Order (ctrl-D) and set the order of the controls,
making the groupbox earlier in the tab order than the controls within it.
Enabling and disabling the controls within the group box is done the same as with any other controls.
The groupbox is just a static control so it doesn't give you any special features for
working with the controls within the groupbox.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi
I have written a utility program using c++ that does some number crunching. To give access to the users, created a dll by wrapping member functions of this c++ class. I have successfully compiled (using VS2005) and used the dll.
Now I would like to make it available to public. However, the users of the dll may want to use it with differnt compilers (other than VS2005) such as VB, Borland C++, or Delphi.
What is the best way to generate .lib, .h, .pas (delphi), etc files. Any guidence please.
Regards,
Prasad
|
|
|
|
|
T.D.Prasad wrote: However, the users of the dll may want to use it with differnt compilers (other than VS2005) such as VB, Borland C++, or Delphi.
COM was invented specifically for this purpose.
|
|
|
|
|
Thanks for the suggestion. However, the user of the dll may not have sufficient knwledge to use a com object. In the help file I am giving instructions on how to use dll with VC++, BC++, VB etc. (FYI: I do not know how to use a com object, the users of dll are civil engineers)
Please answer my earlier question, if anyone can.
Regards,
Prasad
|
|
|
|
|
T.D.Prasad wrote: What is the best way to generate .lib, .h, .pas (delphi), etc files. Any guidence please.
It seems to be Win32 dll which are exposing Functions .. Right! com is best method for doing so.. but as you have said that, the enduser doesn't know hows to use COM.
I havn't worked in Delpi and borland C++, so don't how to call dll there.. but VB has the support for win32 dll. like if we need Sleep function of Kernel32.dll in VB.. we use this decalaration to get it
Public Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)
you have to do same for evrything
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
1.by people's habits, a week should start from sunday or monday?
2.the start day should be 1 or 0 for general users? - i think 0 is possible incorrect because they are not C programmers familar with 0 as first one.
|
|
|
|
|
includeh10 wrote: 1.by people's habits, a week should start from sunday or monday?
Monday, since Saturday and Sunday occur on the weekend.
includeh10 wrote: 2.the start day should be 1 or 0 for general users? - i think 0 is possible incorrect because they are not C programmers familar with 0 as first one.
Zero based is just a mindset we all have around here. VB programmers that I know like ones based indexing and their more like normal people than we are so I'd say start at one.
Just my two cents.
|
|
|
|
|
1) I prefere to start from monday
2) I think that start from 0 for many users can't be the right solution, I think that they prefere 1
Is there also possible to indicate the weeknumber using 3 chars according with his name: from 'Mon' (monday) to 'Sun' (sunday)
It is more elegant ...
Russell
|
|
|
|
|
1 - this depends on the locale, some people say Sunday, some say Monday.
2 - you're obviously right, users want 1 based.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
1. is highly culture specific and set in the windows locale settings. You should honor that setting.
strftime() has sunday as 0.
2. You should not display numbers to the users. Display the names, maybe abbreviated. This way, no one will ever see if you start with 0 or with 1.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
How can I use SQL operation such as create database ,delete database ,update database, change password, add user.....
by write the code in visual c++.
Please give me the good link or article which support this issue.
Thanks
|
|
|
|