Opening Word (or other apps) with TD 5.1

Discussion forum about all things Team Developer 5.x and 6.x
dcomer

Opening Word (or other apps) with TD 5.1

Post by dcomer » 13 Dec 2007, 19:02

I am trying to open Microsoft Word from a TD 5.1 application using SalLoadApp. The problem is that different versions of Word are installed in different directories, so this path cannot be stored universally for all users. The work around I did for this is to store the location of each user's WINWORD.EXE location in an INI file. This is not going to work for large deployments or when people upgrade to new versions of Word.
Ex:
Call SalGetProfileString( 'WORD PATH', strDevOrProd, '', strApplication, strIniFile )
Call SalLoadApp( strApplication, strResume )

Is there a way from TD to find the location of an EXE to use when opening a file, rather than looking in only the path specified (or in the system's PATH)? I am hoping to not only be able to open different versions of Word on different machines but different file formats opening with the default application on each system. I want to be able to open more than just .doc and .txt files, I would also like to be able to open .pdf files and so on and I want my app to be smart enough to open the right exe depending on the file extension of the file to open (in this code strResume is the file to open). Utilizing Windows defaults somehow would be ideal.

Jean-Marc Gemperle

Re: Opening Word (or other apps) with TD 5.1

Post by Jean-Marc Gemperle » 14 Dec 2007, 18:52

Hi,

There is different way to do that, but in this case I would use in thact the feature of COM that is make the version of a SERVER transparent through the GUI ID...

So if you look at any machine having word you should see that entry

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Word.Application\CLSID

the unique CLSID for word is

{000209FF-0000-0000-C000-000000000046}

From that you can find in the registry

HKEY_CLASSES_ROOT\CLSID\{000209FF-0000-0000-C000-000000000046}\LocalServer32

The default value, the path of the LOCAL SERVER

In my case C:\PROGRA~1\MICROS~2\Office12\WINWORD.EXE /Automation

-----

Now if you do have winword in your path....which is the case, in SalLoadApp() you only need to gives the .EXE name...so not sure why you don't relay on that... Also About SalLoadApp() and WORD, I would recommend you to use SalLoadAppAndProcessMsgs see HLP as this would NOT block message in your TD application.

----
Maybe you could use VisFileFind()? There might be also some ways via the WINDOWS API...

Attached a TD 4.2 application as APT that return a Value from a Reg key. Just copy and paste
CLSID\{000209FF-0000-0000-C000-000000000046}\LocalServer32 in Reg Key field and blank the value field.

Hope this helps

Jean-Marc
You do not have the required permissions to view the files attached to this post.

Return to “General Discussion TD 5.x and 6.x”

Who is online

Users browsing this forum: [Ccbot] and 2 guests