|
subramanyeswari wrote: My question is why should I embed manifest file in the exe to run in Vista.
Can you check this[^] video on channel 9.
Google search on this topic[^]
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
The code works under XP, both administrator or limited account.
But when I run it under Vista, it works under a administrator account, but doesn't work under limited account.
Sometimes, the history is cleared at first, but it appears again when I restart IE.
The code is shown as follow:
USES_CONVERSION;
CoInitialize(NULL);
TCHAR szSpecialFolderPath[MAX_PATH];
::SHGetSpecialFolderPath(::GetDesktopWindow(), szSpecialFolderPath, CSIDL_HISTORY, FALSE);
IUrlHistoryStg2* pUrlHistoryStg2 = NULL;
HRESULT hr = CoCreateInstance(CLSID_CUrlHistory, NULL, CLSCTX_ALL, IID_IUrlHistoryStg2, (void**)&pUrlHistoryStg2);
if(SUCCEEDED(hr))
{
hr = pUrlHistoryStg2->ClearHistory();
pUrlHistoryStg2->Release();
CoUninitialize();
return TRUE;
}
else
{
CoUninitialize();
return FALSE;
}
Thanks a lot!
|
|
|
|
|
With AfxBeginThread , it is __cdecl ,
with CreateThread , it is __stdcall .
Is there an safe API wait to create a thread in MFC?
CreateThread?
I'd like to the easier one, if there is.
|
|
|
|
|
followait wrote:
Is there an safe API wait to create a thread in MFC?
Err, AfxBeginThread is an MFC function...
Not sure what else you're after.
Iain.
Plz sir... CPallini CPallini abuz drugz, plz plz help urgent.
|
|
|
|
|
followait wrote: I'd like to the easier one, if there is.
Nothing is easy in multi-threading.
-Saurabh
|
|
|
|
|
Philosophical mood this afternoon?
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]
|
|
|
|
|
Yes!! Trying to finish this boring piece of code before I call it day
But I guess that statement is pretty much always true for any non-trivial applications
-Saurabh
|
|
|
|
|
When you're using MFC you have to use AfxBeginThread due to internal workings of the framework.
For more info:
http://www.flounder.com/badprogram.htm#beginthread[^]
The best starting point for multithreading can be found here[^].
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
I have 2 classes, B inherit from A, but actually A have a function: fun should not present in B, so I code as blow,
class A{
public:
virtual void fun(){cout << "a" << endl; };
};
class B : public A{
virtual void fun(){};
};
But this take no effect, I can call the fun in class b,
int main()
{
A a;
B b;
A *pa = new B;
a.fun();
b.A::fun();
pa->fun();
}
the output is
a
a
How to decline the function call?
Thanks.
|
|
|
|
|
What is your point?
pa->fun() doesn't fit your needs?
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]
|
|
|
|
|
yes,
the A::fun() is bad for the B, will case error,
so i want let A::fun to be public, but to B the fun must cannot be call
|
|
|
|
|
What about
(1) Writing A class without fun function.
(2) Writing a (say) AA class that inherits from A and provides fun function.
(3) Writing a B class that inherits from A class and therefore is not able to call fun function?
Of course A class consumers should become AA class ones.
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]
|
|
|
|
|
yeah, that's the better way to do,
but in this project others may dislike this implement, they didn't want their code update, @_@.
Thanks for all your help.
|
|
|
|
|
Hi,
I don't understand what you don't want to happen for the B class.
do you want to hide the functionaly from a b object or the declaration;
like this:
int main()
{
A a;
B b;
a.fun();
b.fun();
b.fun();
A* p = &b;
p->fun();
b.A::fun();
}
Maybe you could use the Facade pattern to hide the unwanted A functionaly.
Learn from the mistakes of others, you may not live long enough to make them all yourself.
|
|
|
|
|
Dear gurus,
I detected a runtime-bottleneck in my code at the following line
pY[j] = d1 * pY[j] + d2 * pX[j];
.
All variables are floating point. This line is excecuted millions of times.
Now I think about improving runtime by using inline-assembler.
Can somebody give me a hint how to start in the best way (e.g. using a library)
(by the way: I'm not a beginner at assembler-coding)
Kind regards
modified on Thursday, July 3, 2008 5:16 AM
|
|
|
|
|
Tomerland wrote: All variables are floating point. This line is excecuted millions of times.
Now I think about improving runtime by using inline-assembler.
I would recommend you to not use inline-asm for various reasons, but the primary reason is "there must be a better way".
A few things to reflect upon:
1. Floating point instructions are slow.
Does it have to be floating points or would integer values suffice?
2. Updating an array of floating points is rarely a "bottleneck" from a data administration point of view. You rarely take time critical actions based upon floating point calculation with e.g. 15-bit exponent and a 64-bit mantissa which is what you have when using long double .
If you're doing this from your GUI thread it will become unresponsive and the user will experience the UI as hung, but that's another problem.
Is it not possible to calculate the new values of the array in a worker thread and post a message to the GUI thread when the calculation has finished?
3. How about using integers that are multiplied by e.g. 100?
When you calculate with the values you have two "decimals", but when you present the value to the user, or store it, you can convert to a floating point value.
I used this technique in an embedded system that had no support for floating point values, but I multiplied with 16 instead which was a good enough approximation.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
A few ideas:
1. Since the line is executed millions of times, you may be able to speed it up with loop unrolling http://en.wikipedia.org/wiki/Loop_unrolling[^].
2. Every time you do pY[j], it requires a multiplication and an addition. If you're processing the array sequentially, it would be faster to start with a pointer to pY[0], then increment it to get the next array element.
If you show some more surrounding code, we may be able to see some other optimizations.
|
|
|
|
|
How to solve that problem in C language?
//struct BB; ?? Is there something similar as declaring class BB; in C++ ??
struct AA {
struct BB bb;
int a;
};
struct BB {
struct AA aa;
int b;
};
AA has BB member and BB has AA member.
chesnokov
|
|
|
|
|
As far as I know it will not work with C++ either. You have to use pointers to struct's. Like this
struct BB;
struct AA
{
struct BB* bb;
int a;
};
struct BB
{
struct AA aa;
int b;
};
This will work for C as well.
-Saurabh
|
|
|
|
|
No that also fails in compilation:
typedef struct _AA {
BB* bb; <--- C2016, C2061
int a;
} AA, *PAA;
typedef struct _BB {
AA* aa; <--- C2016, C2061
int b;
} BB, *PBB;
chesnokov
|
|
|
|
|
You forgot the forward declaration for struct _BB, try this.
struct BB;
typedef struct _AA
{
struct BB* bb;
int a;
} AA, *PAA;
typedef struct _BB
{
struct AA* aa;
int b;
} BB, *PBB;
-Saurabh
|
|
|
|
|
But you can not do that???
AA aa;
aa.a = 1;
aa.bb->b = 1; //error???
chesnokov
|
|
|
|
|
Should be aa->bb->b = 1;
-Saurabh
|
|
|
|
|
???
AA aa; //it is allocated on stack
aa.a = 1; //there is no error here
aa.bb->b = 1; //the error is here stating
error C2037: left of 'b' specifies undefined struct/union 'BB'
You will get the same error with
AA* aa;
aa&gt;bb->b = 1;
chesnokov
|
|
|
|
|
Oh Yes that one compiled
struct BB;
struct AA {
struct BB* bb;
int a;
};
struct BB {
struct AA* aa;
int b;
};
And that one also.
struct BB;
typedef struct _AA {
struct BB* bb;
int a;
} AA;
typedef struct _BB {
AA* aa;
int b;
} BB;
chesnokov
|
|
|
|