|
I am learning COM. And has come to know about one of the Advantages of the COM over .dll file. That
It extends the functionality of (client)application without rebuilding.
I.e. If you make the changes in function of .Dll File which client application is using you need to recompile the application. But if you are using the COM you dont need to do recompilation of client application
But How ?? afterall the COM (In-process COM) is also a .dll
|
|
|
|
|
GauranG033It extends the functionality of (client)application without rebuilding.
That's the same as with a dll. Are you sure they were saying that you cannot do that with a dll ? Where did you read that ?
|
|
|
|
|
Hey thnx. This is the article I am refering to learn the COM component.
http://www.codeproject.com/com/COM_from_scratch_2.asp[^]
I don't know its my mistake in understanding the concept or its authors mistake.
just find out the following line in the below link and the paragraph above it says what creates a doubt in my mind
Conclusion: COM extends functionalities of applications without rebuilding
|
|
|
|
|
GauranG033 wrote: This is the article I am refering to learn the COM component.
I would not recommend that as a beginner COM article. That article is dealing with a very specific subject, it does not appear to be "beginning COM" article.
GauranG033 wrote: It extends the functionality of (client)application without rebuilding.
The article that is from is about building a component "factory". It just happens to use COM. The "factory" concept could be reproduced using native C++ and DLL's without any COM. So your statement that this is an "advantage of COM over DLL" is not true.
|
|
|
|
|
If you are not changing the signature of a dll function, you need not to recompile the application again.
This is the same case with com.
There is one property of a COM that once an Interface is published, it is not changed any more.
This means that once you write any function in an interface, you are not going to change it's signature.
If you want to do so, you need to publish a different interface with new function signature.
So Now all you got is a com component with two different interfaces that are exporting two versions of your function.
So in this case, your application need not to recompile, cause the function it wants still exist there.
|
|
|
|
|
is that mean everytime I will add some new function and Compile it. It will generate new Interface with differnet version number.
|
|
|
|
|
It is your duty to follow the rules.
But you can surely add more functions to the existing interface you created.
I will try to explain the need of not modifying existing functino using a simple example.
Suppose an Application A is using a dll D. Another application A2 is also using the same dll D. Now if the user installs new version of A2 in which the dll D function signatures got changed, then the user can't use application A.
To avoid this situation, people often use version no. in the dll name for ex. MFC42.dll.
Now if you are using COM, you will write new interface if the function signature chanes, without changing the earlier one, so both the applications will work even after installing new versions of application A2.
|
|
|
|
|
Hi!
I am trying to add information in an access database but when i try sending the information to the database, i keep getting the error message that the record set is read Only. I expected it to be the default "CRecordset::none" flag but i don't know what the problem is. The database has two table but currently i am using only one.In the appWizard i choose to include the two tables.
Below is the code that i have attached to the "add records" button:
(I haven't finished attatching all the CEdit controls becaue of the problem.) Please Help
void CRegistrationView::OnAddrecords()
{
// TODO: Add your command handler code here
// TODO: Add your command handler code here
// Get a pointer to the record set
CRecordset* pSet = OnGetRecordset();
// Make sure that any changes to the current record
// have been saved
if (pSet->CanUpdate() && !pSet->IsDeleted())
{
pSet->Edit();
if (!UpdateData())
return;
pSet->Update();
}
// Add the new record
m_pSet->AddNew();
// Set the registration(Primary Key) in the new record
m_pSet->m_Registration_Number=m_strNew_Registration_Number;
// Save the new record
m_pSet->Update();
// Refresh the record set
m_pSet->Requery();
// Move to the new record
m_pSet->MoveLast();
// Update the form
UpdateData(FALSE);
}
Wamuti: Any man can be an island, but islands to need water around them!
Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
|
|
|
|
|
This has nothing to do with your problem of adding records, but I question your use of comments. Why state the obvious? For example:
Wamuti wrote: // Add the new record
m_pSet->AddNew();
Wamuti wrote: // Refresh the record set
m_pSet->Requery();
Wamuti wrote: // Move to the new record
m_pSet->MoveLast();
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Wamuti wrote: ...i keep getting the error message that the record set is read Only.
When? How are you opening the recordset? Are you using a DSN, and if so, is it read-only?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Firstly, thanks. The reason i am having comments is that i am using code from a tutorial because i am not very experianced in MFC programming.
I am using the appWizard and used the recordset type snapshot (Not the Dynaset). I am not sure what DSN means but i have not changed any setting but the book i am using states that on using the snapshot, it should be set as "CRecordset::none".
Wamuti: Any man can be an island, but islands to need water around them!
Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
|
|
|
|
|
Wamuti wrote: I am not sure what DSN means
Data Source Name.
By opening a recordset with two tables, the recordset is inherently read-only.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
What should i do to make the database writable because i still need the two tables and access both tables?
Wamuti: Any man can be an island, but islands to need water around them!
Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
|
|
|
|
|
Update each table separately.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Does this mean that i don't include the second table while creating the project? If this is so, what will i do while assigning variable for the table i leave out while in the class wizard in the Member variables? Thanks, i am learning alot
Wamuti: Any man can be an island, but islands to need water around them!
Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
|
|
|
|
|
Wamuti wrote: Does this mean that i don't include the second table while creating the project?
You'll need multiple recordsets. The one you currently have is for viewing, while updating the tables would require additional recordsets.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks. I am working on it
Wamuti: Any man can be an island, but islands to need water around them!
Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
|
|
|
|
|
Hi,
How can I run MS-Outlook through code.
Thanx in advance.
|
|
|
|
|
See ShellExecute function.
|
|
|
|
|
Also see CreateProcess api.
|
|
|
|
|
Also see here[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
hi,
say for example,
i have created one database application in vc, and i access the MS access database through that.
so first i create a DSN from control panel\odbc datasources.
obviously i have to access that database through the dsn from vc++.
now if i want to install it on my clients machine, i have to copy the files first, then map the DSN and then run the application.
now what i want is, is there any method to automate the creation of DSN, such that, just by a single click on my application, this DSN gets created.
thanks.
|
|
|
|
|
There are a lot of setup-generation suites that allow you to start scripts during the setup-process.
One of these is NSIS[^], and its free even for commercial use.
There are many others. Just google.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
thanks for your reply.
i shall verify the tool.
but i wanted some code snippet which can create the dsn if i supply the database filename and dsn name.
|
|
|
|
|
To be honest, I have not the faintest idea what 'dsn' is.
But as you seemed to know how to make one, I showed you a way how to automate that on your client computers.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|