Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Mike Gagnon
  Where is Mike Gagnon?
 Pointe Claire
 Canada
 Mike Gagnon
 To: Bernard Bout
  Where is Bernard Bout?
 Brisbane
 Australia
 Bernard Bout
 Tags
Subject: RE: Article about Manifest files and VFP
Thread ID: 268690 Message ID: 270693 # Views: 31 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Classes and Objects
Date: Monday, July 26, 2010 12:27:54 PM         
   


> >
> > Not that I know of, but FOR EACH is used because it is a collection (like looping though messages in outlook)
> > But you could also do
> >
otli=NEWOBJECT('tli.tliapplication')
> > SET DEFAULT TO ?
> > otlb=otli.TypeLibInfoFromFile("serial.dll")
> > otlb.CoClasses.Item(1).GUID

> >
> >
> > Mike Gagnon
> > Refox XI +(English version)
>
> Ok. Thanks Mike. This code should do it. And because it uses the TypeLibInfoFromFile() method, it will return the GUID even if the DLL is not registered. Great.
>
> Anyway I have added code and adapted your initial code so that anyone who is interested can generate a manifest. Here it is for anyone interested:
>
*****************************************************************************************
> * Program....:	ExtractManifest
> * Version....:	1.01
> * Author.....:  Bernard Bout
> *            :  From code by Mike Gagnon on Foxite
> * Date.......:  26/07/2010 11:31:39 AM
> * Notice.....:	Freeware
> * Compiler...:	VFP9 Sp2
> * Purpose....:	 Following code extracts a manifest and creates a file
> * Called By..:  
> * Changes....:
> * Date Time			Change
> * ==========		=====================================================================
> *
> *****************************************************************************************
> FUNCTION ExtractManifest
> * Declare local variables
> Declare Long LoadLibrary In WIN32API String
> Declare Long FindResource In WIN32API Long, Long, Long
> Declare Long LoadResource In WIN32API Long, Long
> Declare Long SizeofResource In WIN32API Long, Long
> Declare Long FreeLibrary In WIN32API Long
> Declare Long FreeResource In WIN32API Long
>  
> Local lcModule, hModule
> m.lcModule = Getfile("EXE|DLL","Select COM file")
> IF EMPTY(m.lcModule)
> 	RETURN
> ENDIF
> m.hModule = LoadLibrary(m.lcModule)
> m.lnRsrc = FindResource(m.hModule, 1, 24)
> m.lnMem = LoadResource(m.hModule, m.lnRsrc)
> m.lnSize = SizeofResource(m.hModule, m.lnRsrc)
> m.lcManifest = Sys(2600, m.lnMem, m.lnSize)
> FreeResource(m.lnMem)
> FreeLibrary(m.hModule)
> _cliptext = lcManifest
> * got the manifest here so get the GUID
> cStr = GetGUIDfromCOM(lcModule)
> IF EMPTY(cStr)
> 	WAIT WINDOW TIMEOUT 2 "Error getting GUID"
> 	RETURN
> ENDIF
> cMan = STRTRAN(lcManifest,[</assembly>],cStr,1,1)
> * select the EXE to use this manifest on
> cExe =Getfile("EXE","Select final EXE")
> IF EMPTY(cEXE)
> 	RETURN 
> ENDIF
> cSaveas = cExe+".manifest"
> STRTOFILE(cMan,cSaveas)
> MESSAGEBOX("Manifest Created : "+cSaveas + CHR(13);
> 			+ "Now recompile your EXE to embed this manifest")
> RETURN
> 
> **************************************************************
> FUNCTION GetGUIDfromCOM
> LPARAMETERS pFullpath2dll
> * pass the full path + dll name to the function
> IF EMPTY(pFullpath2dll)
> 	RETURN .F.
> ENDIF
> * get GUID from DLL
> otli=createOBJECT('tli.tliapplication')
> otlb=otli.TypeLibInfoFromFile(pFullpath2dll)
> cGuid = otlb.CoClasses.Item(1).GUID
> *******************************************************
> * replace "serial.dll" with your DLL or EXE name
> * replace description="serial.SerialNumber" with this code
> cName = oTlb.Name 									&& gives "serial"
> cItemname = otlb.CoClasses.Item(1).Name 			&& gives "SerialNumber"
> cProgid = otlb.Name+"."+otlb.CoClasses.Item(1).Name && gives "serial.SerialNumber"
> SET TEXTMERGE ON
> TEXT TO cRetval NOSHOW
>     <file name="<<cName+"."+LOWER(JUSTEXT(pFullpath2dll))>>">
>  	    <comClass description="<<cProgid>>" clsid="<<cGUID>>" progid="<<cProgid>>" threadingModel="Both"/>
>     </file>
> </assembly>
> ENDTEXT
> SET TEXTMERGE off
> RETURN cRetval
> *******************************************************

