Results 1 to 3 of 3

Thread: FYI: IDE Options via Code

Threaded View

  1. #1

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    FYI: IDE Options via Code

    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
    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
    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:
        Dim udt As VbIdeOptionsStruct
        EbGetOptions 0, ByVal VarPtr(udt)  ' use VarPtr so VB doesn't do Unicode>ANSI convesion
    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.
    Last edited by LaVolpe; May 4th, 2020 at 12:10 PM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width