|
ScotDolan wrote: Where does the dll get it's runtime priority? Is it from the calling appication or do i have to sent it myself.
DLLs don't have a priority - threads and processes do. So, yes, the priority of the DLL's code will come from the calling app.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi,
if your program's performance isn't what it used to be, then you must have changed something. Assuming all the functions and data structures remained the same, it must be related to compiler/linker settings, e.g. maybe your EXE was and still is optimized, but your new DLL is not? I suggest you compare the DLL settings with the current or previous EXE settings.
|
|
|
|
|
Hello everyone. I come from a Delphi background to VC++ 2008. I have searched the board and articles for my "problem" but to no avail. I hope someone out there can help me with this even tho it may sound like a very dumb question. The entire problem could probably be resolved with a different approach but this is what I have so far so feel free to modify/suggest whatever you feel may help.
1. after a button is clicked, a do ... while loop is started
2. in the middle of the loop, webBrowser is "told" to do a webBrowser->Navigate
3. an url keeping variable is updated by incrementing one of the integers needed to get the right url
4. integer variable is incremented
5. loop keeps going up and webBrowser navigates again (this time to a different address) until the integer variable = user specified number
This loop can, based on user input, be executed 10+ times or so, basically telling the webbrowser to navigate to 10 different urls.
The problem is - the loop will prevent the webbrowser to fully finish loading the site and at the end it manages to navigate to 1 url only.
I understand that I need to use the DocumentCompleted event on the webBrowser.
The question is: how do I combine the loop with the event?
Is there backgroundworker or some other component I should use?
I hope I provided enough info for the answer. Feel free to ask for more details/code if needed.
|
|
|
|
|
You're going to be hosting the web browser in some window - a dialog or a view. You'll need a class for that window. Add a method to construct the url and tell the web browser to navigate to the url. Call that method from your dialog's OnInitDialog method (presuming you're using a dialog). Add the counter as a private data member of that class. Increment the counter in the DocumentCompleted event handler and call the navigate method you wrote earlier from there (as well as from OnInitDialog). The while loop is effectively subsumed into the window's message loop.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thank you very much.
I did as you said and I got what I was looking for.

