|
I have a program that embeds Word through DsoFramer, but I need to know which version (2000/2003/XP/2007/2010) is installed because I need to adjust some things depending on the installed version.
Does anyone know how to do that? I have a pointer to the CApplication interface, and I can probably get any interface that's needed.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
If you can get the path to Word's executable you might try using GetFileVersionInfo[^], this is just an idea, am not sure if Word's executable(s) actually contain(s) this or not, but you can check.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
I did find an article via Google some time ago which described it, but unfortunately I cannot remember how (maybe "office registry keys" or something). However if you look at a key similar to
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\11.0\Registration\{91130409-6000-11D3-8CFE-0150048383C9} you can find the values. You may need to enumerate some of the keys looking for "Office" etc but it should not be too difficult.
It's time for a new signature.
|
|
|
|
|
There is 'Version' property on CApplication interface.
Moreover, DsoFramer is no longer recommended or supported by Microsoft. It has several known issues with modern office applications.
|
|
|
|
|
Thank-you kindly.
The following VBA code gives me word version as being 12 (when using office 2007)
Sub getWordVer()
Dim wordApp As Object
Set wordApp = CreateObject("Word.Application")
wordApp.Visible = True
wordVer = wordApp.Version
MsgBox ("Word version: " + Str(wordVer))
End Sub
modified on Friday, July 16, 2010 4:01 AM
|
|
|
|
|
Thanks, this seems the best solution. Can you tell me what the known issues are? I'd like to know to see if they will affect my project.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
as you know, DsoFramer appeared in msdn KB articles as a sample of OLE on office applications. Latest office applications are actually not meant to be embedded. DsoFramer was declared as dead and no longer available in msdn samples.
One way to embedd office applications is to load them inside web browser control and do some registry modifications to force IE to embedd office applications. Still i think you will be missing some features like ribbon control in Office 2007 and 2010.
modified on Wednesday, July 21, 2010 10:41 AM
|
|
|
|
|
Hi All,
I am using CreateFile to open a specific file which will be accessed by multiple instance of same process simultaneously. This time function getting failed and GetLastError() is returning the following error.
"The process cannot access the file because it is being used by another process."
This is how i called the function
hFile = ::CreateFile( csFileName_i.operator LPCTSTR(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
if( INVALID_HANDLE_VALUE == hFile )
{
CString csErr;
csErr.Format( _T("Failed to open File**** Error code = %d"), GetLastError());
AfxMessageBox( csErr );
return bRet;
}
I need to open the same file simultaneously by different process.
Please help me.
-Cvaji
modified on Thursday, July 15, 2010 9:30 AM
|
|
|
|
|
Is one of your processes writing to the file (looking at your other question)? In that case you need to specify the sharing mode there too.
|
|
|
|
|
Cvaji wrote: hFile = ::CreateFile( csFileName_i.operator LPCTSTR(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );if( INVALID_HANDLE_VALUE == hSMPFile )
The return value of the CreateFile is stored in hFile , but you have checked the INVALID_HANDLE_VALUE aganist hSMPFile file. Is it really like that in the code or its just a typo?
|
|
|
|
|
sorry my friend..its just a mistake..
|
|
|
|
|
Even though my application is only doing the file read,
::CreateFile( csFileName_i.operator LPCTSTR(), GENERIC_READ, FILE_SHARE_READ|<big>FILE_SHARE_WRITE</big>, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
this made it work. Strange
|
|
|
|
|
how can I add Gmail | hotmail support to my MFC application if it is possible?
|
|
|
|
|
If you want to read and write emails, you can host a WebBrowser control[^] in a dialog or view.
|
|
|
|
|
Is there a more straight forward way may be through using a library or something like that?
|
|
|
|
|
|
|
The link isn't working for me.
|
|
|
|
|
|
Hi,
We are using Microsoft provided DOM parser - MSXML2 version 4(or 40)
When we are saving XML file, we are generating whole new file including all nodes and elements. Size of XML file is 3.5 MB. So it is taking 350 MB memory (both virtual as well as physical) Once save is done we are releasing all the XML objects. But there is no change happening in memory. So every consecutive save keeps on increasing memory by 350MB (approx) After 3-4 save we have to restart application again.
We have seen that if we minimize the application physical memory is coming back to original size (mean additional 350MB is getting reduced) but virtual memory is not changing. I think may be OS have reserved that place for application as memory cleaning is not done properly. But we have make sure that we have release all the memory we use.
Some where on some forum we seen a work around like this,
VARIANT_BOOL bstatus;
m_pXMLDomDoc->loadXML(CComBSTR(""), &bstatus );
Release(m_pXMLDomDoc);
That guy suggested that after you release saved document try to load a blank file. It will remove uncleaned area. But there is not much improvement. Please let me know if someone can help me.
|
|
|
|
|
Using which tool did you check the Memory usage? If you checking this from the task manager of window XP, I must say that you should consider only the VM usage, the memory usage it specifies is actually Working Set.
I dont remeber excatly, but there was problem with DOM parser such that it will release the memory completely only when the thread( that created DOM objects are created) is terminated. You can try like, create a dedicated thread to read the data from the XML and once it is done, end that thread and check whether the memory is back to normal or not( VM size, not Memory usage ).
|
|
|
|
|
Ya I am using task manager only.
I also tried to save in thread but no improvements. Same behavior.
|
|
|
|
|
HI,
I have X.dll with some 2-3 functions.
I need to create another Y.dll which calls the X.dll functions.
I can import X.dll and its function and use in .exe
But i don't want to do that.
I need to know how to make it an .dll file with different function prototype.
Can anyone pls. help on this issue.
|
|
|
|
|
The process is just the same as making X.dll, which probably used the functions of some other (Windows) dll. Just add the relevant header files to your source code and the X.lib to the link section of your build.
It's time for a new signature.
|
|
|
|
|
Do i need to call the load library function and Get procAddress in it to load the X.dll or not.
If so,I should have another function prototype which calls this dll's function and should return some value right?
I am confused in this.
can u giv any sample code link pls.
I am struggling on this
|
|
|
|