This was a curiosity thing and thought I throw out there so others can improve upon it and/or fill in the gaps (missing stuff). Not really sure how helpful this could be.
The code uses an undocumented but exported vb6a.dll function. This means it likely only exists where vb6.exe exists. The function name is EbGetOptions and has a similar EbSetOptions.
In the comments, you'll see some of the gaps noted. This also doesn't get every option, notably all those checkbox items in Docking & Environment tabs of the Options dialog.
Declarations
Sample call. GetOptions always returns zero, maybe a sub vs. function. SetOptions set eax before exiting, but unsure of its meaning: 0 = S_OK?Code:Private Declare Function EbGetOptions Lib "vba6.dll" (ByVal dontKnow As Long, ByRef pbBuffer As Any) As Long Private Declare Function EbSetOptions Lib "vba6.dll" (ByVal dontKnow As Long, ByRef pbBuffer As Any) As Long Private Type TextCategoriesStruct NormalText As Long SelectionText As Long SyntaxError As Long ExecutionPoint As Long BreakPoint As Long Comment As Long KeyWord As Long Identifier As Long Bookmark As Long CallReturn As Long End Type Private Type VbIdeOptionsStruct ' 56 dwords, 224 bytes nBits As Long ' mask auto-indent 0x0001 ' mask break on all errors 0x0002 ' mask auto-syntax 0x0004 ' mask option explicit 0x0008 ' ?? 0x0010 ' mask break in classes 0x0020 ' mask break unhandled errors 0x0022 = 0x00 or 0x22 (none/both break all + in classes) ' mask procedure separator 0x0040 ' mask compile on demand 0x0080 ' mask default to full mode view 0x0100 ' mask background compile 0x0200 ' ?? 0x0400 ' mask margin indicator bar 0x0800 nTabWCx As Long ' tab width nFontSize As Long ' font point size (whole number only) pFontName As String ' BSTR wide-char format unk1 As Long nForeColors As TextCategoriesStruct reserved1(0 To 5) As Long ' ?? reserved for expansion ?? nBackColors As TextCategoriesStruct reserved2(0 To 5) As Long ' ?? reserved for expansion ?? nIndicatorColors As TextCategoriesStruct reserved3(0 To 5) As Long ' ?? reserved for expansion ?? unk2 As Long LCID As Long nBits2 As Long ' mask drag/drop text editing 0x0001 ' mask auto-list members 0x0002 ' mask auto-quick info 0x0004 ' mask auto-data tips 0x0008 End Type
Play with EbSetOptions at your own risk. I did not try to decipher where the settings are cached: registry, ini, elsewhere. Maybe other's know. If unsure, don't mess with setting options, or at least back stuff up.Code:Dim udt As VbIdeOptionsStruct EbGetOptions 0, ByVal VarPtr(udt) ' use VarPtr so VB doesn't do Unicode>ANSI convesion




Reply With Quote