|
|
|
|
|
Excellent! That's always the desired outcome
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi,
Just so that I understand the dervied base concept
Is the only difference between these 2 peices of code the way the code is executed
and Storage lay'ed out
class A : public B, C
{
}
class A
{
class B;
class C:
}
In this first case base class B gets created then C the dervied class A
in the second A gets created then B then C
functionally these 2 peices of code couls act alike ???
thankx
|
|
|
|
|
There's a big difference between multiple inheritance and nested class definition (BTW your second piece of code as it stands would hardly compile), I believe.
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]
|
|
|
|
|
ForNow wrote: Just so that I understand the dervied base concept
Your understanding is not accurate/complete. Again, I strongly urge you to do more studying starting with materials that are targeting beginners.
|
|
|
|
|
thought I did apperantly not I have been using Bjarne Stroustrup Book
seems like the best one I'll do more reading
|
|
|
|
|
Hi,
Sorry for delayed response...( as I Sabbath Observing jew)
The Book I am using to teach me C++ programming Language 3rd Edition
By Bjarne Stroustrup
I re-read chap 10 (classes) 12 (derived Classes) and 15 (Class
Heriachies)
In 10.4.6 "Class Objects as Members" there is an example of Nested
classes the autor explains using the example in The Book
class Club
{
string name;
Table members;
Table officers;
Date founded;
that in the above example the Class Club gets contructed first
and then each of the other classes in the order they (the classes)
are declared in the consturcter
in which case the refereced class gets constructed
In derived Classes the Base always gets initilized first
Hope I am doing better and thankx
|
|
|
|
|
Hi
I have an Object/Class derived from Cevent I would some how like to instantiate it
well actually make a global copy of it via the new operator on the Heap available For
the entire app
I know using the static keyword I can acoomplish this
e.g .static Myevent Myevent1; however using the new operator presents a problem
So....
I ended up allocating the storage required on the Heap
myeventptr = HeapAlloc(GetProcessHeap(),0,sizeof(MyEvent))
and the then kicking of the constructer via myeventptr->MyEvent::MyEvent(....);
is this going to create the object for me ???
thankx
|
|
|
|
|
What about the singleton pattern [^]?
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]
|
|
|
|
|
|
ForNow wrote: I ended up allocating the storage required on the Heap
myeventptr = HeapAlloc(GetProcessHeap(),0,sizeof(MyEvent))
and the then kicking of the constructer via myeventptr->MyEvent::MyEvent(....);
is this going to create the object for me ???
You really don't want to do that. Pallini probably has the solution you should use but what you described is covered in C++ with Placement new[^]
As always I strongly recommend novice C++ developers not to make stuff up. There exists an enormous amount of information freely available on the internet. Use it or make up your own stuff, it's your choice.
|
|
|
|
|
thankx for that info aboutr placement that was in 10.4.11
seems like chap 10 12 and 15 are key for me to understand
thankx again
|
|
|
|
|
ForNow wrote: well actually make a global copy of it via the new operator on the Heap available For the entire app
Ummmm - why? You don't need to create a global object on the heap.
If you're just writing an app (and not a DLL), I'd do this:
(in the .h file)
Myevent& GetMyEvent();
(in the .cpp file)
Myevent& GetMyEvent()
{
static Myevent theOnlyMyevent;
return theOnlyMyevent;
}
or (if I was being a little more rigourous)
(in the .h file)
class Myevent : public CEvent
{
public:
static Myevent& GetMyEvent();
your stuff
private:
Myevent();
~Myevent();
Myevent(Myevent const&);
Myevent& operator=(Myevent const&);
);
(in the .cpp file)
Myevent& Myevent::GetMyEvent()
{
static Myevent theOnlyMyevent;
return theOnlyMyevent;
}
then you get the event object with Myevent::GetMyEvent();
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Clever!
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]
|
|
|
|
|
Sorry about the vague subject title, but I can't really think of a better way to describe it. Say I have this class:
class Foo
{
public:
Foo();
~Foo();
virtual void DoSomething(void *p)
{
if(Next)
Next->DoSomething(p);
}
Foo *Next;
};
I derive from it:
class Bar : public Foo
{
public:
Bar();
~Bar()
void DoSomething(void *p)
{
if(p)
free(p);
}
};
Say I call Bar->DoSomething((void *)0x1234). It will (hopefully) free the pointer. Is there any way to ensure that Bar does what it wants, then drops down to Foo's implementation afterwards?
|
|
|
|
|
void DoSomething(void *p)
{
Foo::DoSomething(p);
if(p)
free(p);
}
That's how you call the base class implementation.
Looking at your code one might be concerned that you are heading towards trouble. Have you read the book Effective C++, you should. Also you should be studying Design Patterns.
|
|
|
|
|
Thanks for the references, I'm ordering one ASAP. I'm aware that I could explicitly invoke the base class' method beforehand, I was looking for a way to make the invocation implicit, and the base class' method is invoked after the derived class' method. Something like this:
Bar::DoSomething
Foo::DoSomething
In what way am I heading towards trouble?
FWIW, I wasn't the one who univoted
modified on Saturday, April 25, 2009 10:13 AM
|
|
|
|
|
Computafreak wrote: In what way am I heading towards trouble?
The scope of that question is far to large to discuss in a forum which is why I referred you to other sources. However a quick couple of points I will provide are; 1) your notion of calling the base class method after the Bar method. Notice in my posted example the base class is called first. That is because in your posted code the Bar method frees the memory.
void DoSomething(void *p)
{
if(p)
free(p);
}
Calling the Foo method after that would result in the Foo method having an invalid pointer.
2) Also using void pointers is NOT Best Practice. Strongly Typed code is preferable.
Anyway all of these types of problems are covered in materials such as the ones I pointed you at. How do you think I know about them? I didn't invent anything you know, I learned from others. 
|
|
|
|
|
The second problem is simply a problem with my example. I was in rather a rush, so apologies for causing the misunderstanding. I hadn't thought about the first problem though. You're right; the base class' method should be called first. But is there any way to make this call implicit?
|
|
|
|
|
Computafreak wrote: But is there any way to make this call implicit?
Not sure how to respond to that. If you have to do something to make it happen then it can't be implicit can it? If they made that implicit, then you would have to do something to eliminate the base being called. It seems the current way is more obvious therefore easier to understand, yes?
|
|
|
|
|
What I mean is this. Normally, when the derived class' method is called, the base class' method is not. What I'm looking for is how to make the base' class method be called, and then the derived class' method
Example: I call Bar->DoSomething((void *)0x12345), the parameters are pushed onto the thread's stack, and Bar::DoSomething is invoked. I want the parameters to be pushed, Foo::DoSomething to be called (the base class) and then Bar::DoSomething to be called (the derived class) automatically
If it helps, a little background. I have a Stream base class. It has a LinkedStream property, which refers to a Stream pointer. When I call Stream::Write, I want to call LinkedStream->Write beforehand, then pass the arguments to the derived class' write method
|
|
|
|