MFC - Check if Microsoft Word Program Exists - visual-c++

I was wondering if there is any way to figure out programatically if Microsoft Word (Word 2003) exists on the target PC. Creating this app on VS2005, C++.
Thanks

You could create a new Word.Application COM object and read the Version property. Unfortunately that would take a few seconds until Word is loaded. (That is if it is installed)
If you cannot create the object, then Word is not installed. If it can be created and has a lower version number, only an old version is available.

Looping over the registry keys is an option e.g: all entries under HKEY_CURRENT_USER\Software\Microsoft\Office and see what the most recent version is. Depends on your performance and exact requirements.

The easiest way is probably to check the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office registry keys.
Under this tree there is a node for every version of Office, and under each version the installed projects have their own sub-key (Excel, Outlook, Word etc) that specifies the path it was installed to.
Note there may be multiple versions installed on a single PC. E.g. I have;
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\9.0
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\11.0
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\12.0

Related

Can I provide multiple copies of a VSTO document-level Excel app without publishing each one separately?

I have created an Excel document-level customization in Visual Studio 2017 using Windows 7. The document provides a set of tools for charting and analyzing data that are contained in several worksheets within the document.
I would like to provide the end user multiple versions of this document without publishing each one separately. Each version differs only in the data that will be contained. All the code, classes, subs, and functions would be identical for each version. I was hoping they could
rely on the same assembly.
I tested this by publishing a document (named DocumentA) on a test PC (Windows10) and then copying an additional file (named DocumentB). Trying to open DocumentB in Excel produces the following error:
Could not load assembly "DocumentA", Version 1.0.0.0. Culture =Neutral or one of its dependencies. The System could not find the file specified.
I think I understand why this happens. However, if I save the original published document DocumentA as DocumentB1, I can open the renamed file
with no problem. Not sure why this works and the other case does not. The property settings for assembly name and location were identical for DocumentA and DocumentB.
Is there any type of work-around? Or must I publish each of these additional documents separately?
Thanks!
I would like to provide the end user multiple versions of this document without publishing each one separately.
You need to create separate document level add-ins then. Or you may consider developing a single application-level add-in instead. See Walkthrough: Create your first VSTO Add-in for Excel for more information.

SSAS 2012 visual bug?

Has anyone else seen this? missing dsv
Normally when you are looking at a DIM in SSAS you have three sections to work in.
1) Attributes: These are the values you are including in your model
2) Hierarchys: If you build a hierarchy here is where it is viewed
3) Data Source View: This shows the source of the DIM and all the attributes loaded into the DSV are included.
Why is my DSV box empty?
I'm using TFS source control. I've deleted the local project and repulled the latest version but I'm still seeing this issue.
I'll submit an offical bug on microsoft's website.
If you have seen this how have you fixed it? I need to add new attributes to my DIM and I can't do that if I can't see the source table in the DIM...I'd prefer to not have to recreate ever DIM because of some bug.
I found a solution to this if anyone else comes across it. It has to do with having more than one version of Visual Studios installed on the server at a time and using different versions.
This article goes into detail on the issue. The article talks about changing the XLM code for the .dsv file and the .cube file. Specifically for the DIMs you will need to change the code there as well. Quite annoying...at least there is a way to fix it.
https://blogs.msdn.microsoft.com/sqlblog/2015/06/10/ssas-dsv-com-error-from-ssdt-ssas-design-data-source-view/
TLDR: VS 2012 and VS 2014 conflict with each other with their dll files. You will need to go into the XML code and change the leading binary string to the version of VS that you want to use.

how to check if ms office product is installed and version of it VC++?

I want to find whether ms office is installed and version of it...
how can i do it ?
Microsoft Office Version Detector
How does it work?
The code is based on an outdated Microsoft knowledge base article Q247985 (the code in the knowledge base article does not work for Office 2003 or 2007). The code looks for a specific registry key which holds the version for each application (e.g. HKEY_CLASSES_ROOT/Excel.Application/CurVer for Excel) which contains the version encoded in a string ("Excel.Application.11" on my computer). The internal Microsoft version number (i.e. the "11" at the end of "Excel.Application.11" ) is then mapped to the external "marketing" name, that you will be more familiar with (e.g. the internal version "11" is more commonly known as "Office 2003").
Since you've tagged it as visual C++, I'm assuming you want to do it in C++.
One way is to parse through the following registry key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
For e.g.
Enumerate this key and find out if the value displayname contains Microsoft Office Excel MUI (English) 2007
You may also find the version number in other values like version, versionmajor, verisonminor
FYI you can use this registry key to find out almost any software which 'installs' on your system.
This is only for 32 bit installation though. For 64-bit installation, you'll need to find a similar tree structure inside registry node WOW6432Node.

