Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Word constants
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
Miscellaneous
Thread ID:
00144015
Message ID:
00144079
Views:
29
John,

Here's another version of the code that keeps the constants together based on the enum group:
* Creates an .h file from an exported typelib.

* Builds the .h file in order of enum constant groups

* Based on code from Menachem Bazian

lparameters pcPreHFile, pcHFile

if ( pcount() != 2 )
   wait window "no files specified"
   return .f.
endif

create cursor temp (cLine c(100))
append from (pcPreHFile) type sdf

create cursor hfile (cGroup c(32), mDefine m)

wait window "Reading" nowait

select temp
scan
   if ( "typedef" $ cLine )
      lcDefine = ""
      lnRecStart = recno( "temp" )
      do while ! ( ";" $ cLine )
         skip
         if ( ! ";" $ cLine )
            lcDefine = lcDefine + "#define " + chrtran( alltrim( cLine ), ",=", "" ) + chr(13)+chr(10)
         endif
      enddo
      lcGroup = chrtran( alltrim( cLine ), ";}", "" )
      insert into hfile values ( lcGroup, lcDefine )
   endif
endscan

wait window "Writing" nowait

select hFile
index on cGroup tag cGroup
goto top

set textmerge to (pcHFile)
set textmerge on noshow

lcGroup = ""
scan
   \<<"* " + cGroup>>
   \<<mDefine>>
endscan

set textmerge off
set textmerge to

use in temp
use in hfile

wait clear
>I conned Menachem Bazian into sending me a file with all the Office97 constants. It's on my website and it may be here as well. Probably easier to get to on my site. (Thanks again Menachem!)
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Reply
Map
View

Click here to load this message in the networking platform