|
|
|
How can I get address of current page in Firefox?
|
|
|
|
|
Its address in memory? Is this a C/C++/MFC question?
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
thanks for your answer. It is obvious that it resides in memory
but how can I find its address. furthermore I think that it is
related to C/C++. take it easy. ![Blush | :O](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_redface.gif)
|
|
|
|
|
|
thanks for your favor. If writing an add-on is intended, it is true
but I don't want to write an add-on. I just want to manipulate it
from outside. ![Smile | :)](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
You could try to get the process handle of Firefox and from that, get the handle of the windows (HWND) and enumerate the child windows to find the one containing the address bar and do a GetWindowText on that child window.
A quick look with Spy++ does not help finding the address bar window (or edit box) so it might be more involved than that
good luck.
I'd rather be phishing!
|
|
|
|
|
It doesn't work. Elements in Firefox aren't standard windows element. They are handled by firefox. try SPY++ to see what I
am talking about.
|
|
|
|
|
Hi all. Suppose a BaseClass has two childs. Now when the childrens' constructors are called, the base class' constructor is also called. Here is the scenario, in code.
class BaseClass
{};
class ChildOne : public BaseClass
{
public ChildOne(){}
};
Class ChildTwo : public BaseClass
{
public ChildTwo(){}
};
Do the childs share the same parent instance? I wanted to know a little more deep information about BaseClass instance and the two child instances. Thanks
This world is going to explode due to international politics, SOON.
|
|
|
|
|
No, if you create two separate instances of the child class, then you also get two separate instances of the base class.
But, of course, any static members are shared between all instances of the base and/or the child class.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
If you mean that base class have same values whenever an object of its child classes are made then yes same class have 'same instance'. But, it is false in the sense that each time an object is created, its new instance is created in memory. So, when you are creating the instance of a child class, its respective base class' instance is also created in memory. And if you are creating two instances of two child classes derived from same base class, then two different instances of base class are also getting created in memory against both child objects.
|
|
|
|
|
An instance of a class is created when memory is allocated for the class.
In the code that you've shown, there is no instance created and no memory allocated.
Refer to the code snippet below -
class BaseClass
{
int base;
};
class ChildOne : public BaseClass
{
int childOne;
public ChildOne(){}
};
Class ChildTwo : public BaseClass
{
int childTwo;
public ChildTwo(){}
};
When an object of ChildOne is created, memory is allocated for int base; and int childOne;
When an object of ChildTwo is created, memory is allocated for int base; and int childTwo;
Here you can see that memory for int base; has been allocated twice, once for the instance of ChildOne and once for the instance of ChildTwo .
So base has separate memory and hence value for each instance.
|
|
|
|
|
Hi,
I am using CreateDIBSection() function frequently in my code but sometimes it is failing.
The value of biWidth is around 6000, biHeight is 4000 and biBitCount is 24 in BITMAPINFOHEADER.
My doubt is on memory, can someone please tell how much meomory is consumed by each call of CreateDIBSection() considering the values which is mentioned earlier.
|
|
|
|
|
How do you know it's failing? Do you get an exeception, error return, message ... ? Please provide proper details of exactly what code fails and what response you see.
Veni, vidi, abiit domum
|
|
|
|
|
I am getting a NULL value in return and ppvBits is also NULL.
Actually sometimes one failure is there at some other place in code while allocating meomory where the i am getting windows error code 8.
So i thought that it could be related to memory which is getting consumed by each call to CreateDIBSection() function though i am calling DeleteObject() after using the bitmap.
Thanks
|
|
|
|
|
Well you need to check the error code every time you get an error response and try to figure out why it is being given. Error code 8 says Not enough storage is available to process this command., so that is reasonably clear.
Veni, vidi, abiit domum
|
|
|
|
|
![Go to Parent](https://www.codeproject.com/App_Themes/CodeProject/Img/arrow-up24.png) The error code 8 I am getting at some other place in code while calling the function ::MapViewOfFile() and not while calling CreateDIBSection().
Following is the code snipet
void create(const CSize& size)
{
initBitmapInfo(size);
mBitmap = ::CreateDIBSection(0,
getBitmapInfo(),
DIB_RGB_COLORS,
(LPVOID*) &mBits,
0,
sizeof(BITMAPINFOHEADER));
if (mBitmap == 0 || mBits == 0)
{
cout << "NcSurface::destroy()-------- mBitmap = " << mBitmap<< endl;
cout << "NcSurface::destroy()-------- mBits = " << mBits << endl;
cout << "NcSurface::destroy()-------- size.cx = " << size.cx << endl;
cout << "NcSurface::destroy()-------- size.cy = " << size.cy << endl;
ErrorInstance::instance()->throwError(__FILE__, __LINE__, GdiException());
}
}
void initBitmapInfo(const CSize& size)
{
BITMAPINFO* bmi = getBitmapInfo();
CHECK(bmi != 0);
bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi->bmiHeader.biWidth = size.cx;
bmi->bmiHeader.biHeight = size.cy;
bmi->bmiHeader.biPlanes = 1;
bmi->bmiHeader.biBitCount = 24;
bmi->bmiHeader.biCompression = BI_RGB;
bmi->bmiHeader.biSizeImage = 0;
bmi->bmiHeader.biXPelsPerMeter = 0;
bmi->bmiHeader.biYPelsPerMeter = 0;
bmi->bmiHeader.biClrUsed = 0;
bmi->bmiHeader.biClrImportant = 0;
}
size.cx = 6000 and size.cy = 4000
|
|
|
|
|
In error situation the code mentioned in the if condition above is getting executed. This error i am getting while executing automated test case and that too very few times.
Basically this is comming when the sysetm run for few hours/days. So I want to know the memory usage of CreateDIBSection() to ensure that it is not craeting holes in memory as it is getting calle dfrequnently in my code.
Thanks
|
|
|
|
|
ash_hdr wrote: So I want to know the memory usage of CreateDIBSection() Task manager will show you the usage of your application. If it keeps growing then you know it's leaking memory.
Veni, vidi, abiit domum
|
|
|
|
|
I already tried task manager to find the memory leak but not able to find it.
But it will be helpfull if i can get to know the memory which CreateDIBSection is consuming everytime it is getting called. Event though DeleteObject() is getting called at appropriate place but i just want to know the hole which is getting created in memory after each usage.
Thanks
|
|
|
|
|
ash_hdr wrote: I already tried task manager to find the memory leak but not able to find it. Task manager won'y help you find the leak, but it will give you an indication of the memory that is being used by your application, and whether it keeps growing all the time.
ash_hdr wrote: if i can get to know the memory which CreateDIBSection is consuming everytime it is getting called. That information is not readily available as it is internal to Windows.
Veni, vidi, abiit domum
|
|
|
|
|
Actually I tried all those things and event some tools also i tried but didn't get the expected results.
How much memory will the ppvBits takes in CreateDIBSection.
|
|
|
|
|
ash_hdr wrote: How much memory will the ppvBits takes in CreateDIBSection. No idea, but you could probably work it out by examining the documentation[^]
.
Veni, vidi, abiit domum
|
|
|
|
|
What is the point of the initBitmapInfo function? It creates a (I assume new) BITMAPINFO structure, initialises it with some values, and then returns without doing anything with it. That looks like a memory leak to me, depending on what getBitmapInfo is doing.
Veni, vidi, abiit domum
|
|
|
|