Manage spreadsheet versioning

We have a lot of VBA code in spreadsheets and a lot of time people save them to local drives. When we want to upgrade the spreadsheets we push a new version out to a shared drive but dont have any way of enforcing that people dont use the old versions of the spreadsheets.
Is there some best practice here to deploy vba spreadsheets so if someone loads an old version it wont open or will ask you to upgrade. It seems like this must be an issue for any custom solution so i would have through MS would have some solution here.
Does microsoft have a standard versioning / deployment solution for this or do i need to come up with some home grown solution (spreadsheet pings a database on startup to check version)
If its just the VBA code you want to be able to upgrade one solution is to separate all the code into an XLA that sits on an accessible server.
then the users Excel has an addin loader that gets the latest version from the server, or you could embed the loader in the workbook.
There is a working example reversioning Addin Loader available at
http://www.decisionmodels.com/downloads.htm
Though I've not done this. I've see people do something similar where they store the code in dlls in the database, and then verify that the local ones are the same on start up.
Add a custom property to the workbook, such as a GUID, Integer, Date, or whatever you need. On startup, check the value and determine if VBA should continue or whatever implementation you decide. Usually, I open the "shared" latest version of the document and inspect its custom property. If user is not using latest version, display a message prompting the user to get the latest version. This is usually good enough. I have done this for years with great success for Access, Word, and Excel VBA.
One real problem is people who ignore the prompt to update. They will do this because they fear losing data, bugs in latest version, and so on. You need to address their concerns and not try to "lock" them in to your "solution" to this problem. I strongly recommend you always provid a means of "importing/upgrading" data to latest version of workbook.
Fairly simple to implement. If you address the above mentioned problem effectively, people will start to trust the "prompt" and you will find this is a really simple and effective solution.
If you workbook is tied to a database, it gets a little more complicated. Generally, you do not allow the user to maintain the data outside of the database. When they want to modify the data, you generate the workbook for them. After they are done modifying data, you import the data. (The workbook is saved for "backup" purposes or the user can maintain a copy of the workbook for reference or an archive.) This has the advantage of eliminating the need to maintain document version since the document is "virtual".
Define a current version property. Use whatever way for that, like a constant in VBA.
Find a standard way to access the latest version. It could be on a shared drive always on the same path, or whatever other means you have.
If current version number < latest version number then:
Ask to upgrade
Show the upgrade procedure
Possibly do some locking on normal VBA operations until the upgrade is done
An easy solution would be:
Store a version number somwhere in the workbook (on a hidden sheet for example so that it will not get removed accidentally) or as a variable.
Store a text file with the latest version number on your share
Include a macro which automatically reads the latest-version-textfile and compares the version number to the one in the currently running workbook. If its too old just show a message-box (telling the user to update) and close the workbook.
I'm using a similar approach and it works fine.

Where can I find an online function reference for LoadRunner?

Is there an online reference manual I can query which contains details of LoadRunner functions such as:
lr_start_transaction
web_url
web_submit_data
web_custom_request
lr_end_transaction
etc.?
Essentially, I want to be able to find out about these functions without having the LoadRunner environment licenced/installed.
There doesn't seem to be a web-based function reference but a ZIP file of Windows HTMLHelp (.CFM) files (the LoadRunner 9.10 VuGen API Reference) can be downloaded from here:
I found this by searching the HP Software Product Manuals with the following details (requires free registration):
Product: LoadRunner
Product version: 9.10
Operating system: Windows
I tried version 9.50 as well but it did not provide a link...
One gotcha: once I had the .CFM on my machine I had to 'Unblock' them via the Properties dialog otherwise I got the 'This program cannot display the webpage' message within HTMLHelp.
Every copy of LoadRunner ships with a soft copy of the manuals.
The official reference would be at Help >> Fuction Reference in HP Loadrunner:
You can do "quick searching" by clicking on the index:
The reference is actually made up of html files (located at HP\Loadrunner\help\function_reference\FuncRef.htm), so they can be viewed directly in any browser.
(Btw, there are many useful gems within the Loadrunner\help folder too, especially the PDFs tutorials.)
Try the search # http://loadrunnertnt.com or ask #
LoadRunner Group

Resources