>
> The above works very well. Now I don't need to use VS to generate the Manifest.
>
> Thanks again.
>
> Bernard
>
> ** If you see someone without a smile, give em one of yours :) **
> My Blog

Good work.
The next concern is does tblinf32.dll (or OLEAUT.dll) only get installed with VS. In other words can you use :
'tli.tliapplication' on a computer that does not have VS installed?

Mike Gagnon
Refox XI +(English version)

COMPLETE THREAD

Article about Manifest files and VFP Posted by Cesar @ 7/14/2010 3:06:21 AM
RE: Article about Manifest files and VFP Posted by Jun Tangunan @ 7/14/2010 3:37:56 AM
RE: Article about Manifest files and VFP Posted by Mike Gagnon @ 7/14/2010 11:21:28 AM
RE: Article about Manifest files and VFP Posted by Mike Gagnon @ 7/14/2010 11:34:40 AM
RE: Article about Manifest files and VFP Posted by Boudewijn Lutgerink @ 7/16/2010 10:14:21 AM
RE: Article about Manifest files and VFP Posted by Mike Gagnon @ 7/16/2010 12:03:10 PM
RE: Article about Manifest files and VFP Posted by Bernard Bout @ 7/21/2010 2:29:03 AM
RE: Article about Manifest files and VFP Posted by Mike Gagnon @ 7/21/2010 12:09:43 PM
RE: Article about Manifest files and VFP Posted by Bernard Bout @ 7/21/2010 6:40:57 PM
RE: Article about Manifest files and VFP Posted by Mike Gagnon @ 7/21/2010 1:34:15 PM
RE: Article about Manifest files and VFP Posted by Bernard Bout @ 7/21/2010 7:04:47 PM
RE: Article about Manifest files and VFP Posted by Mike Gagnon @ 7/21/2010 8:57:52 PM
RE: Article about Manifest files and VFP Posted by Bernard Bout @ 7/22/2010 2:51:09 AM
RE: Article about Manifest files and VFP Posted by Mike Gagnon @ 7/22/2010 12:13:33 PM
RE: Article about Manifest files and VFP Posted by Bernard Bout @ 7/23/2010 4:21:53 AM
RE: Article about Manifest files and VFP Posted by Mike Gagnon @ 7/23/2010 12:34:54 PM
RE: Article about Manifest files and VFP Posted by Bernard Bout @ 7/24/2010 12:07:00 AM
RE: Article about Manifest files and VFP Posted by Mike Gagnon @ 7/24/2010 1:28:00 AM
RE: Article about Manifest files and VFP Posted by Bernard Bout @ 7/24/2010 7:11:51 PM
RE: Article about Manifest files and VFP Posted by Mike Gagnon @ 7/25/2010 12:33:31 PM
RE: Article about Manifest files and VFP Posted by Bernard Bout @ 7/26/2010 2:37:50 AM
RE: Article about Manifest files and VFP Posted by Mike Gagnon @ 7/26/2010 12:27:54 PM
RE: Article about Manifest files and VFP Posted by Stefan Wuebbe @ 7/26/2010 2:02:42 PM
RE: Article about Manifest files and VFP Posted by Mike Gagnon @ 7/26/2010 3:01:24 PM
RE: Article about Manifest files and VFP Posted by Mike Gagnon @ 7/24/2010 1:44:49 PM
RE: Article about Manifest files and VFP Posted by Bernard Bout @ 7/24/2010 7:15:06 PM
RE: Article about Manifest files and VFP Posted by Mike Gagnon @ 7/25/2010 12:37:47 PM