|
When I use resizeTo(...) function in Javascript, it resizes the target window. I would like to know what is the event which is generated here which is handled by the Browser to resize the window.
We have a browser in which I have to implement this functionality and I am not able to do it. Our browser window is not getting resized. If anyone of you know how to do this, PLEASE let me know.
Thank you in advance.
|
|
|
|
|
I am trying to declare a CRect m_rect[m][l]; but the program throws an error saying undeclared identifier. I just copied this line from another program. it seems to work fine there. except when i change the variables from m and l to any other variable it gives the same error. why is this? is there any place i have to declare the variables m and l
|
|
|
|
|
If you are using VC++ 6.0, then you will have to do it dynamiclly. I think VC++.Net 2003 will allow this.
Or, you could use a #define or const int m = 4;
I'm just guessing here.
Larry J. Siddens
Cornerstone Communications
TAME THE DOCUMENT MONSTER
www.unifier.biz
|
|
|
|
|
swerajan wrote:
...the program throws an error saying undeclared identifier.
Actually, the compiler is what throws the error, not your program. In any case, the compiler error contains the line and the name of the identifier that it found no declaration for. Declare it and you'll be good to go.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
I'm assuming (yeah, I know what happens when I assume! ) that they were already delcared. Something like this:
int x;
. . .
x = 4;
CRect rect[x];
I don't think the VC++ 6.0 allows this. I know that it was added to the C++ Standard (but don't think MS implemented this yet). If I'm wrong...
Larry J. Siddens
Cornerstone Communications
TAME THE DOCUMENT MONSTER
www.unifier.biz
|
|
|
|
|
I have to do a project working with graphs and the shortest path. It would be cool if I could get my hands on a class that makes a graph from a file and has functions to find the shortest path written in c++.
|
|
|
|
|
Try the boost graph library[^]. It might look a little hairy if your not used to _lots_ of templates, but it comes with plenty of examples
HTH
Ryan
|
|
|
|
|
Excellent, thanks.
|
|
|
|
|
hi. I have a problem:
I have the content of a file read in a BYTE array and i want to open that file with a COM component within my app. The problem is that this COM component only accepts files from a logical disk path.
I can't write it to disk and then tell the COM component to fetch it because i have security issues and it would be very bad.
Is there a way to simulate it or is there a very good way to camuflage a temporary file?(it cant be deleted while the program is in use)
Thanks in advance!!
|
|
|
|
|
Try to use CMemFile MFC class.
|
|
|
|
|
Hi there
I am writing a video capture application using an SDK from the video capture card manufacturer. So far I have been able to display the real time video in a window, my next step is to process single frame information which is stored as a bitmap in a buffer. This buffer is defined as follows:
PVOID pBuffer;
I cannot change this buffer at all as it is part of the SDK. The information stored in the buffer does not need to be changed at all.
I can access the address of the buffer by just using pBuffer, but if I try and de-reference it by using *pBuffer I get an illegal indirection error.
There is no explanation for the PVOID type in the MSDN help apart for "a pointer to any type".
Can anyone help?
Thanks Dave
|
|
|
|
|
A PVOID is simply a void* , so you'll need to cast it in order to do anything with it, e.g. byte* dbuf = (byte*)pBuffer; .
- Mike
|
|
|
|
|
Mike
Ok so dbuf is a pointer to a single byte in your case.
byte* dbuf = (byte*)pBuffer;
Does this not point to the first byte in my pBuffer? How do I access the rest?
In my case the buffer pBuffer contains all of the byte data for a bitmap image the image is size 768 * 576 = 442368 bytes plus any header information etc etc.
Thanks
Dave
|
|
|
|
|
Dave Harper wrote:
How do I access the rest?
Use the pointer like an array: dbuf[0] accesses the first, dbuf[1] accesses the second byte, etc.
- Mike
|
|
|
|
|
Thanks i see now.
One problem is how do I find how many bytes are in pBuffer or dbuf to know how far to increment the array?
I have tryed sizeof(pBuffer) also sizeof(dbuf) problem is it returns 4 as the result do you know of a way i can write the info to a txt file to be able to see whats going on? im using ofstream at the moment it doesnt display byte info correctly.
Thanks
Dave
|
|
|
|
|
Dave Harper wrote:
I have tryed sizeof(pBuffer) also sizeof(dbuf) problem is it returns 4 as the result
That is because pBuffer is a pointer and that pointer is a 32-bit memory address and 32 bits is 4 bytes.
|
|
|
|
|
Dave Harper wrote:
One problem is how do I find how many bytes are in pBuffer or dbuf to know how far to increment the array?
You cannot get this information from the pointer itself; the SDK should provide a way to get the size of the buffer or at least a way for you to calculate it yourself.
Dave Harper wrote:
I have tryed sizeof(pBuffer) also sizeof(dbuf) problem is it returns 4 as the result
When you use sizeof() on a pointer type, the result is the size of the pointer itself -- 4 bytes.
- Mike
|
|
|
|
|
|
Yup I sure do my head is thinking to hard not seeing the light
Thanks
Dave
|
|
|
|
|
What part of my response was incorrect?
- Mike
|
|
|
|
|
None mate its just me, sometimes i think so hard about solving something i cant see the woods for the trees.
Thanks
Dave
|
|
|
|
|
My console app consists of several classes of objects that interact with each other based on user input and predefined conditions.
Say I have classes: house, street, building, car, and world. I only need one instance of the class world, we'll call it myworld, and I need each object to be able to access functions and attributes of myworld. World is already declared as a class in world.h and it is implemented in world.cpp. When I try to create myworld in my globals header file, all of the objects dont recognize it as a type. If I create myworld just before the main function, everything works, I get no errors, until I try to access it from other objects. For example, on creation of a building object, I want to be able to modify the myworld objects count of buildings in the world.
Some people have suggested simply making all of my classes subclasses in the class world, I really dont want to do that for sake of organization. My class definitions are long.
What is the best way to go about this? I just want one instance of a class thats available globally.
|
|
|
|
|
The 'proper, modern way' would be to use a singleton[^]. But you should probably start off using a global static class. Declare an instance of your class as static at the bottom of its header file.
Ryan
|
|
|
|
|
I declared a global static class, and it was indeed available to all objects. Thank you for the advice. Eventually I'll do the singleton method. The only problem now is, for some reason, objects are incapable of modifying public attributes or calling public methods of the global class.
Lets go back to my example. Before I had the global class, when constructing a "building" object, I had to pass it the myworld object constructor. The constructor would initialize certain variables, and call some initializing member functions. It would also call a member function of the myworld object, that would essentially(on the myworld object side) just increment the building count attribute of the world class. Before and after building object construction, I cout'ed myworld object's building count. It didnt change.
Now, with the static global object myworld, the results are the same. Myworld just refuses to change. Building has been made a friend class to the world class. In fact, nothing is private in the world class.
Just to check my coding, I called world class member functions and modified building counts directly from the main function, and it worked. It just doesnt seem to want to be modified by another object.
Any ideas?
|
|
|
|
|
immanis wrote:
Some people have suggested simply making all of my classes subclasses in the class world, I really dont want to do that...
Nor would you want to since nothing else (i.e., house, street, building, car) is a type of world.
One solution would be to mimic the way MFC does it. When you create a project, you have a CWinApp -derived class (e.g., CMyApp). Nothing else in the project is derived from CMyApp, yet you have access to CMyApp via functions like AfxGetApp() . Make sense?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|