C++/VB - How to check whether MS Excel is installed or not in the System
Asked By jinagarashwin
10-Apr-08 05:59 AM
Hi All,
I hav an MFC apllication, which is used to store some report data to an
Excel file (using Excel automation process).
Before i store the data to excel file, i need to check
whether MS Excel is installed in the system or not.
if excel is not installed then i have to store the data to text file.
So how do i check whether excel is installed or not using MFC programming?
--
Thanks
Ash Jings
Windows Installer
(1)
Microsoft Excel
(1)
Word
(1)
RegOpenKeyEx
(1)
ProgIDExists
(1)
Word.Basic
(1)
RegCloseKey
(1)
SzProgID
(1)
David Lowndes replied...
Since you will be using the Excel automation interface why not try to
create the Excel object and if it fails you can assume you have to do
the text file option.
Dave
Uwe Kotyczka replied...
I do something silmilar in a program,
I want to check if "Word" is installed.
The idea is to check the registry
weather the key HKEY_CLASSES_ROOT\Word.Basic
exists or not. The function checking this
goes like that:
BOOL bIsWordInstalled = ProgIDExists(_T("Word.Basic"));
BOOL ProgIDExists(LPCTSTR szProgID)
{
BOOL bRet = FALSE;
HKEY hkey;
if (RegOpenKeyEx(HKEY_CLASSES_ROOT, szProgID, 0, KEY_READ, &hkey) ==
ERROR_SUCCESS)
{
bRet = TRUE;
RegCloseKey(hkey);
}
return bRet;
}
In case of Excel you would have to check
for another key in the registry. There are
a lot of keys related to Excel:
HKCR\Excel.Application
HKCR\Excel.Sheet
HKCR\Excel.Workspace
HKCR\ExcelWorksheet
I'm not sure which one will be your choice,
perhaps the one you use in your automation code.
HTH
Pete Delgado replied...
Use the Windows Installer SDK functions to query the installed
programs/features on the computer. You can also get other interesting
information such as the installation location, product version etc.
-Pete

Microsoft ending newsgroup support C++ / VB Microsoft said it plans to end support for more than 4, 000 old-style newsgroups starting next month, pushing users instead to discussion forums such as those found on the Microsoft Answers, TechNet, and MSDN sites. Although venerable, Microsoft said that so-called NNTP newsgroups are past their time in terms of being usable Link: http: / / news.cnet.com / 8301-13860_3-20004109-56.htm Mike P VC MFC Discussions Microsoft Exchange (1) Joseph M. Newcomer (1) Windows 7 (1) Outlook (1) Python (1) Oracle (1) Perl (1) NNTP newsgroups (1) This is What is worse, they have an "NNTP bridge" mechanism (I found it on http: / / connect.microsoft.com / MicrosoftForums ) that is supposed to let us use our professionally-designed and professionally-written hyperlink that WORKS? It ain't Rocket Science here, guys, and why is it that Microsoft so misunderstands the Internet that they cannot create a simple download? They make silly meaningless
Where do you want to go tomorrow? C++ / VB Dear users of msnews.microsoft.com, There are rumors that Microsoft plans to shut down this nntp server. See this for example: http: / / news.cnet.com of the web-based MSDN forums?. To Google groups, maybe? Regards, - - pa VC Language Discussions Windows XP (1) Distributed (1) Relative (1) INDIRECT (1) Declare (1) Money (1) Date (1) FIND (1) web-based = 20 Windows kernel people - to OSR's forums, surely. - - = 20 Maxim S. Shatskih Windows DDK MVP maxim@storagecraft.com http: / / www.storagecraft.com Technically what Microsoft is stopping is the Microsoft.* newsgroups in lieu of new forums style messages which can also be exposed as As "Forums Newsgroups, " you can download the MS NNTP Bridge http: / / connect.microsoft.com / MicrosoftForums that will allow you to continue to use your favorite desktop news reader
here much longer as the post count drops off. See you here: http: / / social.msdn.microsoft.com / Forums / en-US / vcmfcatl / threads One thing I have noticed in the forums (using M. Newcomer (1) Outlook 2010 (1) Office 2007 (1) Office 2003 (1) Office 2010 (1) Word 2010 (1) Windows 7 (1) Office (1) I installed Jochen's bridge so I could sample Msdn.en years they would quickly be removed by a moderator because they are considered noise. Clearly, Microsoft's attitude about fostering peer to peer "friendship" community has changed. So, I agree with other things besides the answer to the immediate question at hand. it is clear that Microsoft wants it to be about business only and that is the direction they are taking many non-technical users, will have a better experience on the forums especially now that Windows 7 does not come with a newsgroup reader. They will never be communities, in the a programmer is puzzled by newsgroups. But hey, it is what it is :-) - - Mihai Nita [Microsoft MVP, Visual C++] http: / / www.mihai-nita.net - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - Replace _year_ with _ to get the so small I can post them here, here is whats remaining as of this day: microsoft.public.adsi.general microsoft.public.applicationcenter.admin microsoft.public.applicationcenter.usage microsoft.public.arabic.access
C++ / VB Hello, I have a text file called OS.txt that looks like this: Windows 2000 Professional 5.0 (2195) Windows 2000 Server 5.0 (2195) Windows 7 Professional 6.1 (7600) Windows 7 Professional 6.1 (7600) Windows 7 Professional 6.1 (7600) Windows 7 Professional 6.1 (7600 Windows 7 Ultimate 6.1 (7100) Windows NT 4.0 Windows NT 4.0 Windows Server 2003 5.2 (3790) Windows Server
How to use the Shell and Windows (Sample wont work) C++ / VB I tried running the vbscript example For the ShellWindows.Item Method, as posted at http: / / msdn.microsoft.com / en-us / library / bb773970(v = VS.85).aspx But I get an error message Line: 16 Error: ActiveX component cannot create object: 'shell.Shell_Application' Code: 800A01AD Source: Microsoft VBScript runtime error I am trying to run the example in Vista 64 Bit. If know why there are no postings showing today in MsgBox fnShellWindowsItemVB function fnShellWindowsItemVB() 'http: / / msdn.microsoft.com / en-us / library / bb773970(v = VS.85).aspx 'ShellWindows.Item Method dim objShell dim set objShellWindows = nothing set objShell = nothing end function - - MarceepooNu VBScript Discussions Error (1) Vista (1) Microsoft VBScript runtime (1) WebBrowser (1) ListView (1) CreateObject (1) Instantiate (1) Application (1) That's fnShellWindowsItemVB Sub fnShellWindowsItemVB() Dim objShell Dim objShellWindows Set objShell = CreateObject("shell.Application") Set objShellWindows = objShell.Windows If objShellWindows.count > 0 Then MsgBox objShellWindows.item(0).path Else MsgBox "No windows open." End If Set objShellWindows = Nothing Set objShell = Nothing End Sub Note that ShellWindows is in theory an IE instance. But ShellWindows actually returns all IE and open folder (Explorer) windows. You can tell the difference with this: TypeName(objShellWindows.item(0).document) In the case