|
Like form a DLL, you can export a function from an EXE as well.
Ovidiu Cucu
Microsoft MVP - Visual C++
|
|
|
|
|
Can someone tell me what is going on in the ObjectRoot constructor and also how the ObjectRootPtr is declared. Is the pointer pointing to a new array called ms_instances of size 21 and assigns a value of NULL to all ms_instance[0], ms_instance[1],.....ms_instance[20].....
PS: WHAT DOES THE SECOND LINE MEAN .... ARE YOU MAKING THE POINTER ObjectRootPtr point to class member ms_instances of size 21. I thought it was something like ObjectRootPtr = new ms_instances;
typedef ObjectRoot* ObjectRootPtr; <br />
static ObjectRootPtr ms_instances[MAX_INSTANCES];<br />
<br />
RTI::RTIambassador* ObjectRoot::ms_rtiAmb = NULL; <br />
RTI::ObjectClassHandle ObjectRoot::ms_classId = 0;<br />
const char* ObjectRoot::ms_classIdStr = NULL;<br />
<br />
ObjectRootPtr ObjectRoot::ms_instances[MAX_INSTANCES] =
{ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,<br />
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };<br />
unsigned int ObjectRoot::ms_numInstances = 0;<br />
<br />
ObjectRoot::ObjectRoot()<br />
{<br />
if (ms_numInstances < MAX_INSTANCES)
ObjectRoot::ms_instances[ ObjectRoot::ms_numInstances++ ] = this;<br />
}
-- modified at 14:19 Friday 23rd June, 2006
|
|
|
|
|
I'll try to explain line by line.
static ObjectRootPtr ms_instances[MAX_INSTANCES];
Array of static pointers.
RTI::RTIambassador* ObjectRoot::ms_rtiAmb = NULL;
RTI::ObjectClassHandle ObjectRoot::ms_classId = 0;
const char* ObjectRoot::ms_classIdStr = NULL;
Initialization of static and constant static data.
ObjectRootPtr ObjectRoot::ms_instances[MAX_INSTANCES] =
{ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
Initialization of the static pointers defined by the second line above.
Jay03 wrote: PS: WHAT DOES THE SECOND LINE MEAN .... ARE YOU MAKING THE POINTER ObjectRootPtr point to class member ms_instances of size 21. I thought it was something like ObjectRootPtr = new ms_instances;
No. It defines an array of pointers. No instantiation involved. It's easy to understand if you replace ObjectRootPtr with ObjectRoot*. The first line defines this replacement.
Best,
Jun
|
|
|
|
|
For the first part..... what do STATIC POINTERS DO?
In the last part. ObjectRootPtr is pointer to an ObjectRoot object. Now this ObjectRootPtr was pointing to ms_instances[21] of size 21. And finally the ms_instances[21] points to NULL
I believe this is what you meant.
The big picture is:
ObjectRootPtr ---> ms_instances[0] --- > NULL
---> ms_instances[1] --- > NULL
---> ms_instances[2] --- > NULL
---> .............. --- > NULL
---> .............. --- > NULL
---> ms_instances[20] --- > NULL
BTW Thanks for your reply JUN
|
|
|
|
|
The pointers are not static. The memory allocated to hold the pool of pointers is. Basically, they only want to have 21 instances (maximum) of this object. They created a pool to hold references for all active instances. At startup, those instances are initialized to NULL (since they don't point to anything).
The declaration static ObjectRootPtr ms_instances[21] is declaring a static array of 21 pointers to ObjectRoot objects.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
You're right. It's a static array of pointers, not an array of static pointers. Thanks for pointing this out
Best,
Jun
|
|
|
|
|
Jay03 wrote: For the first part..... what do STATIC POINTERS DO?
Static is in terms of scope. Like any static variable, a static pointer is shared by all instances of this class, rather than a specific instance. As a matter of fact, it exists before any instance is created. That is why we refer to it as <class_name>::<pointer_name>.
Jay03 wrote: In the last part. ObjectRootPtr is pointer to an ObjectRoot object.
Correct.
Jay03 wrote: Now this ObjectRootPtr was pointing to ms_instances[21] of size 21.
Well, a correct interpretation should be "Now you define a (static) array (say, 21) of such pointers (ObjectRootPtr)".
Best,
Jun
|
|
|
|
|
If i have an ftp server such as:
tennis.tournament.com:9662
Is there a way in a web browser to pull up that site and include the user id and password in the string so that this data is not prompted.
So for example:
tennis.tournament.com:9662:username:passwd
I know this is possible but the exact characters in between the user name and passwd i am not sure of.
Thanks,
|
|
|
|
|
When i use SHellexecute, i am able to to use the user id and password to get to the ftp server. However, i am attempting to play a .avi file that is on that ftp server. If i were to attach the .avi file name like so:
strFtpVideoLocation = "ftp://usr:paswd@lrgftp.monster-ga.com:9662/test.avi";
ShellExecute(AfxGetMainWnd()->m_hWnd,"open",strFtpVideoLocation, NULL, NULL, SW_SHOWNORMAL );
this does not work to play the video
But i can do
strFtpVideoLocation = "ftp://usr:paswd@lrgftp.monster-ga.com:9662/";
ShellExecute(AfxGetMainWnd()->m_hWnd,"open",strFtpVideoLocation, NULL, NULL, SW_SHOWNORMAL );
without the .avi file name and this takes me to the server with all the files and i have to double clip on the clip that i want. I just want to be able to play it and not have a user double click it to play.
-- modified at 16:45 Friday 23rd June, 2006
|
|
|
|
|
My first post, here. Hope you can help.
Two questions.
1. In a CListCtrl displayed in Report view mode, with a header labeling the columns, I need to trap a mouse right button down message with the cursor in the header. The control has a native function to trap the left mouse button on a click in the header, but neither control nor the dialog are able to see the right mouse button when the header is clicked. It would also be nice to have MFC tell me which column was clicked, but I can do that with a little math on the mouse position and the CHeaderCtrl pointer. (NOTE: I have tried subclassing the CListCtrl CHeaderCtrl member to no avail.)
2. The dialog in question is resizeable. I want to resize and relocate controls on the dialog when it is resized. I can do that in the OnSizing() handler but redraw is very clumsy. I'd rather do it all at once when the resize has stopped. However I can't seem to detect the left mouse button up message from the dialog when the mouse is moving the dialog border. Any way to detect when resizing has finished?
Development is in Visual Studio .Net Professional, 2003 edition
Any suggestions?
Thanks in advance
Scott
Scott P. Chapman
Voss Scientific Inc.
scottc@vosssci.com
|
|
|
|
|
Dear colleagues,
Does anyone know of a way to create a Netscape plugin (in C++) that would be always active for whatever MIME type is currently loaded?
What I need is to slightly modify the contents of any and all pages opened. Please direct me to where to look for a solution.
The Netscape Plugin SDK documentation gives no answer to this. Is it really impossible to "filter" page content?
Thanks in advance!
|
|
|
|
|
in My MDI, i have two toolBars. when run app, the standard toolBar is on top, another toolBar is below it. How can I manage the second toolBar beside the standard toolBar?
thanks
|
|
|
|
|
class CMainFrame : public CMDIFrameWnd
{
CToolBar m_wndToolBar;
CToolBar m_wndToolBar2;
};
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
RecalcLayout();
CRect rect;
m_wndToolBar.GetWindowRect(rect);
rect.OffsetRect(rect.right, 0);
m_wndToolBar2.EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar2, AFX_IDW_DOCKBAR_TOP, rect);
return 0;
}
Ovidiu Cucu
Microsoft MVP - Visual C++
-- modified at 12:34 Saturday 24th June, 2006
|
|
|
|
|
Thank you very much. I spend lots of time trying to figure it out.
|
|
|
|
|
Hi,
Fortitudine Vinsinues!
|
|
|
|
|
Best,
Jun
|
|
|
|
|
Sorry. I don't know what happened. I just pressed the enter key and the message got posted before I could type my question!!
My question:
I have often come across statements such as 'this program has the following modules' or 'the program should have accounting,financing etc modules'.
What exactly are modules? How can one create different modules and then integrate it into the main program in vc++6 using mfc?
Thanks,
Tara
Fortitudine Vinsinues!
|
|
|
|
|
A module is a unit of related code. It is just an organizational term. For example, you may have an accounting module that supports balancing checkbooks, producing income statements, calculating interest and dividends, etc., that is all compiled into a library and used by the main application (which, presumably, would have something to do with accounting). Alternatively, that module could be built as part of the application itself.
The term "module" doesn't convey enough information to tell you how the application is organized, just that it is organized into compartments.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
OK.
I am coding a program that has seprate dialog boxes that do something with budget, payroll, piecharts etc. There are no individual libirary made but the dialog boxes have their own classes. So can I call safely call budget, payroll as modules?
Fortitudine Vinsinues!
|
|
|
|
|
Technically, anything that is encapsulated and full-functional by itself (that is, doesn't rely on something else to fulfill its purpose) can be called a "module". In your case, it is better to call them classes (assuming that is what they are) since the term "class" is a specific type of module (that is, it conveys more information than just calling it a "module").
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Module is probably one of the most frequently used terms in software development. This is a definition from Wiki:
"In computer science, a module is a software entity that groups a set of (typically cohesive) subprograms and data structures. Modules are units that can be compiled separately, which makes them reusable and allows multiple programmers to work on different modules simultaneously. Modules also promote modularity and encapsulation (i.e. information hiding), both of which can make complex programs easier to understand..."
Best,
Jun
|
|
|
|
|
TheinstruTara wrote: What exactly are modules?
One example would be Microsoft Office. The modules that comprise it are Word, Excel, Access, etc. You can add or remove the modules without affecting the others.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
How are they made? How do I go about making them in vc++6. Is mfc enough?
Fortitudine Vinsinues!
|
|
|
|
|
As you see now, module is a pretty vague term. On Windows, they can be a library (Lib/DLL), COM component, executable, now assembly, etc.
TheinstruTara wrote: How do I go about making them in vc++6.
Approximately, if you have a peice of code that accomplish some well defined functionality and you want it to be reusable by other applications, you may build it into a module.
TheinstruTara wrote: Is mfc enough?
Yes. Many other tools/technologies are available as well, like Win32, ATL, etc.
Best,
Jun
|
|
|
|
|
Thank you.
Fortitudine Vinsinues!
|
|
|
|
|