Results 1 to 30 of 30

Thread: Need help or documentation on vba6.dll functions, Eb api

  1. #1

    Thread Starter
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    685

    Need help or documentation on vba6.dll functions, Eb api

    I've seen a few of these functions used before but can't find anything in my library about the other additional functions listed below.

    EDIT: Eb (embedded basic engine designed for Microsoft's abandoned "Omega" database system)

    Does anyone know how to use these with samples demonstrating the use? Thanks
    Name Hint
    EbInitHost 63
    EbCloseProject 12
    EbDoIdle 21
    EbExceptionHandled 24
    EbFExitBreakMode 30
    EbGetExceptionInfo 42
    EbGetVersion 60
    EbInitThread 66
    EbInvokeItem 69
    EbMode 94
    EbRaiseException 103
    EbRaiseExceptionCode 104
    EbRegisterFunctions 112
    EbReset 115
    EbSetCommandLine 123
    EbShowError 134
    EbTerm 141
    EbTermThread 142
    EbInitHostPart2 64
    EbDeleteFunc 20
    StdcbufLink 156
    StdReleaseCatch 154
    StdThrow 155
    TipGetFuncInfo 201
    TipReleaseFuncInfo 258
    TipGetArgType 188
    TipCreateProject 177
    EbEndPrint 23
    TipReleaseProject 260
    TipGetFunctionId 203
    TipGetLpfnOfFunctionId 213
    TipCreateStdModule 180
    TipGetModuleCount 218
    TipGetModule 217
    TipReleaseModule 259
    TipGetModuleName 219
    EbGetNumPages 51
    EbPrintPage 101
    EbShowFunction 136
    TipGetProjName 223
    TipSetProjName 286
    EbGetRedoText 54
    EbGetUndoText 58
    EbSetStepMode 130
    EbShowException 135
    EbCopyExceptionInfo 16
    EbSearchDone 118
    EbSearchCanReplace 117
    EbSearchFind 119
    EbSearchReplace 121
    EbSearchReplaceAll 122
    TipSetProjectDest 287
    EbNotifyWindow 96
    EbGetStatusOfItems 56
    TipGetArgCount 187
    TipIsProjModified 245
    TipEberrOfHresult 183
    TipCreateInstance 174
    EbHideCode 62
    EbShowCode 133
    TipGetProjOfMod 224
    TipProjAddRef 255
    TipDeleteModule 181
    TipGetProjectOfLibId 229
    TipGetModOfFunctionId 214
    TipSetModuleName 283
    TipGetFunctionIdOfMod 204
    TipGetModuleOfName 220
    EbIsWatchExprOk 75
    EbWatchDlgModSelected 143
    EbRecordEraseUserAction 108
    EbRecordLine 109
    EbRecordSet 110
    EbRecordUserAction 111
    EbGetModuleFlags 49
    EbSetModuleFlags 127
    EbObjectBrowserSelChg 98
    TipAddRefModule 164
    EbContextHelpMode 15
    TipGetDocOfFunction 196
    TipGetDocOfModule 197
    TipGetHelpFileOfProject 209
    TipGetHelpContextOfFunction 206
    TipGetHelpContextOfModule 207
    TipSetDocOfFunction 274
    TipSetDocOfModule 275
    TipSetHelpFileOfProject 280
    TipSetHelpContextOfFunction 277
    TipSetHelpContextOfModule 278
    EbGetCallstackCount 35
    EbGetCallstackFunction 36
    EbGetDebWndCallstackIndex 40
    Catch 0
    TipGetFunctionCount 202
    TipGetFunctionName 205
    EbGetOptions 53
    EbSetOptions 129
    EbGetBstrOfLstClr 34
    TipAddDefaultTypeLib 162
    TipRegAppObject 257
    EbGetBstrOfLcid 33
    EberrOfScode 146
    EbAddAvailEbref 8
    TipGetProjectDest 228
    EbGetCurrentFunction 39
    EbSearchGetCurState 120
    EbCheckOptions 11
    EbExecuteLine 25
    EbGetExecutingProj 44
    TipGetNames 221
    EbGetKeyword 48
    EbInsertFile 68
    EbWinIniChange 144
    TipSetProjModified 285
    EbConfigureUi 14
    EbStartSearch 140
    TipIsValidModuleName 247
    EbJournalCancel 77
    TipIsModuleModified 243
    TipLoadFromText 249
    TipSaveToText 268
    TipCreateClass 172
    TipSetLcid 281
    TipGetRefLib 230
    TipAddRefLib 163
    TipGetProjRefLibCount 226
    TipGetLcid 211
    TipGetHelpContextOfProject 208
    TipGetDocOfProject 198
    TipSetDocOfProject 276
    TipSetHelpContextOfProject 279
    TipCanBaseClassChange 166
    TipGetTypeLibOfHProject 234
    TipGetCompatibleExe 191
    TipSetCompatibleExe 271
    TipSetClassFlags 270
    TipGetClassFlags 189
    TipGetExepartOffsetOfFunctionId 199
    EbMoveEbref 95
    ProcCallEngine 153
    DllFunctionCall 6
    __vbaRecAssign 298
    __vbaRecDestruct 299
    CopyRecord 2
    TipCompileModule 169
    EbGetSelection 55
    TipCanRefLibChange 168
    TipRemoveRefLib 261
    TipGuidOfLibId 235
    MethCallEngine 152
    TipCompileProject 170
    EbSetStepToCursor 131
    TipIsEventProcEmpty 242
    EbOpenNewLine 99
    EbYankCurrentLine 145
    TipCreateProject2 178
    EbSetDatabaseLcid 124
    TipValidateReferences 292
    EbRegisterVbaHost 114
    TipCanBaseClassChange2 167
    EbIsWindowSplit 76
    TipGetInstanceCount 210
    TipCompileProjectFull 171
    TestGetFuncomp 157
    EbExtGetSelection 26
    EbExtReplaceSelection 27
    EbExtShowEventProc 28
    TipGetOption 222
    TipSetOption 284
    TipGetProjRefLib 225
    TipCreateReloadableModule 179
    EbGetExecutingInstance 43
    TipGetFilenameOfProjectLibid 200
    EbCreateCVbaExtModule 18
    IsVBAInitialized 151
    TipMakeWizard 253
    TipSetLicenseInfo 282
    TipIsWizard 248
    TipSetProjectDestForReferences 288
    TipDemandLoadText 182
    TestIsModLoaded 160
    TestGetModCompState 158
    EbResetNormal 116
    TipGetReferencingProjCount 231
    VBACreateExtendedTypeLib 294
    EbCreateCVbaExtEditors 17
    EbCreateCVbaExtReferences 19
    EbRegisterHostExtObj 113
    EbGetCurrentAllocInfo 38
    EbDrawCodeSample 22
    EbShowToolTips 137
    EbGetNameOfEbitem 50
    EbGetFlagsOfEbitem 45
    VBACreateTwiddledTypeLib 295
    TipSaveAsOldFormat 265
    EbMemProfPrintf 78
    EbSetMemProfLevel 125
    DllUnregisterServer 7
    EbProjectReset 102
    TipFinishExe2 185
    TipMakeExe2 251
    EbRecordEnd 106
    EbGetInsertionPoint 46
    TipUnloadInstance 290
    EbAskUserForStateLoss 9
    EbInitHostRn 65
    TipGetLinkNameOfFunctionId 212
    TipIsProjCompiled 244
    EbGetIntlDllFileName 47
    EbGetStepMode 57
    TipCreateExtension 173
    TipReplaceRefLib 262
    TipSetCompatibleExe2 272
    TipGetCompatibleExe2 192
    TipAdviseVBAInstPart 165
    EbGetErrorInfo 41
    TipVBATestCommands 291
    TipZombieInstances 293
    TipLoadFromText2 250
    TipAbortExe 161
    TipReplaceRefLib2 263
    DLLGetDocumentation 5
    TipExeAllowCodeExec 184
    TipGetProjRefLibFileName 227
    TipIsProjRefLibLoaded 246
    TipStartMakeExe 289
    TipGetCodepageSrc 190
    EbSetMsoHinst 128
    TipCreateInstanceEx 175
    TipGetModTypeInfoOfInst 216
    EbIsResetting 72
    TipCreateOldAccessProject 176
    TipSaveAsOldFormat2 266
    TipGetTextOfProject 232
    TipGetCompiledOfProject 193
    TipRevertModule 264
    TipGetModStreamName 215
    TipGetTextOfProject2 233
    TipGetCompiledOfProject2 194
    TipIsCurrentVersion 241
    TipMakeUniqueStreamName 252
    EbFTranslateScp 31
    TipInfoOfLibId 238
    TipSetCalendar 269
    EbInitializeEventMonitors 67
    EbShutdownEventMonitors 138
    EbStartHostEvent 139
    EbFinishHostEvent 32
    TipSaveAsWizard 267
    TipGetAdviseSink 186
    EbCommitAll 13
    rtcLeftBstr 413
    rtcLeftVar 418
    rtcRightBstr 451
    rtcRightVar 456
    rtcAnsiValueBstr 310
    rtcLowerCaseBstr 422
    rtcLowerCaseVar 423
    rtcTrimBstr 484
    rtcTrimVar 485
    rtcLeftTrimBstr 416
    rtcLeftTrimVar 417
    rtcRightTrimBstr 454
    rtcRightTrimVar 455
    rtcSpaceBstr 472
    rtcSpaceVar 473
    rtcUpperCaseBstr 487
    rtcUpperCaseVar 488
    rtcKillFiles 412
    rtcChangeDir 324
    rtcMakeDir 426
    rtcRemoveDir 448
    rtcChangeDrive 325
    rtcBeep 315
    rtcGetTimer 386
    rtcStrFromVar 478
    rtcBstrFromAnsi 316
    rtcPackDate 440
    rtcPackTime 441
    rtcGetDateValue 369
    rtcGetTimeValue 384
    rtcGetDayOfMonth 371
    rtcGetHourOfDay 376
    rtcGetMinuteOfHour 377
    rtcGetMonthOfYear 378
    rtcGetPresentDate 380
    rtcGetSecondOfMinute 381
    rtcSetDateVar 465
    rtcSetDateBstr 464
    rtcSetTimeVar 468
    rtcSetTimeBstr 467
    rtcGetDayOfWeek 372
    rtcGetYear 387
    rtcFileReset 356
    rtcFileAttributes 350
    rtcIsArray 403
    rtcIsDate 404
    rtcIsEmpty 405
    rtcIsError 406
    rtcIsNull 408
    rtcIsNumeric 409
    rtcIsObject 410
    rtcVarType 497
    rtDecFromVar 303
    rtcFileWidth 358
    rtcInputCount 400
    rtcInputCountVar 401
    rtcFileSeek 357
    rtcFileLocation 355
    rtcFileLength 354
    rtcEndOfFile 344
    rtcHexBstrFromVar 388
    rtcHexVarFromVar 389
    rtcOctBstrFromVar 435
    rtcOctVarFromVar 436
    rtcFileCopy 351
    rtcFileDateTime 352
    rtcFileLen 353
    rtcGetFileAttr 374
    rtcSetFileAttr 466
    rtcR8ValFromBstr 444
    rtcSin 471
    rtcCos 331
    rtcTan 483
    rtcAtn 314
    rtcExp 348
    rtcLog 421
    rtcRgb 450
    rtcQBColor 443
    rtcMacId 425
    rtcTypeName 486
    rtcIsMissing 407
    rtcRandomNext 445
    rtcRandomize 446
    rtcMsgBox 432
    rtcInputBox 397
    rtcAppActivate 311
    rtcDoEvents 343
    rtcSendKeys 461
    rtcShell 470
    rtcArray 313
    rtcGetErl 373
    rtcStringBstr 480
    rtcStringVar 481
    rtcVarBstrFromAnsi 489
    rtcGetDateBstr 368
    rtcGetDateVar 370
    rtcGetTimeBstr 383
    rtcGetTimeVar 385
    rtcVarStrFromVar 496
    rtcSqr 475
    rtcIMEStatus 390
    rtcLeftCharBstr 414
    rtcLeftCharVar 415
    rtcRightCharBstr 452
    rtcRightCharVar 453
    rtcInputCharCount 398
    rtcInputCharCountVar 399
    rtcStrConvVar 476
    rtcGetHostLCID 375
    rtcCreateObject 332
    rtcGetObject 379
    rtcAppleScript 312
    rtcMidBstr 427
    rtcMidVar 430
    rtcInStr 394
    rtcMidCharBstr 428
    rtcMidCharVar 429
    rtcInStrChar 395
    rtBstrFromErrVar 301
    rtBoolFromErrVar 300
    rtCyFromErrVar 302
    rtI2FromErrVar 304
    rtI4FromErrVar 305
    rtR4FromErrVar 306
    rtR8FromErrVar 307
    rtcDateFromVar 339
    rtcVarFromVar 495
    rtcCVErrFromVar 322
    VarPtr 296
    rtcDir 342
    rtcCurrentDirBstr 335
    rtcCurrentDir 334
    rtcFreeFile 365
    rtcCompareBstr 330
    rtcBstrFromFormatVar 320
    rtcBstrFromError 319
    rtcVarFromError 493
    rtcLenCharVar 419
    rtcLenVar 420
    rtcFixVar 360
    rtcAbsVar 309
    rtcIntVar 402
    rtcSgnVar 469
    EbShowClassModuleCode 132
    rtcVarFromFormatVar 494
    rtcDateAdd 337
    rtcDateDiff 338
    rtcDatePart 340
    rtcPartition 442
    rtcChoose 327
    rtcEnvironVar 346
    rtcEnvironBstr 345
    rtcSwitch 482
    rtcCommandBstr 328
    rtcCommandVar 329
    rtcSLN 458
    rtcSYD 459
    rtcDDB 336
    rtcIPMT 391
    rtcPPMT 438
    rtcPMT 437
    rtcPV 439
    rtcFV 349
    rtcNPer 434
    rtcRate 447
    rtcImmediateIf 393
    rtcIRR 392
    rtcMIRR 424
    rtcNPV 433
    rtcErrObj 347
    rtUI1FromErrVar 308
    rtcVarDateFromVar 492
    rtcSetDatabaseLcid 463
    rtcGetSetting 382
    rtcSaveSetting 460
    rtcDeleteSetting 341
    rtcGetAllSettings 366
    rtcByteValueBstr 321
    rtcBstrFromByte 317
    rtcVarBstrFromByte 490
    rtcCharValueBstr 326
    rtcBstrFromChar 318
    rtcVarBstrFromChar 491
    rtcSetCurrentCalendar 462
    rtcGetCurrentCalendar 367
    rtcFormatNumber 363
    rtcFormatCurrency 361
    rtcFormatPercent 364
    rtcFormatDateTime 362
    rtcWeekdayName 498
    rtcMonthName 431
    rtcFilter 359
    rtcInStrRev 396
    rtcJoin 411
    rtcSplit 474
    rtcReplace 449
    rtcStrReverse 479
    rtcRound 457
    rtcCallByName 323
    rtcCreateObject2 333
    rtcStrConvVar2 477
    TipInvokeMethod2 240
    EbRecordBeginAction 105
    EbRecordEraseAction 107
    EbIsValidIdent 73
    EbGotoProcedure 61
    EbBeginPrintEx 10
    VbaTest 297
    EbIsValidIdentOfProj 74
    EbSetMode 126
    EbIsCodeOnStack 70
    TipSetConstantValues 273
    TipGetConstantValues 195
    EbGetCommandLine 37
    TipInvokeMethod 239
    TipProjOfHproj 256
    TipHprojOfProj 237
    TipModOfHbasmod 254
    TipHbasmodOfMod 236
    IID_IVbaProject 149
    IID_IVbaModule 148
    IID_IVbaProvideStorage 150
    IID_IVbaHost 147
    EbGetObjConnectionCounts 52
    EbIsInEvalWatch 71
    EbFColumnSelectionMode 29
    TestGetUiPoint 159
    EbOutputDebugString 100
    EbMemberBeginQuery 79
    EbMemberEndQuery 81
    EbMemberBeginQueryAndGetCurrent 80
    EbMemberGetCount 82
    EbMemberGetMemberkind 86
    EbMemberIsPublic 89
    EbMemberGetHelpInfo 84
    EbMemberSetHelpInfo 91
    EbMemberGetHostString 85
    EbMemberSetHostString 92
    EbMemberGetFuncflags 83
    EbMemberSetFuncflags 90
    EbMemberGetName 88
    EbMemberGetMemid 87
    EbMemberSetMemid 93
    EbObjbrwIsMemberSelected 97
    CreateIExprSrvObj 4
    CheckExprSrvVersion 1
    CreateHostedExprSrv 3
    EbGetVBAObject 59

  2. #2
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    4,709

    Re: Need help or documentation on vba6.dll functions, Eb api

    A Yandex search reveals a lot more compared to a Google search:
    https://www.yandex.com/search/?text=...gProj&lr=10466

    @The trick has multiple topics on different forums, also on vbForums:
    https://www.vbforums.com/showthread....using-VBA6-Dll

  3. #3

    Thread Starter
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    685

    Re: Need help or documentation on vba6.dll functions, Eb api

    Thanks, I have seen that too. It appears as though Trick may be able to reverse engineer them by request. I think these are the same API that the VBA SDK uses for the host process. I've seen a sample of some of these in a custom debugger, but I can't find it again. Several of these would be very important for building new IDE features. I wonder if the EbExecuteLine function may be helpful to test possible params of possible declarations, lol. I'm going to try and crack some of these important ones.

  4. #4

    Thread Starter
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    685

    Re: Need help or documentation on vba6.dll functions, Eb api

    I made some progress recently. The VB6 IDE is very extensible with these. Is there an easier way to determine the number of parameters?

    In a base module.
    Code:
    Public pfnEbAddAvailEbref As Long
    Public pfnEbBeginPrintEx As Long
    Public pfnEbCloseProject As Long
    Public pfnEbConfigureUi As Long
    Public pfnEbContextHelpMode As Long
    Public pfnEbCopyExceptionInfo As Long
    Public pfnEbCreateCVbaExtEditors As Long
    Public pfnEbCreateCVbaExtModule As Long
    Public pfnEbCreateCVbaExtReferences As Long
    Public pfnEbDeleteFunc As Long
    Public pfnEbDrawCodeSample As Long
    Public pfnEbEndPrint As Long
    Public pfnEbExtGetSelection As Long
    Public pfnEbExtReplaceSelection As Long
    Public pfnEbExtShowEventProc As Long
    Public pfnEbFColumnSelectionMode As Long
    Public pfnEbFExitBreakMode As Long
    Public pfnEbFTranslateScp As Long
    Public pfnEbFinishHostEvent As Long
    Public pfnEbGetBstrOfLcid As Long
    Public pfnEbGetBstrOfLstClr As Long
    Public pfnEbGetCallstackCount As Long
    Public pfnEbGetCallstackFunction As Long
    Public pfnEbGetCurrentAllocInfo As Long
    Public pfnEbGetCurrentFunction As Long
    Public pfnEbGetDebWndCallstackIndex As Long
    Public pfnEbGetErrorInfo As Long
    Public pfnEbGetExceptionInfo As Long
    Public pfnEbGetExecutingInstance As Long
    Public pfnEbGetExecutingProj As Long
    Public pfnEbGetFlagsOfEbitem As Long
    Public pfnEbGetInsertionPoint As Long
    Public pfnEbGetIntlDllFileName As Long
    Public pfnEbGetKeyword As Long
    Public pfnEbGetModuleFlags As Long
    Public pfnEbGetNameOfEbitem As Long
    Public pfnEbGetNumPages As Long
    Public pfnEbGetOptions As Long
    Public pfnEbGetRedoText As Long
    Public pfnEbGetSelection As Long
    Public pfnEbGetStatusOfItems As Long
    Public pfnEbGetStepMode As Long
    Public pfnEbGetUndoText As Long
    Public pfnEbGetVersion As Long
    Public pfnEbHideCode As Long
    Public pfnEbInitHost As Long
    Public pfnEbInitHostPart2 As Long
    Public pfnEbInitHostRn As Long
    Public pfnEbInitThread As Long
    Public pfnEbInitializeEventMonitors As Long
    Public pfnEbInsertFile As Long
    Public pfnEbInvokeItem As Long
    Public pfnEbIsResetting As Long
    Public pfnEbIsWatchExprOk As Long
    Public pfnEbIsWindowSplit As Long
    Public pfnEbJournalCancel As Long
    Public pfnEbMemProfPrintf As Long
    Public pfnEbMoveEbref As Long
    Public pfnEbNotifyWindow As Long
    Public pfnEbObjectBrowserSelChg As Long
    Public pfnEbOpenNewLine As Long
    Public pfnEbPrintPage As Long
    Public pfnEbProjectReset As Long
    Public pfnEbRaiseException As Long
    Public pfnEbRaiseExceptionCode As Long
    Public pfnEbRecordEnd As Long
    Public pfnEbRecordEraseUserAction As Long
    Public pfnEbRecordLine As Long
    Public pfnEbRecordSet As Long
    Public pfnEbRecordUserAction As Long
    Public pfnEbRegisterFunctions As Long
    Public pfnEbRegisterHostExtObj As Long
    Public pfnEbRegisterVbaHost As Long
    Public pfnEbReset As Long
    Public pfnEbResetNormal As Long
    Public pfnEbSearchCanReplace As Long
    Public pfnEbSearchDone As Long
    Public pfnEbSearchFind As Long
    Public pfnEbSearchGetCurState As Long
    Public pfnEbSearchReplace As Long
    Public pfnEbSearchReplaceAll As Long
    Public pfnEbSetCommandLine As Long
    Public pfnEbSetDatabaseLcid As Long
    Public pfnEbSetMemProfLevel As Long
    Public pfnEbSetModuleFlags As Long
    Public pfnEbSetMsoHinst As Long
    Public pfnEbSetOptions As Long
    Public pfnEbSetStepMode As Long
    Public pfnEbSetStepToCursor As Long
    Public pfnEbShowClassModuleCode As Long
    Public pfnEbShowCode As Long
    Public pfnEbShowError As Long
    Public pfnEbShowException As Long
    Public pfnEbShowFunction As Long
    Public pfnEbShowToolTips As Long
    Public pfnEbStartHostEvent As Long
    Public pfnEbStartSearch As Long
    Public pfnEbTermThread As Long
    Public pfnEbWatchDlgModSelected As Long
    Public pfnEbWinIniChange As Long
    Public pfnEbYankCurrentLine As Long
    Public pfnEberrOfScode As Long
    Public pfnTipAbortExe As Long
    Public pfnTipAddDefaultTypeLib As Long
    Public pfnTipAddRefLib As Long
    Public pfnTipAddRefModule As Long
    Public pfnTipAdviseVBAInstPart As Long
    Public pfnTipCanBaseClassChange As Long
    Public pfnTipCanBaseClassChange2 As Long
    Public pfnTipCanRefLibChange As Long
    Public pfnTipCompileModule As Long
    Public pfnTipCompileProject As Long
    Public pfnTipCompileProjectFull As Long
    Public pfnTipCreateClass As Long
    Public pfnTipCreateExtension As Long
    Public pfnTipCreateInstance As Long
    Public pfnTipCreateInstanceEx As Long
    Public pfnTipCreateOldAccessProject As Long
    Public pfnTipCreateProject As Long
    Public pfnTipCreateProject2 As Long
    Public pfnTipCreateReloadableModule As Long
    Public pfnTipCreateStdModule As Long
    Public pfnTipDeleteModule As Long
    Public pfnTipDemandLoadText As Long
    Public pfnTipEberrOfHresult As Long
    Public pfnTipExeAllowCodeExec As Long
    Public pfnTipFinishExe2 As Long
    Public pfnTipGetAdviseSink As Long
    Public pfnTipGetArgCount As Long
    Public pfnTipGetArgType As Long
    Public pfnTipGetClassFlags As Long
    Public pfnTipGetCodepageSrc As Long
    Public pfnTipGetCompatibleExe As Long
    Public pfnTipGetCompatibleExe2 As Long
    Public pfnTipGetCompiledOfProject As Long
    Public pfnTipGetCompiledOfProject2 As Long
    Public pfnTipGetDocOfFunction As Long
    Public pfnTipGetDocOfModule As Long
    Public pfnTipGetDocOfProject As Long
    Public pfnTipGetExepartOffsetOfFunctionId As Long
    Public pfnTipGetFilenameOfProjectLibid As Long
    Public pfnTipGetFuncInfo As Long
    Public pfnTipGetFunctionCount As Long
    Public pfnTipGetFunctionId As Long
    Public pfnTipGetFunctionIdOfMod As Long
    Public pfnTipGetFunctionName As Long
    Public pfnTipGetHelpContextOfFunction As Long
    Public pfnTipGetHelpContextOfModule As Long
    Public pfnTipGetHelpContextOfProject As Long
    Public pfnTipGetHelpFileOfProject As Long
    Public pfnTipGetInstanceCount As Long
    Public pfnTipGetLcid As Long
    Public pfnTipGetLinkNameOfFunctionId As Long
    Public pfnTipGetLpfnOfFunctionId As Long
    Public pfnTipGetModOfFunctionId As Long
    Public pfnTipGetModStreamName As Long
    Public pfnTipGetModTypeInfoOfInst As Long
    Public pfnTipGetModule As Long
    Public pfnTipGetModuleCount As Long
    Public pfnTipGetModuleName As Long
    Public pfnTipGetModuleOfName As Long
    Public pfnTipGetNames As Long
    Public pfnTipGetOption As Long
    Public pfnTipGetProjName As Long
    Public pfnTipGetProjOfMod As Long
    Public pfnTipGetProjRefLib As Long
    Public pfnTipGetProjRefLibCount As Long
    Public pfnTipGetProjRefLibFileName As Long
    Public pfnTipGetProjectDest As Long
    Public pfnTipGetProjectOfLibId As Long
    Public pfnTipGetRefLib As Long
    Public pfnTipGetReferencingProjCount As Long
    Public pfnTipGetTextOfProject As Long
    Public pfnTipGetTextOfProject2 As Long
    Public pfnTipGetTypeLibOfHProject As Long
    Public pfnTipGuidOfLibId As Long
    Public pfnTipInfoOfLibId As Long
    Public pfnTipInvokeMethod2 As Long
    Public pfnTipIsCurrentVersion As Long
    Public pfnTipIsEventProcEmpty As Long
    Public pfnTipIsModuleModified As Long
    Public pfnTipIsProjCompiled As Long
    Public pfnTipIsProjModified As Long
    Public pfnTipIsProjRefLibLoaded As Long
    Public pfnTipIsValidModuleName As Long
    Public pfnTipIsWizard As Long
    Public pfnTipLoadFromText As Long
    Public pfnTipLoadFromText2 As Long
    Public pfnTipMakeExe2 As Long
    Public pfnTipMakeUniqueStreamName As Long
    Public pfnTipMakeWizard As Long
    Public pfnTipProjAddRef As Long
    Public pfnTipRegAppObject As Long
    Public pfnTipReleaseFuncInfo As Long
    Public pfnTipReleaseModule As Long
    Public pfnTipReleaseProject As Long
    Public pfnTipRemoveRefLib As Long
    Public pfnTipReplaceRefLib As Long
    Public pfnTipReplaceRefLib2 As Long
    Public pfnTipRevertModule As Long
    Public pfnTipSaveAsOldFormat As Long
    Public pfnTipSaveAsOldFormat2 As Long
    Public pfnTipSaveAsWizard As Long
    Public pfnTipSaveToText As Long
    Public pfnTipSetCalendar As Long
    Public pfnTipSetClassFlags As Long
    Public pfnTipSetCompatibleExe As Long
    Public pfnTipSetCompatibleExe2 As Long
    Public pfnTipSetDocOfFunction As Long
    Public pfnTipSetDocOfModule As Long
    Public pfnTipSetDocOfProject As Long
    Public pfnTipSetHelpContextOfFunction As Long
    Public pfnTipSetHelpContextOfModule As Long
    Public pfnTipSetHelpContextOfProject As Long
    Public pfnTipSetHelpFileOfProject As Long
    Public pfnTipSetLcid As Long
    Public pfnTipSetLicenseInfo As Long
    Public pfnTipSetModuleName As Long
    Public pfnTipSetOption As Long
    Public pfnTipSetProjModified As Long
    Public pfnTipSetProjName As Long
    Public pfnTipSetProjectDest As Long
    Public pfnTipSetProjectDestForReferences As Long
    Public pfnTipStartMakeExe As Long
    Public pfnTipUnloadInstance As Long
    Public pfnTipVBATestCommands As Long
    Public pfnTipValidateReferences As Long
    Public pfnTipZombieInstances As Long
    
    
    Public Function EbShowCode_user(ByVal pVBProjectNative As Long, ByVal lUnused1 As Long, ByVal lUnused2 As Long, ByVal lUnused3 As Long) As Long
       cHook.PauseHook pfnEbShowCode
       writelog "EbShowCode " & pVBProjectNative & " " & lUnused1 & " " & lUnused2 & " " & lUnused3 & "  |" & Now
       EbShowCode_user = cHook.CallByPointer(pfnEbShowCode, vbLong, pVBProjectNative, lUnused1, lUnused2, lUnused3)
       cHook.ResumeHook pfnEbShowCode
    End Function
    Public Function EbHideCode_user(ByVal pVBProjectNative As Long, ByVal lUnused1 As Long, ByVal lUnused2 As Long, ByVal lUnused3 As Long, ByVal lUnused4 As Long) As Long
       cHook.PauseHook pfnEbHideCode
       writelog "EbHideCode " & pVBProjectNative & " " & lUnused1 & " " & lUnused2 & " " & lUnused3 & " " & lUnused4 & "  |" & Now
       EbHideCode_user = cHook.CallByPointer(pfnEbHideCode, vbLong, pVBProjectNative, lUnused1, lUnused2, lUnused3, lUnused4)
       cHook.ResumeHook pfnEbHideCode
    End Function
    Public Function EbShowError_user(ByVal pVBProjectNative As Long, ByVal lUnused1 As Long, ByVal lUnused2 As Long, ByVal lUnused3 As Long) As Long
       cHook.PauseHook pfnEbShowError
       writelog "EbShowError " & pVBProjectNative & " " & lUnused1 & " " & lUnused2 & " " & lUnused3 & "  |" & Now
       EbShowError_user = cHook.CallByPointer(pfnEbShowError, vbLong, pVBProjectNative, lUnused1, lUnused2, lUnused3)
       cHook.ResumeHook pfnEbShowError
    End Function
    Public Function EbProjectReset_user(ByVal pVBProjectNative As Long, ByVal lUnused1 As Long) As Long
       cHook.PauseHook pfnEbProjectReset
       writelog "EbProjectReset " & pVBProjectNative & " " & lUnused1 & "  |" & Now
       EbProjectReset_user = cHook.CallByPointer(pfnEbProjectReset, vbLong, pVBProjectNative, lUnused1)
       cHook.ResumeHook pfnEbProjectReset
    End Function
    Public Function EbIsResetting_user() As Long
       cHook.PauseHook pfnEbIsResetting
       writelog "EbIsResetting " & " " & "  |" & Now
       EbIsResetting_user = cHook.CallByPointer(pfnEbIsResetting, vbLong)
       cHook.ResumeHook pfnEbIsResetting
    End Function
    'debug
    Public Function EbSetStepToCursor_user(ByVal pVBProjectNative As Long, ByVal lUnused1 As Long, ByVal lUnused2 As Long, ByVal lUnused3 As Long, ByVal lUnused4 As Long) As Long
       cHook.PauseHook pfnEbSetStepToCursor
       writelog "EbSetStepToCursor " & pVBProjectNative & " " & lUnused1 & " " & lUnused2 & " " & lUnused3 & " " & lUnused4 & "  |" & Now
       EbSetStepToCursor_user = cHook.CallByPointer(pfnEbSetStepToCursor, vbLong, pVBProjectNative, lUnused1, lUnused2, lUnused3, lUnused4)
       cHook.ResumeHook pfnEbSetStepToCursor
    End Function
    Public Function EbSetStepMode_user(ByVal pVBProjectNative As Long) As Long
       cHook.PauseHook pfnEbSetStepMode
       writelog "EbSetStepMode " & pVBProjectNative & "  |" & Now
       EbSetStepMode_user = cHook.CallByPointer(pfnEbSetStepMode, vbLong, pVBProjectNative)
       cHook.ResumeHook pfnEbSetStepMode
    End Function
    Public Function EbFExitBreakMode_user() As Long
       cHook.PauseHook pfnEbFExitBreakMode
       writelog "EbFExitBreakMode " & "  |" & Now
       EbFExitBreakMode_user = cHook.CallByPointer(pfnEbFExitBreakMode, vbLong)
       cHook.ResumeHook pfnEbFExitBreakMode
    End Function
    Public Function EbCloseProject_user(ByVal pVBProjectNative As Long) As Long
       cHook.PauseHook pfnEbCloseProject
       writelog "EbCloseProject " & pVBProjectNative & "  |" & Now
       EbCloseProject_user = cHook.CallByPointer(pfnEbCloseProject, vbLong, pVBProjectNative)
       cHook.ResumeHook pfnEbCloseProject
    End Function
    Public Function EbNotifyWindow_user(ByVal pVBProjectNative As Long, ByVal lUnused1 As Long, ByVal lUnused2 As Long) As Long
       cHook.PauseHook pfnEbNotifyWindow
       writelog "EbNotifyWindow " & pVBProjectNative & " " & lUnused1 & " " & lUnused2 & "  |" & Now
       EbNotifyWindow_user = cHook.CallByPointer(pfnEbNotifyWindow, vbLong, pVBProjectNative, lUnused1, lUnused2)
       cHook.ResumeHook pfnEbNotifyWindow
    End Function
    Public Function EbStartSearch_user(ByVal pVBProjectNative As Long) As Long
       cHook.PauseHook pfnEbStartSearch
       writelog "EbStartSearch " & pVBProjectNative & "  |" & Now
       EbStartSearch_user = cHook.CallByPointer(pfnEbStartSearch, vbLong, pVBProjectNative)
       cHook.ResumeHook pfnEbStartSearch
    End Function
    Public Function EbSearchDone_user() As Long
       cHook.PauseHook pfnEbSearchDone
       writelog "EbSearchDone " & "  |" & Now
       EbSearchDone_user = cHook.CallByPointer(pfnEbSearchDone, vbLong)
       cHook.ResumeHook pfnEbSearchDone
    End Function
    Public Function EbSearchCanReplace_user() As Long
       cHook.PauseHook pfnEbSearchCanReplace
       writelog "EbSearchCanReplace " & "  |" & Now
       EbSearchCanReplace_user = cHook.CallByPointer(pfnEbSearchCanReplace, vbLong)
       cHook.ResumeHook pfnEbSearchCanReplace
    End Function
    Public Function EbSearchFind_user(ByVal pVBProjectNative As Long, ByVal lUnused1 As Long, ByVal lUnused2 As Long, ByVal lUnused3 As Long, ByVal lUnused4 As Long) As Long
       cHook.PauseHook pfnEbSearchFind
       writelog "EbSearchFind " & pVBProjectNative & " " & lUnused1 & " " & lUnused2 & " " & lUnused3 & " " & lUnused4 & "  |" & Now
       EbSearchFind_user = cHook.CallByPointer(pfnEbSearchFind, vbLong, pVBProjectNative, lUnused1, lUnused2, lUnused3, lUnused4)
       cHook.ResumeHook pfnEbSearchFind
    End Function
    Public Function EbSearchReplace_user(ByVal pVBProjectNative As Long, ByVal lUnused1 As Long, ByVal lUnused2 As Long, ByVal lUnused3 As Long, ByVal lUnused4 As Long) As Long
       cHook.PauseHook pfnEbSearchReplace
       writelog "EbSearchReplace " & pVBProjectNative & " " & lUnused1 & " " & lUnused2 & " " & lUnused3 & " " & lUnused4 & "  |" & Now
       EbSearchReplace_user = cHook.CallByPointer(pfnEbSearchReplace, vbLong, pVBProjectNative, lUnused1, lUnused2, lUnused3, lUnused4)
       cHook.ResumeHook pfnEbSearchReplace
    End Function
    Public Function EbSearchReplaceAll_user(ByVal pVBProjectNative As Long, ByVal lUnused1 As Long, ByVal lUnused2 As Long, ByVal lUnused3 As Long, ByVal lUnused4 As Long) As Long
       cHook.PauseHook pfnEbSearchReplaceAll
       writelog "EbSearchReplaceAll " & pVBProjectNative & " " & lUnused1 & " " & lUnused2 & " " & lUnused3 & " " & lUnused4 & "  |" & Now
       EbSearchReplaceAll_user = cHook.CallByPointer(pfnEbSearchReplaceAll, vbLong, pVBProjectNative, lUnused1, lUnused2, lUnused3, lUnused4)
       cHook.ResumeHook pfnEbSearchReplaceAll
    End Function
    Public Function EbSearchGetCurState_user(ByVal pVBProjectNative As Long, ByVal lUnused1 As Long, ByVal lUnused2 As Long, ByVal lUnused3 As Long, ByVal lUnused4 As Long) As Long
       cHook.PauseHook pfnEbSearchGetCurState
       writelog "EbSearchGetCurState " & pVBProjectNative & " " & lUnused1 & " " & lUnused2 & " " & lUnused3 & " " & lUnused4 & "  |" & Now
       EbSearchGetCurState_user = cHook.CallByPointer(pfnEbSearchGetCurState, vbLong, pVBProjectNative, lUnused1, lUnused2, lUnused3, lUnused4)
       cHook.ResumeHook pfnEbSearchGetCurState
    End Function
    Public Function EbGetExceptionInfo_user(ByVal pVBProjectNative As Long, ByVal lUnused1 As Long, ByVal lUnused2 As Long) As Long
       cHook.PauseHook pfnEbGetExceptionInfo
       writelog "EbGetExceptionInfo " & pVBProjectNative & " " & lUnused1 & " " & lUnused2 & "  |" & Now
       EbGetExceptionInfo_user = cHook.CallByPointer(pfnEbGetExceptionInfo, vbLong, pVBProjectNative, lUnused1, lUnused2)
       cHook.ResumeHook pfnEbGetExceptionInfo
    End Function
    Public Function EbCopyExceptionInfo_user(ByVal pVBProjectNative As Long, ByVal lUnused1 As Long) As Long
       cHook.PauseHook pfnEbCopyExceptionInfo
       writelog "EbCopyExceptionInfo " & pVBProjectNative & " " & lUnused1 & "  |" & Now
       EbCopyExceptionInfo_user = cHook.CallByPointer(pfnEbCopyExceptionInfo, vbLong, pVBProjectNative, lUnused1)
       cHook.ResumeHook pfnEbCopyExceptionInfo
    End Function
    Public Function EbGetStepMode_user() As Long
       cHook.PauseHook pfnEbGetStepMode
       writelog "EbGetStepMode " & "  |" & Now
       EbGetStepMode_user = cHook.CallByPointer(pfnEbGetStepMode, vbLong)
       cHook.ResumeHook pfnEbGetStepMode
    End Function
    Public Function EbGetRedoText_user(ByVal pVBProjectNative As Long) As Long
       cHook.PauseHook pfnEbGetRedoText
       writelog "EbGetRedoText " & pVBProjectNative & "  |" & Now
       EbGetRedoText_user = cHook.CallByPointer(pfnEbGetRedoText, vbLong, pVBProjectNative)
       cHook.ResumeHook pfnEbGetRedoText
    End Function
    Public Function EbGetUndoText_user(ByVal pVBProjectNative As Long) As Long
       cHook.PauseHook pfnEbGetUndoText
       writelog "EbGetUndoText " & pVBProjectNative & "  |" & Now
       EbGetUndoText_user = cHook.CallByPointer(pfnEbGetUndoText, vbLong, pVBProjectNative)
       cHook.ResumeHook pfnEbGetUndoText
    End Function
    Public Function TipCompileModule_user(ByVal pVBProjectNative As Long) As Long
       cHook.PauseHook pfnTipCompileModule
       writelog "TipCompileModule " & pVBProjectNative & "  |" & Now
       TipCompileModule_user = cHook.CallByPointer(pfnTipCompileModule, vbLong, pVBProjectNative)
       cHook.ResumeHook pfnTipCompileModule
    End Function
    Public Function TipCompileProject_user(ByVal pVBProjectNative As Long) As Long
       cHook.PauseHook pfnTipCompileProject
       writelog "TipCompileProject " & pVBProjectNative & "  |" & Now
       TipCompileProject_user = cHook.CallByPointer(pfnTipCompileProject, vbLong, pVBProjectNative)
       cHook.ResumeHook pfnTipCompileProject
    End Function
    Public Function TipCompileProjectFull_user(ByVal pVBProjectNative As Long) As Long
       cHook.PauseHook pfnTipCompileProjectFull
       writelog "TipCompileProjectFull " & pVBProjectNative & "  |" & Now
       TipCompileProjectFull_user = cHook.CallByPointer(pfnTipCompileProjectFull, vbLong, pVBProjectNative)
       cHook.ResumeHook pfnTipCompileProjectFull
    End Function
    Public Function TipFinishExe2_user(ByVal pVBProjectNative As Long, ByVal lUnused1 As Long) As Long
       cHook.PauseHook pfnTipFinishExe2
       writelog "TipFinishExe2 " & pVBProjectNative & " " & lUnused1 & "  |" & Now
       TipFinishExe2_user = cHook.CallByPointer(pfnTipFinishExe2, vbLong, pVBProjectNative, lUnused1)
       cHook.ResumeHook pfnTipFinishExe2
    End Function
    Public Function TipMakeExe2_user(ByVal pVBProjectNative As Long, ByVal lUnused1 As Long, ByVal lUnused2 As Long, ByVal lUnused3 As Long, ByVal lUnused4 As Long) As Long
       cHook.PauseHook pfnTipMakeExe2
       writelog "TipMakeExe2 " & pVBProjectNative & " " & lUnused1 & " " & lUnused2 & " " & lUnused3 & " " & lUnused4 & "  |" & Now
       TipMakeExe2_user = cHook.CallByPointer(pfnTipMakeExe2, vbLong, pVBProjectNative, lUnused1, lUnused2, lUnused3, lUnused4)
       cHook.ResumeHook pfnTipMakeExe2
    End Function
    Public Function TipDeleteModule_user(ByVal pVBProjectNative As Long) As Long
       cHook.PauseHook pfnTipDeleteModule
       writelog "TipDeleteModule " & pVBProjectNative & "  |" & Now
       TipDeleteModule_user = cHook.CallByPointer(pfnTipDeleteModule, vbLong, pVBProjectNative)
       cHook.ResumeHook pfnTipDeleteModule
    End Function
    Public Function TipSetModuleName_user(ByVal pVBProjectNative As Long, ByVal lUnused1 As Long) As Long
       cHook.PauseHook pfnTipSetModuleName
       writelog "TipSetModuleName " & pVBProjectNative & " " & lUnused1 & "  |" & Now
       TipSetModuleName_user = cHook.CallByPointer(pfnTipSetModuleName, vbLong, pVBProjectNative, lUnused1)
       cHook.ResumeHook pfnTipSetModuleName
    End Function
    Public Function TipGetProjName_user(ByVal pVBProjectNative As Long, ByVal lUnused1 As Long) As Long
       cHook.PauseHook pfnTipGetProjName
       writelog "TipGetProjName " & pVBProjectNative & " " & lUnused1 & "  |" & Now
       TipGetProjName_user = cHook.CallByPointer(pfnTipGetProjName, vbLong, pVBProjectNative, lUnused1)
       cHook.ResumeHook pfnTipGetProjName
    End Function
    Public Function TipSetProjName_user(ByVal pVBProjectNative As Long, ByVal lUnused1 As Long) As Long
       cHook.PauseHook pfnTipSetProjName
       writelog "TipSetProjName " & pVBProjectNative & " " & lUnused1 & "  |" & Now
       TipSetProjName_user = cHook.CallByPointer(pfnTipSetProjName, vbLong, pVBProjectNative, lUnused1)
       cHook.ResumeHook pfnTipSetProjName
    End Function
    Public Function TipStartMakeExe_user(ByVal pVBProjectNative As Long, ByVal lUnused1 As Long, ByVal lUnused2 As Long, ByVal lUnused3 As Long, ByVal lUnused4 As Long) As Long
       cHook.PauseHook pfnTipStartMakeExe
       writelog "TipStartMakeExe " & pVBProjectNative & " " & lUnused1 & " " & lUnused2 & " " & lUnused3 & " " & lUnused4 & "  |" & Now
       TipStartMakeExe_user = cHook.CallByPointer(pfnTipStartMakeExe, vbLong, pVBProjectNative, lUnused1, lUnused2, lUnused3, lUnused4)
       cHook.ResumeHook pfnTipStartMakeExe
    End Function
    Public Function TipGetModuleName_user(ByVal pVBProjectNative As Long, ByVal lUnused1 As Long) As Long
       cHook.PauseHook pfnTipGetModuleName
       writelog "TipGetModuleName " & pVBProjectNative & " " & lUnused1 & "  |" & Now
       TipGetModuleName_user = cHook.CallByPointer(pfnTipGetModuleName, vbLong, pVBProjectNative, lUnused1)
       cHook.ResumeHook pfnTipGetModuleName
    End Function
    Public Function TipIsModuleModified_user(ByVal pVBProjectNative As Long, ByVal lUnused1 As Long) As Long
       writelog "TipIsModuleModified " & pVBProjectNative & " " & lUnused1 & "  |" & Now
       cHook.PauseHook pfnTipIsModuleModified
       TipIsModuleModified_user = cHook.CallByPointer(pfnTipIsModuleModified, vbLong, pVBProjectNative, lUnused1)
       cHook.ResumeHook pfnTipIsModuleModified
    End Function

  5. #5

    Thread Starter
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    685

    Re: Need help or documentation on vba6.dll functions, Eb api

    'In a designer addin (with base project Trick Advanced Tools)
    Code:
    Private Function InitializeHooks() As Boolean
       Dim hVba As Long
       If mIsHookInit = True Then
          InitializeHooks = True
          Exit Function
       End If
       hVba = apiGetModuleHandle(StrPtr("vba6.dll"))
       If hVba = 0 Then
          Exit Function
       End If
       
       
       'Showing code editor window
       pfnEbShowCode = apiGetProcAddress(hVba, "EbShowCode")
       If pfnEbShowCode = 0 Then Exit Function
       If cHook.HookFunction(pfnEbShowCode, AddressOf EbShowCode_user) = False Then
          Exit Function
       End If
       'Hiding code editor window
       pfnEbHideCode = apiGetProcAddress(hVba, "EbHideCode")
       If pfnEbHideCode = 0 Then Exit Function
       If cHook.HookFunction(pfnEbHideCode, AddressOf EbHideCode_user) = False Then
          Exit Function
       End If
       'showing parser error to dev
       pfnEbShowError = apiGetProcAddress(hVba, "EbShowError")
       If pfnEbShowError = 0 Then Exit Function
       If cHook.HookFunction(pfnEbShowError, AddressOf EbShowError_user) = False Then
          Exit Function
       End If
       'debug switch trigger
       pfnEbProjectReset = apiGetProcAddress(hVba, "EbProjectReset")
       If pfnEbProjectReset = 0 Then Exit Function
       If cHook.HookFunction(pfnEbProjectReset, AddressOf EbProjectReset_user) = False Then
          Exit Function
       End If
       'debug switching occurs repeatedly after and before EBProjectReset
       pfnEbIsResetting = apiGetProcAddress(hVba, "EbIsResetting")
       If pfnEbIsResetting = 0 Then Exit Function
       If cHook.HookFunction(pfnEbIsResetting, AddressOf EbIsResetting_user) = False Then
          Exit Function
       End If
       
       'debug command "Run to cursor"
       pfnEbSetStepToCursor = apiGetProcAddress(hVba, "EbSetStepToCursor")
       If pfnEbSetStepToCursor = 0 Then Exit Function
       If cHook.HookFunction(pfnEbSetStepToCursor, AddressOf EbSetStepToCursor_user) = False Then
          Exit Function
       End If
       pfnEbSetStepMode = apiGetProcAddress(hVba, "EbSetStepMode")
       If pfnEbSetStepMode = 0 Then Exit Function
       If cHook.HookFunction(pfnEbSetStepMode, AddressOf EbSetStepMode_user) = False Then
          Exit Function
       End If
       'debug continue
       pfnEbFExitBreakMode = apiGetProcAddress(hVba, "EbFExitBreakMode")
       If pfnEbFExitBreakMode = 0 Then Exit Function
       If cHook.HookFunction(pfnEbFExitBreakMode, AddressOf EbFExitBreakMode_user) = False Then
          Exit Function
       End If
       'remove project menu item
       pfnEbCloseProject = apiGetProcAddress(hVba, "EbCloseProject")
       If pfnEbCloseProject = 0 Then Exit Function
       If cHook.HookFunction(pfnEbCloseProject, AddressOf EbCloseProject_user) = False Then
          Exit Function
       End If
       'search find/replace api may take more or less params unknown, but should return row and column data TODO
       pfnEbStartSearch = apiGetProcAddress(hVba, "EbStartSearch")
       If pfnEbStartSearch = 0 Then Exit Function
       If cHook.HookFunction(pfnEbStartSearch, AddressOf EbStartSearch_user) = False Then
          Exit Function
       End If
       pfnEbSearchDone = apiGetProcAddress(hVba, "EbSearchDone")
       If pfnEbSearchDone = 0 Then Exit Function
       If cHook.HookFunction(pfnEbSearchDone, AddressOf EbSearchDone_user) = False Then
          Exit Function
       End If
       pfnEbSearchCanReplace = apiGetProcAddress(hVba, "EbSearchCanReplace")
       If pfnEbSearchCanReplace = 0 Then Exit Function
       If cHook.HookFunction(pfnEbSearchCanReplace, AddressOf EbSearchCanReplace_user) = False Then
          Exit Function
       End If
       pfnEbSearchFind = apiGetProcAddress(hVba, "EbSearchFind")
       If pfnEbSearchFind = 0 Then Exit Function
       If cHook.HookFunction(pfnEbSearchFind, AddressOf EbSearchFind_user) = False Then
          Exit Function
       End If
       pfnEbSearchReplace = apiGetProcAddress(hVba, "EbSearchReplace")
       If pfnEbSearchReplace = 0 Then Exit Function
       If cHook.HookFunction(pfnEbSearchReplace, AddressOf EbSearchReplace_user) = False Then
          Exit Function
       End If
       pfnEbSearchReplaceAll = apiGetProcAddress(hVba, "EbSearchReplaceAll")
       If pfnEbSearchReplaceAll = 0 Then Exit Function
       If cHook.HookFunction(pfnEbSearchReplaceAll, AddressOf EbSearchReplaceAll_user) = False Then
          Exit Function
       End If
       'initial state of find/replace dialog window and code editor
       pfnEbSearchGetCurState = apiGetProcAddress(hVba, "EbSearchGetCurState")
       If pfnEbSearchGetCurState = 0 Then Exit Function
       If cHook.HookFunction(pfnEbSearchGetCurState, AddressOf EbSearchGetCurState_user) = False Then
          Exit Function
       End If
       'syntax exception info
       pfnEbGetExceptionInfo = apiGetProcAddress(hVba, "EbGetExceptionInfo")
       If pfnEbGetExceptionInfo = 0 Then Exit Function
       If cHook.HookFunction(pfnEbGetExceptionInfo, AddressOf EbGetExceptionInfo_user) = False Then
          Exit Function
       End If
       pfnEbCopyExceptionInfo = apiGetProcAddress(hVba, "EbCopyExceptionInfo")
       If pfnEbCopyExceptionInfo = 0 Then Exit Function
       If cHook.HookFunction(pfnEbCopyExceptionInfo, AddressOf EbCopyExceptionInfo_user) = False Then
          Exit Function
       End If
       pfnEbGetStepMode = apiGetProcAddress(hVba, "EbGetStepMode")
       If pfnEbGetStepMode = 0 Then Exit Function
       If cHook.HookFunction(pfnEbGetStepMode, AddressOf EbGetStepMode_user) = False Then
          Exit Function
       End If
       pfnEbGetRedoText = apiGetProcAddress(hVba, "EbGetRedoText")
       If pfnEbGetRedoText = 0 Then Exit Function
       If cHook.HookFunction(pfnEbGetRedoText, AddressOf EbGetRedoText_user) = False Then
          Exit Function
       End If
       pfnEbGetUndoText = apiGetProcAddress(hVba, "EbGetUndoText")
       If pfnEbGetUndoText = 0 Then Exit Function
       If cHook.HookFunction(pfnEbGetUndoText, AddressOf EbGetUndoText_user) = False Then
          Exit Function
       End If
       pfnTipCompileModule = apiGetProcAddress(hVba, "TipCompileModule")
       If pfnTipCompileModule = 0 Then Exit Function
       If cHook.HookFunction(pfnTipCompileModule, AddressOf TipCompileModule_user) = False Then
          Exit Function
       End If
       pfnTipCompileProject = apiGetProcAddress(hVba, "TipCompileProject")
       If pfnTipCompileProject = 0 Then Exit Function
       If cHook.HookFunction(pfnTipCompileProject, AddressOf TipCompileProject_user) = False Then
          Exit Function
       End If
       pfnTipCompileProjectFull = apiGetProcAddress(hVba, "TipCompileProjectFull")
       If pfnTipCompileProjectFull = 0 Then Exit Function
       If cHook.HookFunction(pfnTipCompileProjectFull, AddressOf TipCompileProjectFull_user) = False Then
          Exit Function
       End If
       pfnTipFinishExe2 = apiGetProcAddress(hVba, "TipFinishExe2")
       If pfnTipFinishExe2 = 0 Then Exit Function
       If cHook.HookFunction(pfnTipFinishExe2, AddressOf TipFinishExe2_user) = False Then
          Exit Function
       End If
       pfnTipMakeExe2 = apiGetProcAddress(hVba, "TipMakeExe2")
       If pfnTipMakeExe2 = 0 Then Exit Function
       If cHook.HookFunction(pfnTipMakeExe2, AddressOf TipMakeExe2_user) = False Then
          Exit Function
       End If
       pfnTipDeleteModule = apiGetProcAddress(hVba, "TipDeleteModule")
       If pfnTipDeleteModule = 0 Then Exit Function
       If cHook.HookFunction(pfnTipDeleteModule, AddressOf TipDeleteModule_user) = False Then
          Exit Function
       End If
       pfnTipSetModuleName = apiGetProcAddress(hVba, "TipSetModuleName")
       If pfnTipSetModuleName = 0 Then Exit Function
       If cHook.HookFunction(pfnTipSetModuleName, AddressOf TipSetModuleName_user) = False Then
          Exit Function
       End If
       pfnTipGetProjName = apiGetProcAddress(hVba, "TipGetProjName")
       If pfnTipGetProjName = 0 Then Exit Function
       If cHook.HookFunction(pfnTipGetProjName, AddressOf TipGetProjName_user) = False Then
          Exit Function
       End If
       pfnTipSetProjName = apiGetProcAddress(hVba, "TipSetProjName")
       If pfnTipSetProjName = 0 Then Exit Function
       If cHook.HookFunction(pfnTipSetProjName, AddressOf TipSetProjName_user) = False Then
          Exit Function
       End If
       pfnTipStartMakeExe = apiGetProcAddress(hVba, "TipStartMakeExe")
       If pfnTipStartMakeExe = 0 Then Exit Function
       If cHook.HookFunction(pfnTipStartMakeExe, AddressOf TipStartMakeExe_user) = False Then
          Exit Function
       End If
       pfnTipGetModuleName = apiGetProcAddress(hVba, "TipGetModuleName")
       If pfnTipGetModuleName = 0 Then Exit Function
       If cHook.HookFunction(pfnTipGetModuleName, AddressOf TipGetModuleName_user) = False Then
          Exit Function
       End If
       pfnTipIsModuleModified = apiGetProcAddress(hVba, "TipIsModuleModified")
       If pfnTipIsModuleModified = 0 Then Exit Function
       If cHook.HookFunction(pfnTipIsModuleModified, AddressOf TipIsModuleModified_user) = False Then
          Exit Function
       End If
    End Function

  6. #6

    Thread Starter
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    685

    Re: Need help or documentation on vba6.dll functions, Eb api

    Firehacker or Trick, how do I use TipGetArgCount? If we can get the number of parameters the entire VBA6.dll processing can be monitored in one automated swoop.
    I started to document some of these as you can see. They can also be neatly exposed as events for a useful extensibility addin without the limitation that existing object model yields.
    Play the video slowly to see more detail in HD.



    I used something like this to create the code seen in the video above (semi-automated):
    Code:
    Public Sub DynamicInterface()
       On Error Resume Next
       Dim i As Long
       Dim txt As String
       Dim mcode As String
       Dim s() As String
       ReDim s(0)
       
       Open App.Path & "\eb.txt" For Input As #1
       Dim inp As String
       Do While Not EOF(1)
          Line Input #1, inp
          ' Your code here
          ReDim Preserve s(UBound(s) + 1)
          s(UBound(s)) = inp
       Loop
       Close #1
       
       MsgBox UBound(s)
       
       
       For i = 1 To UBound(s)
          txt = s(i) 'Public pfnTipFinishExe2         As Long
          mcode = mcode & "Public pfn" & txt & " As Long" & vbCrLf
       Next
       mcode = mcode & vbCrLf
       
       For i = 1 To UBound(s)
          txt = s(i) ' cHook.UnhookFunction pfnTipMakeExe2
          mcode = mcode & "cHook.UnhookFunction pfn" & txt & vbCrLf
       Next
       mcode = mcode & vbCrLf
       
       For i = 1 To UBound(s)
          txt = s(i)
          mcode = mcode & "pfn" & txt & " = apiGetProcAddress(hVba, " & Chr(34) & txt & Chr(34) & ")" & vbCrLf
          mcode = mcode & "If pfn" & txt & " = 0 Then Exit Function" & vbCrLf
          mcode = mcode & "If cHook.HookFunction(pfn" & txt & ", AddressOf " & txt & "_user) = False Then" & vbCrLf
          mcode = mcode & "   Exit Function" & vbCrLf
          mcode = mcode & "End If" & vbCrLf
       Next
       mcode = mcode & vbCrLf
       
       For i = 1 To UBound(s)
          txt = s(i)
          mcode = mcode & "Public Function " & txt & "_user(ByVal pVBProjectNative As Long, ByVal lUnused1 As Long, ByVal lUnused2 As Long, ByVal lUnused3 As Long, ByVal lUnused4 As Long) As Long" & vbCrLf
          mcode = mcode & "   'cHook.PauseHook pfn" & txt & vbCrLf
          mcode = mcode & "   writelog " & Chr(34) & txt & Chr(34) & " " & Chr(38) & " pVBProjectNative " & Chr(38) & " lUnused1 " & Chr(38) & " lUnused2 " & Chr(38) & " lUnused3 " & Chr(38) & " lUnused4" & vbCrLf
          mcode = mcode & "   " & txt & "_user = cHook.CallByPointer(pfn" & txt & ", vbLong, pVBProjectNative, lUnused1, lUnused2, lUnused3, lUnused4)" & vbCrLf
          mcode = mcode & "   'cHook.ResumeHook  pfn" & txt & vbCrLf
          mcode = mcode & "End Function " & vbCrLf
       Next
       Clipboard.SetText (mcode)
       
       
    End Sub
    This method works relatively well but takes some trial and error/crashes only because the number of parameters is simply unknown.

  7. #7
    Frenzied Member
    Join Date
    Feb 2015
    Posts
    1,834

    Re: Need help or documentation on vba6.dll functions, Eb api

    Quote Originally Posted by TTn View Post
    Firehacker or Trick, how do I use TipGetArgCount?
    Code:
    Option Explicit
    
    Private Declare Function EbGetExecutingProj Lib "vba6" ( _
                             ByRef cProject As IUnknown) As Long
    Private Declare Function TipGetFunctionId Lib "vba6" ( _
                             ByVal cProj As IUnknown, _
                             ByVal bstrName As Long, _
                             ByVal bstrId As Long) As Long
    Private Declare Function TipGetFuncInfo Lib "vba6" ( _
                             ByVal cProj As IUnknown, _
                             ByVal bstrId As Long, _
                             ByRef pFuncInfo As Long) As Long
    Private Declare Function TipGetArgCount Lib "vba6" ( _
                             ByVal pFuncInfo As Long, _
                             ByRef lCount As Long) As Long
    Private Declare Function TipGetArgType Lib "vba6" ( _
                             ByVal pFuncInfo As Long, _
                             ByVal lIndex As Long, _
                             ByRef lType As Long) As Long
    Private Declare Sub TipReleaseFuncInfo Lib "vba6" ( _
                        ByVal pFuncInfo As Long)
                             
    Sub Main()
        Dim cProj   As IUnknown
        Dim sFnId   As String
        Dim pFnInfo As Long
        Dim lArgs   As Long
        Dim lIndex  As Long
        Dim lType   As Long
        
        EbGetExecutingProj cProj
        TipGetFunctionId cProj, StrPtr("foo"), VarPtr(sFnId)
        TipGetFuncInfo cProj, StrPtr(sFnId), pFnInfo
        TipGetArgCount pFnInfo, lArgs
        
        For lIndex = 0 To lArgs
            ' // 0 - return type
            TipGetArgType pFnInfo, lIndex, lType
            Debug.Print lType
        Next
        
        TipReleaseFuncInfo pFnInfo
        
    End Sub
    
    
    Public Function foo( _
                    ByVal lArg1 As Long, _
                    ByVal vArg2 As Variant, _
                    ByVal sArg3 As String) As Boolean
                    
    End Function

  8. #8
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    6,762

    Re: Need help or documentation on vba6.dll functions, Eb api

    That's really quite cool. It could come in handy for an add-in that did project documenting.

    I also figured out that a type=24 is what's returned for SUB procedures. Apparently, 24=void return.

    I also put together this little function to help understand things. It can be used as a wrapper on the Debug.Print. I didn't handle arrays though (as that bit-flag out there). Someone else is welcome to do that if they so choose:

    Code:
    
    Private Function TypeString(ByVal lType As Long) As String
        lType = lType And Not vbArray       ' We don't report if it's an array.
        Select Case lType
        Case vbInteger:     TypeString = "Integer"
        Case vbLong:        TypeString = "Long"
        Case vbSingle:      TypeString = "Single"
        Case vbDouble:      TypeString = "Double"
        Case vbCurrency:    TypeString = "Currency"
        Case vbDate:        TypeString = "Date"
        Case vbString:      TypeString = "String"
        Case vbObject:      TypeString = "Object"
        Case vbBoolean:     TypeString = "Boolean"
        Case vbVariant:     TypeString = "Variant"
        Case vbByte:        TypeString = "Byte"
        Case 24:            TypeString = "Void" ' This is the type value for SUB procedure's return value.
        Case Else:          TypeString = "Unknown"
        End Select
    End Function
    
    
    Any software I post in these forums written by me is provided “AS IS” without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that I’ve been programming since the mid-1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a “VB6 random code folder” that is overflowing. I’ve been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will re-attach those licenses and/or attributions. To all, peace and happiness.

  9. #9

    Thread Starter
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    685

    Re: Need help or documentation on vba6.dll functions, Eb api

    Quote Originally Posted by The trick View Post
    Code:
    Option Explicit
    
    Private Declare Function EbGetExecutingProj Lib "vba6" ( _
                             ByRef cProject As IUnknown) As Long
    Private Declare Function TipGetFunctionId Lib "vba6" ( _
                             ByVal cProj As IUnknown, _
                             ByVal bstrName As Long, _
                             ByVal bstrId As Long) As Long
    Private Declare Function TipGetFuncInfo Lib "vba6" ( _
                             ByVal cProj As IUnknown, _
                             ByVal bstrId As Long, _
                             ByRef pFuncInfo As Long) As Long
    Private Declare Function TipGetArgCount Lib "vba6" ( _
                             ByVal pFuncInfo As Long, _
                             ByRef lCount As Long) As Long
    Private Declare Function TipGetArgType Lib "vba6" ( _
                             ByVal pFuncInfo As Long, _
                             ByVal lIndex As Long, _
                             ByRef lType As Long) As Long
    Private Declare Sub TipReleaseFuncInfo Lib "vba6" ( _
                        ByVal pFuncInfo As Long)
                             
    Sub Main()
        Dim cProj   As IUnknown
        Dim sFnId   As String
        Dim pFnInfo As Long
        Dim lArgs   As Long
        Dim lIndex  As Long
        Dim lType   As Long
        
        EbGetExecutingProj cProj
        TipGetFunctionId cProj, StrPtr("foo"), VarPtr(sFnId)
        TipGetFuncInfo cProj, StrPtr(sFnId), pFnInfo
        TipGetArgCount pFnInfo, lArgs
        
        For lIndex = 0 To lArgs
            ' // 0 - return type
            TipGetArgType pFnInfo, lIndex, lType
            Debug.Print lType
        Next
        
        TipReleaseFuncInfo pFnInfo
        
    End Sub
    
    
    Public Function foo( _
                    ByVal lArg1 As Long, _
                    ByVal vArg2 As Variant, _
                    ByVal sArg3 As String) As Boolean
                    
    End Function
    Many thanks! It looks pretty easy after all.

  10. #10

    Thread Starter
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    685

    Re: Need help or documentation on vba6.dll functions, Eb api

    Quote Originally Posted by Elroy View Post
    That's really quite cool. It could come in handy for an add-in that did project documenting.

    I also figured out that a type=24 is what's returned for SUB procedures. Apparently, 24=void return.

    I also put together this little function to help understand things. It can be used as a wrapper on the Debug.Print. I didn't handle arrays though (as that bit-flag out there). Someone else is welcome to do that if they so choose:

    Code:
    
    Private Function TypeString(ByVal lType As Long) As String
        lType = lType And Not vbArray       ' We don't report if it's an array.
        Select Case lType
        Case vbInteger:     TypeString = "Integer"
        Case vbLong:        TypeString = "Long"
        Case vbSingle:      TypeString = "Single"
        Case vbDouble:      TypeString = "Double"
        Case vbCurrency:    TypeString = "Currency"
        Case vbDate:        TypeString = "Date"
        Case vbString:      TypeString = "String"
        Case vbObject:      TypeString = "Object"
        Case vbBoolean:     TypeString = "Boolean"
        Case vbVariant:     TypeString = "Variant"
        Case vbByte:        TypeString = "Byte"
        Case 24:            TypeString = "Void" ' This is the type value for SUB procedure's return value.
        Case Else:          TypeString = "Unknown"
        End Select
    End Function
    
    
    Thank you Elroy, it's been awhile. Good to see you are doing well.

  11. #11

    Thread Starter
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    685

    Re: Need help or documentation on vba6.dll functions, Eb api

    This works awesome Trick! We can finally document these in a significant manner.

    I have been using the Undo/Redo to enhance the number of undos and it works without error for a couple months now. A big enhancement. This is very small compared to what is possible though.

    I think there needs to be a minor correction to post #7 for the number of args since it is zero padded, ie:
    Code:
        For lIndex = 0 To lArgs -1 
            ' // 0 - return type
            TipGetArgType pFnInfo, lIndex, lType
            Debug.Print lType
        Next

  12. #12

    Thread Starter
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    685

    Re: Need help or documentation on vba6.dll functions, Eb api

    Here is how to invoke some of the commandbarbutton functions by an id.
    The EbInvokeItem function appears to take one parameter arg, with perhaps more optional overloads.

    Code:
    Private Declare Function apiEbInvokeItem Lib "vba6.dll" Alias "EbInvokeItem" (ByVal id As Long) As Long
    'undo
    Private Sub Command1_Click() 
       apiEbInvokeItem 7 
    End Sub
    'redo
    Private Sub Command2_Click()
       apiEbInvokeItem 8
    End Sub
    I'm not familiar with that id though. In the object model it would be 128, 129 for undo, redo.
    In any case, we can catch a glimpse of how this all works behind the scenes.

  13. #13

    Thread Starter
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    685

    Re: Need help or documentation on vba6.dll functions, Eb api

    Here are some of the ids listed as constants.
    Code:
    Private Const INVOKE_STEP_INFO As Long = 0
    Private Const INVOKE_STEP_OVER As Long = 1
    Private Const INVOKE_CONTINUE As Long = 2 'WHILE STEPPING THROUGH
    Private Const INVOKE_STOP1_STEP As Long = 3 '?? aborts step mode
    Private Const INVOKE_STOP2_STEP As Long = 4 '?? aborts step mode
    Private Const INVOKE_SAVE_AS_TEXT As Long = 5 ' save module as text file (save dialog)
    Private Const INVOKE_INSERT_FILE As Long = 6
    Private Const INVOKE_UNDO As Long = 7
    Private Const INVOKE_REDO As Long = 8
    'Private Const INVOKE_ As Long =9 '?? Nothing
    Private Const INVOKE_WINDOW_SPLIT As Long = 10
    Private Const INVOKE_CUT As Long = 11
    Private Const INVOKE_COPY As Long = 12
    Private Const INVOKE_PASTE As Long = 13
    Private Const INVOKE_DELETE As Long = 14
    Private Const INVOKE_FIND As Long = 15
    Private Const INVOKE_FINDNEXT As Long = 16
    Private Const INVOKE_FINDNEXTREVERSE As Long = 17 'up search if toggle is down by default, otherwise opposite
    Private Const INVOKE_FIND_REPLACE As Long = 18
    Private Const INVOKE_TOGGLE_BREAKPOINT As Long = 19
    Private Const INVOKE_CLEAR_ALL_BREAKPOINTS As Long = 20
    Private Const INVOKE_ADD_WATCH As Long = 21
    Private Const INVOKE_EDIT_WATCH As Long = 22
    Private Const INVOKE_QUICK_WATCH As Long = 23
    'Private Const INVOKE_ As Long =24 '?? Nothing
    Private Const INVOKE_VIEW_WATCH As Long = 25
    Private Const INVOKE_VIEW_LOCALS As Long = 26
    Private Const INVOKE_VIEW_IMMEDIATE As Long = 27
    Private Const INVOKE_GOTO_DEFINITION As Long = 28 'object browser loaded with token to be defined
    Private Const INVOKE_REFERENCES As Long = 29
    Private Const INVOKE_CALL_STACK As Long = 30
    'Private Const INVOKE_ As Long = 31 '?? CRASH
    'Private Const INVOKE_ As Long =32 '?? Nothing
    'Private Const INVOKE_ As Long =33'?? CRASH
    Private Const INVOKE_INDENT As Long = 34
    Private Const INVOKE_OUTDENT As Long = 35
    Private Const INVOKE_LAST_POSITION As Long = 36
    'Private Const INVOKE_ As Long =37'?? Nothing
    Private Const INVOKE_TOGGLE_BOOKMARK As Long = 38
    Private Const INVOKE_NEXT_BOOKMARK As Long = 39
    Private Const INVOKE_PREVIOUS_BOOKMARK As Long = 40
    Private Const INVOKE_CLEAR_ALL_BOOKMARKS As Long = 41
    'Private Const INVOKE_ As Long =42 '?? Nothing
    Private Const INVOKE_OBJECT_BROWSER As Long = 43 'object browser direct
    Private Const INVOKE_STEP_OUT As Long = 44
    Private Const INVOKE_LIST_PROPERTIES_METHODS As Long = 45
    Private Const INVOKE_COMPLETE_WORD As Long = 46
    Private Const INVOKE_LIST_CONSTANTS As Long = 47
    Private Const INVOKE_BEEP As Long = 48 'Beep sound?
    'Private Const INVOKE_ As Long =49'?? CRASH
    Private Const INVOKE_DELETE_LINE As Long = 50 'delete line function (Ctrl+Y)
    Private Const INVOKE_NEW_LINE As Long = 51
    Private Const INVOKE_QUICK_INFO As Long = 52
    Private Const INVOKE_COMMENT As Long = 53
    Private Const INVOKE_UNCOMMENT As Long = 54
    Private Const INVOKE_FINDNEXT_NO_DIALOG As Long = 55
    Private Const INVOKE_FINDNEXTREVERSE_NO_DIALOG As Long = 56
    Private Const INVOKE_PARAM_INFO As Long = 57
    'Private Const INVOKE_ As Long = 58 '?? Nothing
    'Private Const INVOKE_ As Long =59'?? Nothing
    'Private Const INVOKE_ As Long =60'?? Nothing
    Private Const INVOKE_SELECT_ALL As Long = 61
    
    Private Declare Function apiEbInvokeItem Lib "vba6.dll" Alias "EbInvokeItem" (ByVal id As Long) As Long
    It makes it easier and more reliable to invoke commands in this way.

    EDIT: updated a few of these with the missing functionality.

  14. #14

  15. #15

    Thread Starter
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    685

    Re: Need help or documentation on vba6.dll functions, Eb api

    Quote Originally Posted by The trick View Post
    No. The zero index is the type of return value.
    Ok, that's strange because the types are not matching. Ah, that must be because they are passed ByRef. Ok, I see. The long passed by reference in this sample itself has type DT_BYREF_I4=16387
    (A pointer to a 4-byte, signed integer.)

    I still cannot determine the number of args that these vba6.dll Eb functions have, before declaration.

  16. #16

    Thread Starter
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    685

    Re: Need help or documentation on vba6.dll functions, Eb api

    The function to return the declaration should be something like this:
    Code:
    Option Explicit
    Private Const ERROR_SUCCESS As Long = 0
    Private Const ERROR_VOID As Long = 35
    Private Const DT_BYREF As Long = 16384 'by reference flag
    'https://docs.microsoft.com/en-us/dotnet/api/microsoft.sqlserver.dts.runtime.wrapper.datatype?view=sqlserver-2019
    Private Const DT_BYTES As Long = 128
    Private Const DT_DBDATE As Long = 133
    Private Const DT_DBTIME As Long = 134
    Private Const DT_DBTIME2 As Long = 145
    Private Const DT_DBTIMESTAMP As Long = 135
    Private Const DT_DBTIMESTAMP2 As Long = 304
    Private Const DT_DBTIMESTAMPOFFSET As Long = 146
    Private Const DT_FILETIME As Long = 64
    Private Const DT_GUID As Long = 72
    Private Const DT_I8 As Long = 20
    Private Const DT_IMAGE As Long = 301
    Private Const DT_NTEXT As Long = 303
    Private Const DT_NUMERIC As Long = 131
    Private Const DT_STR As Long = 129
    Private Const DT_TEXT As Long = 302
    Private Const DT_UI1 As Long = 17 'A 1-byte, unsigned integer. The numeric value is 17?
    Private Const DT_UI2 As Long = 18
    Private Const DT_UI4 As Long = 19
    Private Const DT_UI8 As Long = 21
    Private Const DT_WSTR As Long = 130
    Private Declare Function EbGetExecutingProj Lib "vba6.dll" (ByRef cProject As Long) As Long
    Private Declare Function TipGetFunctionId Lib "vba6.dll" (ByVal cProj As Long, ByVal bstrName As Long, ByVal bstrId As Long) As Long
    Private Declare Function TipGetFunctionStringId Lib "vba6.dll" (ByVal hProject As Long, ByVal strFunctionName As String, ByRef strFunctionId As String) As Long
    Private Declare Function TipGetFuncInfo Lib "vba6.dll" (ByVal cProj As Long, ByVal bstrId As Long, ByRef pFuncInfo As Long) As Long
    Private Declare Function TipGetArgCount Lib "vba6.dll" (ByVal pFuncInfo As Long, ByRef lCount As Long) As Long
    Private Declare Function TipGetArgType Lib "vba6.dll" (ByVal pFuncInfo As Long, ByVal lIndex As Long, ByRef lType As Long) As Long
    Private Declare Function TipReleaseFuncInfo Lib "vba6.dll" (ByVal pFuncInfo As Long) As Long
    Private Declare Function TipReleaseProject Lib "vba6.dll" (ByVal cProject As Long) As Long
    Private Declare Function TipGetLpfnOfFunctionId Lib "vba6.dll" (ByVal hProject As Long, ByVal strFunctionId As String, ByRef lpfn As Long) As Long 'app defined call when event occurs
    Private Declare Function foo Lib "vba6" (ByRef cProject As Boolean, ByRef d As Double, ByVal s As String, ByRef ss() As String) As Long 'fake
    'Private Declare Function EbGetExecutingProj Lib "vba6" (ByRef cProject As IUnknown) As Long
    'Private Declare Function TipGetFunctionId Lib "vba6" (ByVal cProj As IUnknown, ByVal bstrName As Long, ByVal bstrId As Long) As Long
    'Private Declare Function TipGetFuncInfo Lib "vba6" (ByVal cProj As Long, ByVal bstrId As Long, ByRef pFuncInfo As IUnknown) As Long
    'Private Declare Function TipGetArgCount Lib "vba6" (ByVal pFuncInfo As Long, ByRef lCount As IUnknown) As Long
    'Private Declare Function TipGetArgType Lib "vba6" (ByVal pFuncInfo As Long, ByVal lIndex As Long, ByRef lType As IUnknown) As Long
    'Private Declare Sub TipReleaseFuncInfo Lib "vba6" (ByVal pFuncInfo As Long)
    Sub Main()
      MsgBox GetDeclaration("EbGetExecutingProj")
    End Sub
    Private Function IsByRef(ByVal flags As Long) As Boolean
       IsByRef = flags And DT_BYREF
    End Function
    Private Function IsvbArray(ByVal flags As Long) As Boolean
       IsvbArray = flags And vbArray
    End Function
    
    Public Function GetDeclaration(ByVal funcName As String) As String
       Dim cProj   As Long
       Dim sFnId   As String
       Dim pFnInfo As Long
       Dim lArgs   As Long
       Dim lIndex  As Long
       Dim lType   As Long
       Dim ret As Long
       Dim hProj As Long
       Dim s As String
       Dim returntype As String
       s = "Private Declare Function " & funcName & " Lib " & Chr(34) & "vba6.dll" & Chr(34) & " ("
       
       hProj = EbGetExecutingProj(cProj) 'returns index of default project? increments each time debugged etc
       If hProj <> 0 And cProj <> 0 Then
          
          ret = TipGetFunctionId(cProj, StrPtr(funcName), VarPtr(sFnId))
          If ret = ERROR_SUCCESS And StrPtr(sFnId) <> 0 Then
             '         If TipGetLpfnOfFunctionId(hProject, sID, pfn) = 0 Then
             '            ' AddrOf = pfn
             '         End If
             ret = TipGetFuncInfo(cProj, StrPtr(sFnId), pFnInfo)
             If ret = ERROR_SUCCESS And pFnInfo <> 0 Then
                
                ret = TipGetArgCount(pFnInfo, lArgs)
                If ret = ERROR_SUCCESS Then
                   
                   If lArgs = 0 Then
                      s = s & "void" & vbCrLf
                   Else
                      For lIndex = 0 To lArgs
                         ret = TipGetArgType(pFnInfo, lIndex, lType)
                         If ret = ERROR_SUCCESS Then
                            If lIndex = 0 Then
                               returntype = TypeString(lType, 0)
                            Else
                               s = s & TypeString(lType, lIndex)
                            End If
                         End If
                      Next
                   End If
                Else
                   MsgBox "TipGetArgCount error: " & ret
                End If
                ret = TipReleaseFuncInfo(pFnInfo)
             Else
                 MsgBox "TipGetFuncInfo error: " & ret
             End If
          Else
               MsgBox "TipGetFunctionId error: " & ret
          End If
       Else
           MsgBox "EbGetExecutingProj error: " & ret
       End If
       GetDeclaration = s & returntype
    End Function
    Private Function TypeString(ByVal lType As Long, ByRef index As Long) As String
       Dim ts As String
       Dim ar As String
       If index = 0 Then
          ts = ") As "
       Else
          If IsvbArray(lType) = True Then
             lType = lType - vbArray
             ar = "()"
          End If
          Dim comma As String
          If index > 1 Then comma = ", "
          If IsByRef(lType) = True Then
             lType = lType - DT_BYREF
             ts = comma & "ByRef x" & index & ar & " As "
          Else
             ts = comma & "ByVal x" & index & ar & " As "
          End If
       End If
       Select Case lType
       Case vbInteger:     ts = ts & "Integer"
       Case vbLong:        ts = ts & "Long"
       Case vbSingle:      ts = ts & "Single"
       Case vbDouble:      ts = ts & "Double"
       Case vbCurrency:    ts = ts & "Currency"
       Case vbDate:        ts = ts & "Date"
       Case vbString:      ts = ts & "String"
       Case vbObject:      ts = ts & "Object"
       Case vbBoolean:     ts = ts & "Boolean"
       Case vbVariant:     ts = ts & "Variant"
       Case vbByte:        ts = ts & "Byte"
       Case vbArray:        ts = ts & "Array"
       Case vbDataObject:   ts = ts & "IUnknown" 'IBM
       Case vbDecimal:      ts = ts & "Decimal"
       Case vbEmpty:        ts = ts & "Empty"
       Case vbError:        ts = ts & "Error"
       Case vbNull:         ts = ts & "Null"
       Case vbUserDefinedType:  ts = ts & "User Defined Type"
       Case 24:            ts = ts & "Void"  ' This is the type value for SUB procedure's return value.
       Case Else:          ts = ts & lType
       End Select
       TypeString = ts
    End Function
    Public Function AddrOf(ByRef sFuncName As String) As Long
       Dim hProject    As Long
       Dim lResult     As Long
       Dim sID         As String
       Dim pfn         As Long
       Dim sUnicode    As String
       sUnicode = StrConv(sFuncName, vbUnicode)
       EbGetExecutingProj hProject
       If hProject <> 0 Then
          If TipGetFunctionStringId(hProject, sUnicode, sID) = 0 Then
             If TipGetLpfnOfFunctionId(hProject, sID, pfn) = 0 Then
                AddrOf = pfn
             End If
          End If
       End If
    End Function

  17. #17

    Thread Starter
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    685

    Re: Need help or documentation on vba6.dll functions, Eb api

    It appears that some of these API declarations only work while being debugged, and do not work in an addin. At least out of box. Several functions take cProj as the first parameter/arg passed ByVal.
    I found out that it is important to use ReleaseProject if one is obtained, just like ReleaseFuncInfo. Here is a test project with some comments and several new API declarations that work. I included the basic method to help guess the arguments/paramters.
    I expanded on Trick's samples and discovered that these work:
    Code:
    Option Explicit
    Private Const DT_BYREF As Long = 16384 'by reference flag
    Private Const ERROR_SUCCESS As Long = 0
    'ExecutingProj
    Private Declare Function apiEbGetExecutingProj Lib "vba6.dll" Alias "EbGetExecutingProj" (ByRef cProj As Long) As Long
    Private Declare Function apiTipGetFunctionId Lib "vba6.dll" Alias "TipGetFunctionId" (ByVal cProj As Long, ByVal bstrName As Long, ByVal bstrId As Long) As Long
    Private Declare Function apiTipGetFuncInfo Lib "vba6.dll" Alias "TipGetFuncInfo" (ByVal cProj As Long, ByVal bstrId As Long, ByRef pFuncInfo As Long) As Long
    Private Declare Function apiTipReleaseProject Lib "vba6.dll" Alias "TipReleaseProject" (ByVal cProj As Long) As Long
    Private Declare Function apiEbCloseProject Lib "vba6.dll" Alias "EbCloseProject" (ByVal cProj As Long) As Long
    Private Declare Function apiTipCompileModule Lib "vba6.dll" Alias "TipCompileModule" (ByVal cProj As Long) As Long
    Private Declare Function apiTipCompileProject Lib "vba6.dll" Alias "TipCompileProject" (ByVal cProj As Long) As Long
    Private Declare Function apiTipCompileProjectFull Lib "vba6.dll" Alias "TipCompileProjectFull" (ByVal cProj As Long) As Long
    Private Declare Function apiTipGetProjName Lib "vba6.dll" Alias "TipGetProjName" (ByVal cProj As Long, ByRef param2 As Long) As Long
    Private Declare Function apiTipGetFunctionIdAsString Lib "vba6.dll" Alias "TipGetFunctionId" (ByVal cProj As Long, ByVal strFunctionName As String, ByRef strFunctionId As String) As Long
    
    Private Declare Function apiTipGetLpfnOfFunctionId Lib "vba6.dll" Alias "TipGetLpfnOfFunctionId" (ByVal cProj As Long, ByVal strFunctionId As String, ByRef lpfn As Long) As Long  'app defined call when event occurs
    Private Declare Function apiEbShowCode Lib "vba6.dll" Alias "EbShowCode" (ByVal cProj As Long, ByVal param2 As Long) As Long
    Private Declare Function apiEbHideCode Lib "vba6.dll" Alias "EbHideCode" (ByVal cProj As Long) As Long
    Private Declare Function apiTipSetProjName Lib "vba6.dll" Alias "TipSetProjName" (ByVal cProj As Long, ByRef param2 As Long) As Long 'non zero
    'debug
    Private Declare Function apiEbGetStepMode Lib "vba6.dll" Alias "EbGetStepMode" () As Long
    Private Declare Function apiEbDoIdle Lib "vba6.dll" Alias "EbDoIdle" () As Long
    Private Declare Function apiEbIsResetting Lib "vba6.dll" Alias "EbIsResetting" () As Long
    Private Declare Function apiEbSetStepToCursor Lib "vba6.dll" Alias "EbSetStepToCursor" (ByRef param1 As Long) As Long
    Private Declare Function apiEbSetStepMode Lib "vba6.dll" Alias "EbSetStepMode" (ByVal param1 As Long) As Long 'non zero - byref multiple?
    Private Declare Function apiEbFExitBreakMode Lib "vba6.dll" Alias "EbFExitBreakMode" () As Long
    Private Declare Function apiEbProjectReset Lib "vba6.dll" Alias "EbProjectReset" () As Long 'bump out of debug, ie stop
    Private Declare Function apiEbNotifyWindow Lib "vba6.dll" Alias "EbNotifyWindow" (ByRef param1 As Long, ByRef param2 As Long, ByRef param3 As Long) As Long 'highlights line for compile error/exception
    'Project analysis
    Private Declare Function apiTipGetArgCount Lib "vba6.dll" Alias "TipGetArgCount" (ByVal pFuncInfo As Long, ByRef lCount As Long) As Long
    Private Declare Function apiTipGetArgType Lib "vba6.dll" Alias "TipGetArgType" (ByVal pFuncInfo As Long, ByVal lIndex As Long, ByRef lType As Long) As Long
    Private Declare Function apiTipReleaseFuncInfo Lib "vba6.dll" Alias "TipReleaseFuncInfo" (ByVal pFuncInfo As Long) As Long
    
    'IDE commands
    Private Declare Function apiEbGetRedoText Lib "vba6.dll" Alias "EbGetRedoText" (ByRef param1 As Long) As Long 'non zero
    Private Declare Function apiEbGetUndoText Lib "vba6.dll" Alias "EbGetUndoText" (ByRef param1 As Long) As Long 'non zero
    'find/replace
    Private Declare Function apiEbSearchFind Lib "vba6.dll" Alias "EbSearchFind" () As Long 'non zero
    Private Declare Function apiEbSearchDone Lib "vba6.dll" Alias "EbSearchDone" () As Long
    Private Declare Function apiEbSearchCanReplace Lib "vba6.dll" Alias "EbSearchCanReplace" () As Long
    Private Declare Function apiEbSearchReplace Lib "vba6.dll" Alias "EbSearchReplace" () As Long 'non zero
    Private Declare Function apiEbSearchReplaceAll Lib "vba6.dll" Alias "EbSearchReplaceAll" () As Long
    Private Declare Function apiEbSearchGetCurState Lib "vba6.dll" Alias "EbSearchGetCurState" () As Long
    
    'error
    Private Declare Function apiEbGetExceptionInfo Lib "vba6.dll" Alias "EbGetExceptionInfo" (ByRef param1 As Long) As Long
    Private Declare Function apiEbShowError Lib "vba6.dll" Alias "EbShowError" (ByVal param1 As Long) As Long
    '
    Private Declare Function foo Lib "vba6" (ByRef cProject As Boolean, ByRef d As Double, ByVal s As String, ByRef ss() As String) As Long 'fake
    Dim a, b, c, d, e, f, g As Long 'Potential params
    Sub Main()
       TestDeclaration
    End Sub
    Public Sub TestDeclaration()
       On Error Resume Next
       Dim cProj   As Long
       Dim hProj As Long
       Dim ret As Long
       
       
       hProj = apiEbGetExecutingProj(cProj) 'returns some kind of instance index of default project. Increments each time debugged, related to RelaseProject return value plus one
       If hProj <> 0 And cProj <> 0 Then
          On Error GoTo releaseproj
          Dim sFnId   As String
          Dim s As String 'capture results
          
          'Method to test API here:
          'Most of these functions appear to return zero for success, otherwise error.  There are exceptions of course.
          'Most parameters can be passed by reference and will still compile, unless that arg takes cProj or another DataObject type.  So far cProj & hMod appears in the first arg.
          'If the function takes cProj or another DataObject in an arg, then the IDE may crash until you change the default ByRef to ByVal and pass the cProj/Object to it
          'The number of params is incorrect if this error message is displayed: "Run-time error 49: Bad DLL calling convention"
          'if the IDE still crashes with any number of args then try pass the first arg ByVal (Save each time before debugging)
          '
          '
          '
          'Test new API here to obtain the number of parameters and information about how they are passed
          'a = 0: b = 0: c = 0: d = 0: e = 0: f = 0: g = 0: ret = -1
          'ret = Eb_(a)
          's = s & WriteParams("Eb_", ret, a, b, c, d, e, f, g) & vbCrLf
          ''
          ''
          ''
          'get function id
          a = 0: b = 0: c = 0: d = 0: e = 0: f = 0: g = 0: ret = -1
          ret = apiTipGetFunctionId(cProj, StrPtr("foo"), VarPtr(sFnId)) '
          s = s & WriteParams("TipGetFunctionId", ret, cProj, StrPtr("EbGetExecutingProj"), VarPtr(sFnId)) & vbCrLf
          '
          If ret = ERROR_SUCCESS Then
             Dim pFnInfo As Long
             ''Function id required to get function info
             a = 0: b = 0: c = 0: d = 0: e = 0: f = 0: g = 0: ret = -1
             ret = apiTipGetFuncInfo(cProj, StrPtr(sFnId), pFnInfo)
             s = s & WriteParams("TipGetFuncInfo", ret, cProj, StrPtr(sFnId), pFnInfo) & vbCrLf
             ' 'Function info required to get address, arg count, and arg-type-with-flags
             If pFnInfo <> 0 Then
                Dim lArgs   As Long
                Dim lIndex  As Long
                Dim lType   As Long
                On Error GoTo releasefuncinfo
                a = 0: b = 0: c = 0: d = 0: e = 0: f = 0: g = 0: ret = -1
                ret = apiTipGetArgCount(pFnInfo, lArgs)
                s = s & WriteParams("TipGetArgCount", ret, pFnInfo, lArgs) & vbCrLf
                '
                For lIndex = 0 To lArgs
                   a = 0: b = 0: c = 0: d = 0: e = 0: f = 0: g = 0: ret = -1
                   ret = apiTipGetArgType(pFnInfo, lIndex, lType)
                   s = s & WriteParams("TipGetArgType", ret, pFnInfo, lIndex, lType) & vbCrLf '& TypeString(lType, lIndex)
                Next
    releasefuncinfo:
                'release function info when done
                a = 0: b = 0: c = 0: d = 0: e = 0: f = 0: g = 0: ret = -1
                ret = apiTipReleaseFuncInfo(pFnInfo)
                s = s & WriteParams("TipReleaseFuncInfo", ret, pFnInfo) & vbCrLf
             End If
          End If
          '      '
          '      '
          '      '
          a = 0: b = 0: c = 0: d = 0: e = 0: f = 0: g = 0: ret = -1
          ret = apiTipGetProjName(cProj, b)
          s = s & WriteParams("TipGetProjName", ret, cProj, b) & vbCrLf
          '
          a = 0: b = 0: c = 0: d = 0: e = 0: f = 0: g = 0: ret = -1
          ret = apiTipSetProjName(cProj, b)
          s = s & WriteParams("TipSetProjName", ret, cProj, b) & vbCrLf
          '
          a = 0: b = 0: c = 0: d = 0: e = 0: f = 0: g = 0: ret = -1
          ret = apiEbHideCode(cProj)
          s = s & WriteParams("EbHideCode", ret, cProj) & vbCrLf
          '
          a = 0: b = 0: c = 0: d = 0: e = 0: f = 0: g = 0: ret = -1
          ret = apiEbShowCode(cProj, b)
          s = s & WriteParams("EbShowCode", ret, cProj, b) & vbCrLf
          '
          '      'Clost project without releasing project below
          '      a = 0: b = 0: c = 0: d = 0: e = 0: f = 0: g = 0: ret = -1
          '      ret = apiEbCloseProject(cproj)
          '      s = s & WriteParams("EbCloseProject", ret, cproj) & vbCrLf
          '
          '      'Compile functions
          '      a = 0: b = 0: c = 0: d = 0: e = 0: f = 0: g = 0: ret = -1
          '      ret = apiTipCompileProjectFull(cProj)
          '      s = s & WriteParams("TipCompileProjectFull", ret, cProj) & vbCrLf
          '      '
          '      '
          '      '
          ''Test debug functions
          a = 0: b = 0: c = 0: d = 0: e = 0: f = 0: g = 0: ret = -1
          ret = apiEbGetStepMode()
          s = s & WriteParams("EbGetStepMode", ret) & vbCrLf
          '
          a = 0: b = 0: c = 0: d = 0: e = 0: f = 0: g = 0: ret = -1
          ret = apiEbSetStepMode(0) ' 0 or 1
          s = s & WriteParams("EbSetStepMode", ret, a) & vbCrLf
          '
          a = 0: b = 0: c = 0: d = 0: e = 0: f = 0: g = 0: ret = -1
          ret = apiEbSetStepToCursor(a)
          s = s & WriteParams("EbSetStepToCursor", a) & vbCrLf
          '
          a = 0: b = 0: c = 0: d = 0: e = 0: f = 0: g = 0: ret = -1
          ret = apiEbDoIdle()
          s = s & WriteParams("EbDoIdle", ret) & vbCrLf
          '
          a = 0: b = 0: c = 0: d = 0: e = 0: f = 0: g = 0: ret = -1
          ret = apiEbIsResetting()
          s = s & WriteParams("EbIsResetting", ret) & vbCrLf
          '
          a = 0: b = 0: c = 0: d = 0: e = 0: f = 0: g = 0: ret = -1
          ret = apiEbFExitBreakMode()
          s = s & WriteParams("EbFExitBreakMode", ret) & vbCrLf
          '      '
          '      '
          '      '
          '      'EbNotifyWindow will pause/hault with line highlighted in yellow to show compile error/exception.  Project will not be properly released
          '      a = 0: b = 0: c = 0: d = 0: e = 0: f = 0: g = 0: ret = -1
          '      ret = apiEbNotifyWindow(a, b, c)
          '      s = s & WriteParams("EbNotifyWindow", ret, a, b, c) & vbCrLf
          '      '
          '      'EbProjectreset will bump you out of sub without releasing the project, ie ReleaseProject below.  Project will not be properly released
          '      a = 0: b = 0: c = 0: d = 0: e = 0: f = 0: g = 0: ret = -1
          '      ret = apiEbProjectReset()
          '      s = s & WriteParams("EbProjectReset", ret, a, b, c, d, e, f, g) & vbCrLf
          '      '
          '      '
          '      '
          ''Test IDE commands
          a = 0: b = 0: c = 0: d = 0: e = 0: f = 0: g = 0: ret = -1
          ret = apiEbGetRedoText(a)
          s = s & WriteParams("EbGetRedoText", ret, a) & vbCrLf
          '
          a = 0: b = 0: c = 0: d = 0: e = 0: f = 0: g = 0: ret = -1
          ret = apiEbGetUndoText(a)
          s = s & WriteParams("EbGetUndoText", ret, a) & vbCrLf
          ''Assuming EbStartSearch is called properly the following are its commands. I could not get EbStartSearch to work yet
          a = 0: b = 0: c = 0: d = 0: e = 0: f = 0: g = 0: ret = -1
          ret = apiEbSearchCanReplace()
          s = s & WriteParams("EbSearchCanReplace", ret) & vbCrLf
          '
          a = 0: b = 0: c = 0: d = 0: e = 0: f = 0: g = 0: ret = -1
          ret = apiEbSearchGetCurState()
          s = s & WriteParams("EbSearchGetCurState", ret) & vbCrLf
          '
          a = 0: b = 0: c = 0: d = 0: e = 0: f = 0: g = 0: ret = -1
          ret = apiEbSearchDone()
          s = s & WriteParams("EbSearchDone", ret) & vbCrLf
          '
          a = 0: b = 0: c = 0: d = 0: e = 0: f = 0: g = 0: ret = -1
          ret = apiEbSearchFind()
          s = s & WriteParams("EbSearchFind", ret) & vbCrLf
          '
          a = 0: b = 0: c = 0: d = 0: e = 0: f = 0: g = 0: ret = -1
          ret = apiEbSearchReplace()
          s = s & WriteParams("EbSearchReplace", ret) & vbCrLf
          '
          a = 0: b = 0: c = 0: d = 0: e = 0: f = 0: g = 0: ret = -1
          ret = apiEbSearchReplaceAll()
          s = s & WriteParams("EbSearchReplaceAll", ret) & vbCrLf
          '      '
          '      '
          '      '
          ''Test Error functions
          a = 0: b = 0: c = 0: d = 0: e = 0: f = 0: g = 0: ret = -1
          ret = apiEbGetExceptionInfo(a)
          s = s & WriteParams("EbGetExceptionInfo", ret, a) & vbCrLf
          '
          a = 0: b = 0: c = 0: d = 0: e = 0: f = 0: g = 0: ret = -1
          ret = apiEbShowError(a)
          s = s & WriteParams("EbShowError", ret, a) & vbCrLf
          
          
    releaseproj:
          'Return value appears to be related to (hProj - 1)
          ret = apiTipReleaseProject(cProj)
          ' MsgBox ret & " " & hProj
          '
          Clipboard.SetText (s)
          MsgBox s
          
       Else
          MsgBox "EbGetExecutingProj error: " & ret
       End If
    End Sub
    
    
    'Needs update to get declarations of vba6.dll module
    Public Function GetAPIDeclaration(ByVal funcName As String) As String
       On Error Resume Next
       Dim cProj   As Long
       Dim sFnId   As String
       Dim pFnInfo As Long
       Dim lArgs   As Long
       Dim lIndex  As Long
       Dim lType   As Long
       Dim ret As Long
       Dim hProj As Long
       Dim s As String
       Dim returntype As String
       'Build function declaration from function name, args/types unknown
       s = "Private Declare Function " & funcName & " Lib " & Chr(34) & "vba6.dll" & Chr(34) & " ("
       hProj = apiEbGetExecutingProj(cProj)
       If hProj <> 0 And cProj <> 0 Then
          ret = apiTipGetFunctionId(cProj, StrPtr(funcName), VarPtr(sFnId))
          If ret = ERROR_SUCCESS And StrPtr(sFnId) <> 0 Then
             ret = apiTipGetFuncInfo(cProj, StrPtr(sFnId), pFnInfo)
             If ret = ERROR_SUCCESS And pFnInfo <> 0 Then
                ret = apiTipGetArgCount(pFnInfo, lArgs)
                If ret = ERROR_SUCCESS Then
                   If lArgs = 0 Then
                      s = s & " void"
                   Else
                      For lIndex = 0 To lArgs
                         ret = apiTipGetArgType(pFnInfo, lIndex, lType)
                         If ret = ERROR_SUCCESS Then
                            If lIndex = 0 Then
                               returntype = TypeString(lType, 0)
                            Else
                               s = s & TypeString(lType, lIndex)
                            End If
                         End If
                      Next
                   End If
                Else
                   s = "TipGetArgCount error: " & ret
                End If
                ret = apiTipReleaseFuncInfo(pFnInfo)
             Else
                s = "TipGetFuncInfo error: " & ret
             End If
          Else
             s = "TipGetFunctionId error: " & ret
          End If
          ret = apiTipReleaseProject(cProj)
       Else
          s = "EbGetExecutingProj error: " & ret
       End If
       GetDeclaration = s & returntype
    End Function
    Public Function AddrOf(ByRef sFuncName As String) As Long 'broke? did work
       On Error Resume Next
       Dim cProj    As Long
       Dim hProj As Long
       hProj = apiEbGetExecutingProj(cProj)
       If hProj <> 0 And cProj <> 0 Then
          Dim lResult     As Long
          Dim sID         As String
          Dim pfn         As Long
          Dim sUnicode    As String
          On Error GoTo releaseproj
          sUnicode = StrConv(sFuncName, vbUnicode)
          If apiTipGetFunctionIdAsString(cProj, sUnicode, sID) = ERROR_SUCCESS Then
             If apiTipGetLpfnOfFunctionId(cProj, sID, pfn) = ERROR_SUCCESS Then
                AddrOf = pfn
             End If
          End If
    releaseproj:
          lResult = apiTipReleaseProject(cProj)
       End If
    End Function
    Private Function TypeString(ByVal lType As Long, ByRef index As Long) As String
       Dim ts As String
       Dim ar As String
       If index = 0 Then
          ts = ") As "
       Else
          If IsvbArray(lType) = True Then
             lType = lType - vbArray
             ar = "()"
          End If
          Dim comma As String
          If index > 1 Then comma = ", "
          If IsByRef(lType) = True Then
             lType = lType - DT_BYREF
             ts = comma & "ByRef x" & index & ar & " As "
          Else
             ts = comma & "ByVal x" & index & ar & " As "
          End If
       End If
       Select Case lType
       Case vbInteger:     ts = ts & "Integer"
       Case vbLong:        ts = ts & "Long"
       Case vbSingle:      ts = ts & "Single"
       Case vbDouble:      ts = ts & "Double"
       Case vbCurrency:    ts = ts & "Currency"
       Case vbDate:        ts = ts & "Date"
       Case vbString:      ts = ts & "String"
       Case vbObject:      ts = ts & "Object"
       Case vbBoolean:     ts = ts & "Boolean"
       Case vbVariant:     ts = ts & "Variant"
       Case vbByte:        ts = ts & "Byte"
       Case vbArray:        ts = ts & "Array"
       Case vbDataObject:   ts = ts & "IUnknown" 'IBM
       Case vbDecimal:      ts = ts & "Decimal"
       Case vbEmpty:        ts = ts & "Empty"
       Case vbError:        ts = ts & "Error"
       Case vbNull:         ts = ts & "Null"
       Case vbUserDefinedType:  ts = ts & "User Defined Type"
       Case 24:            ts = ts & "Void"  ' This is the type value for SUB procedure's return value.
       Case Else:          ts = ts & lType
       End Select
       TypeString = ts
    End Function
    Private Function IsByRef(ByVal flags As Long) As Boolean
       IsByRef = flags And DT_BYREF
    End Function
    Private Function IsvbArray(ByVal flags As Long) As Boolean
       IsvbArray = flags And vbArray
    End Function
    Private Function WriteParams(ByVal nam As String, ByVal ret As Long, Optional ByVal a As Long = -1, Optional ByVal b As Long = -1, Optional ByVal c As Long = -1, Optional ByVal d As Long = -1, Optional ByVal e As Long = -1, Optional ByVal f As Long = -1, Optional ByVal g As Long = -1) As String
       WriteParams = nam & " " & CStr(ret)
       If a = -1 Then Exit Function
       WriteParams = WriteParams & "   a: " & CStr(a)
       If b = -1 Then Exit Function
       WriteParams = WriteParams & "   b: " & CStr(b)
       If c = -1 Then Exit Function
       WriteParams = WriteParams & "   c: " & CStr(c)
       If d = -1 Then Exit Function
       WriteParams = WriteParams & "   d: " & CStr(d)
       If e = -1 Then Exit Function
       WriteParams = WriteParams & "   e: " & CStr(e)
       If f = -1 Then Exit Function
       WriteParams = WriteParams & "   f: " & CStr(f)
       If g = -1 Then Exit Function
       WriteParams = WriteParams & "   g: " & CStr(g)
    End Function
    'Output from TestDeclaration
    'TipGetFunctionId 0 a: 9583264 b: 116354540 c: 1702488
    'TipGetFuncInfo 0 a: 9583264 b: 116174468 c: 116360896
    'TipGetArgCount 0 a: 116360896 b: 4
    'TipGetArgType 0 a: 116360896 b: 0 c: 3
    'TipGetArgType 0 a: 116360896 b: 1 c: 16395
    'TipGetArgType 0 a: 116360896 b: 2 c: 16389
    'TipGetArgType 0 a: 116360896 b: 3 c: 8
    'TipGetArgType 0 a: 116360896 b: 4 c: 24584
    'TipReleaseFuncInfo 1 a: 116360896
    'TipGetProjName 0 a: 9583264 b: 153379804
    'TipSetProjName 32813 a: 9583264 b: 0
    'EbHideCode 0 a: 9583264
    'EbShowCode 0 a: 9583264 b: 0
    'EbGetStepMode 0
    'EbSetStepMode 1638400 a: 0
    'EbSetStepToCursor 0
    'EbDoIdle 0
    'EbIsResetting 0
    'EbFExitBreakMode 0
    'EbGetRedoText 40197 a: 0
    'EbGetUndoText 40197 a: 0
    'EbSearchCanReplace 0
    'EbSearchGetCurState 0
    'EbSearchDone 0
    'EbSearchFind 40203
    'EbSearchReplace 40206
    'EbSearchReplaceAll 40203
    'EbGetExceptionInfo 0 a: 264294520
    'EbShowError 0 a: 0

  18. #18
    Frenzied Member
    Join Date
    Feb 2015
    Posts
    1,834

    Re: Need help or documentation on vba6.dll functions, Eb api

    It appears that some of these API declarations only work while being debugged, and do not work in an addin.
    Try to play with EbSetMode function. This is the example how to get callstack (it requires pause execution).
    Code:
    Private Declare Function EbSetMode Lib "vba6" (ByVal Mode As Long) As Long
    Private Declare Function EbGetCallstackCount Lib "vba6" (ByRef Count As Long) As Long
    Private Declare Function EbGetCallstackFunction Lib "vba6" ( _
        ByVal Index As Long, P As Any, M As Any, F As Any, _
        Ret As Long) As Long
        
    Private Sub Command1_Click()
        X 5
    End Sub
     
    Private Sub X(ByVal Z As Long)
        Dim Ct As Long, i As Long, c As Long
        Dim prj As String, mdl As String, func As String
        Dim r As String
        
        If Z Then
            X Z - 1
        Else
            EbSetMode 2
            EbGetCallstackCount Ct
            
            For i = Ct - 1 To 0 Step -1
                EbGetCallstackFunction i, ByVal VarPtr(prj), _
                                          ByVal VarPtr(mdl), _
                                          ByVal VarPtr(func), c
                r = r & prj & "." & mdl & "." & func & vbNewLine
            Next
            
            EbSetMode 1
            
            MsgBox r
        End If
    End Sub

  19. #19

  20. #20

    Thread Starter
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    685

    Re: Need help or documentation on vba6.dll functions, Eb api

    Quote Originally Posted by The trick View Post
    Try to play with EbSetMode function. This is the example how to get callstack (it requires pause execution).
    Code:
    Private Declare Function EbSetMode Lib "vba6" (ByVal Mode As Long) As Long
    Private Declare Function EbGetCallstackCount Lib "vba6" (ByRef Count As Long) As Long
    Private Declare Function EbGetCallstackFunction Lib "vba6" ( _
        ByVal Index As Long, P As Any, M As Any, F As Any, _
        Ret As Long) As Long
        
    Private Sub Command1_Click()
        X 5
    End Sub
     
    Private Sub X(ByVal Z As Long)
        Dim Ct As Long, i As Long, c As Long
        Dim prj As String, mdl As String, func As String
        Dim r As String
        
        If Z Then
            X Z - 1
        Else
            EbSetMode 2
            EbGetCallstackCount Ct
            
            For i = Ct - 1 To 0 Step -1
                EbGetCallstackFunction i, ByVal VarPtr(prj), _
                                          ByVal VarPtr(mdl), _
                                          ByVal VarPtr(func), c
                r = r & prj & "." & mdl & "." & func & vbNewLine
            Next
            
            EbSetMode 1
            
            MsgBox r
        End If
    End Sub
    Thank you for that sample as well. I knew it existed but had not gotten to it yet. I know about IUnknown and the life time use, but the premise was that a Microsoft employee said that the early systems used all integers and were faster than Alan Cooper's string implementation. VB has the Omega engine under the hood with the extra intrinsic functions. VB4 forever apparently.

    I found several more since yesterday. Here is an updated list of the API that are test-worthy. Unless commented out, they all work.
    Code:
    Private Declare Function apiEbGetExecutingInstance Lib "vba6.dll" Alias "EbGetExecutingInstance" (ByRef iProj As Long) As Long
    Private Declare Function apiEbGetExecutingProj Lib "vba6.dll" Alias "EbGetExecutingProj" (ByRef cproj As Long) As Long
    Private Declare Function apiTipGetFunctionId Lib "vba6.dll" Alias "TipGetFunctionId" (ByVal cproj As Long, ByVal bstrName As Long, ByVal bstrId As Long) As Long
    Private Declare Function apiTipGetFuncInfo Lib "vba6.dll" Alias "TipGetFuncInfo" (ByVal cproj As Long, ByVal bstrId As Long, ByRef pFuncInfo As Long) As Long
    Private Declare Function apiTipReleaseProject Lib "vba6.dll" Alias "TipReleaseProject" (ByVal cproj As Long) As Long
    Private Declare Function apiEbCloseProject Lib "vba6.dll" Alias "EbCloseProject" (ByVal cproj As Long) As Long
    Private Declare Function apiTipCompileModule Lib "vba6.dll" Alias "TipCompileModule" (ByVal cproj As Long) As Long
    Private Declare Function apiTipCompileProject Lib "vba6.dll" Alias "TipCompileProject" (ByVal cproj As Long) As Long
    Private Declare Function apiTipCompileProjectFull Lib "vba6.dll" Alias "TipCompileProjectFull" (ByVal cproj As Long) As Long
    Private Declare Function apiTipGetProjName Lib "vba6.dll" Alias "TipGetProjName" (ByVal cproj As Long, ByRef param2 As Long) As Long
    Private Declare Function apiTipGetFunctionIdAsString Lib "vba6.dll" Alias "TipGetFunctionId" (ByVal cproj As Long, ByVal strFunctionName As String, ByRef strFunctionId As String) As Long
    Private Declare Function apiTipGetLpfnOfFunctionId Lib "vba6.dll" Alias "TipGetLpfnOfFunctionId" (ByVal cproj As Long, ByVal strFunctionId As String, ByRef lpfn As Long) As Long  'app defined call when event occurs
    Private Declare Function apiTipSetProjName Lib "vba6.dll" Alias "TipSetProjName" (ByVal cproj As Long, ByRef param2 As Long) As Long 'non zero
    Private Declare Function apiTipSetProjModified Lib "vba6.dll" Alias "TipSetProjModified" (ByVal cproj As Long, ByRef param2 As Long) As Long 'debug reset
    Private Declare Function apiTipIsProjModified Lib "vba6.dll" Alias "TipIsProjModified" (ByVal cproj As Long, ByRef param2 As Long) As Long 'debug reset
    Private Declare Function apiTipIsProjCompiled Lib "vba6.dll" Alias "TipIsProjCompiled" (ByVal cproj As Long, ByRef param2 As Long) As Long
    Private Declare Function apiTipGetProjOfMod Lib "vba6.dll" Alias "TipGetProjOfMod" (ByVal cmod As Long, ByRef param2 As Long, ByRef param3 As Long) As Long
    'Private Declare Function apiTipGetModule Lib "vba6.dll" Alias "TipGetModule" (ByVal parma1 As Long, ByRef param2 As Long, ByRef param3 As Long) As Long' ?
    'Private Declare Function apiTipGetModuleOfName Lib "vba6.dll" Alias "TipGetModuleOfName" (byval cmod As Long, ByVal param1 As Long) As Long
    'Private Declare Function apiTipGetFunctionName Lib "vba6.dll" Alias "TipGetFunctionName" (ByVal cproj As Long, ByVal param2 As Long) As Long
    Private Declare Function apiTipGetFunctionIdOfMod Lib "vba6.dll" Alias "TipGetFunctionIdOfMod" (ByVal cmod As Long, ByVal funcname As Long, ByVal fnid As Long) As Long
    Private Declare Function apiTipGetFunctionCount Lib "vba6.dll" Alias "TipGetFunctionCount" (ByVal cmod As Long, ByRef param2 As Long, ByRef param3 As Long) As Long
    Private Declare Function apiTipGetModuleCount Lib "vba6.dll" Alias "TipGetModuleCount" (ByVal cproj As Long, ByRef param2 As Long, ByRef param3 As Long) As Long
    Private Declare Function apiTipGetModOfFunctionId Lib "vba6.dll" Alias "TipGetModOfFunctionId" (ByVal cproj As Long, ByVal param2 As Long, ByRef param2 As Long) As Long
    Private Declare Function apiTipIsModuleModified Lib "vba6.dll" Alias "TipIsModuleModified" (ByVal cmod As Long, ByRef param2 As Long) As Long
    Private Declare Function apiTipGetModuleName Lib "vba6.dll" Alias "TipGetModuleName" (ByVal cmod As Long, ByRef param2 As Long) As Long
    Private Declare Function apiTipSetModuleName Lib "vba6.dll" Alias "TipSetModuleName" (ByRef cmod As Long, ByRef param2 As Long) As Long
    Private Declare Function apiTipIsValidModuleName Lib "vba6.dll" Alias "TipIsValidModuleName" (ByRef cmod As Long, ByRef param2 As Long) As Long
    Private Declare Function apiTipReleaseModule Lib "vba6.dll" Alias "TipReleaseModule" (ByRef cmod As Long, ByRef param2 As Long) As Long
    Private Declare Function apiTipRevertModule Lib "vba6.dll" Alias "TipRevertModule" (ByRef cmod As Long, ByRef param2 As Long) As Long
    Private Declare Function apiEbShowCode Lib "vba6.dll" Alias "EbShowCode" (ByVal cproj As Long, ByVal param2 As Long) As Long
    Private Declare Function apiEbHideCode Lib "vba6.dll" Alias "EbHideCode" (ByVal cproj As Long) As Long
    
    'debug
    Private Declare Function apiEbMode Lib "vba6.dll" Alias "EbMode" () As Long
    Private Declare Function apiEbGetStepMode Lib "vba6.dll" Alias "EbGetStepMode" () As Long
    Private Declare Function apiEbDoIdle Lib "vba6.dll" Alias "EbDoIdle" () As Long
    Private Declare Function apiEbIsResetting Lib "vba6.dll" Alias "EbIsResetting" () As Long
    Private Declare Function apiEbSetStepToCursor Lib "vba6.dll" Alias "EbSetStepToCursor" (ByRef param1 As Long) As Long
    Private Declare Function apiEbSetStepMode Lib "vba6.dll" Alias "EbSetStepMode" (ByVal param1 As Long) As Long 'non zero - byref multiple?
    Private Declare Function apiEbFExitBreakMode Lib "vba6.dll" Alias "EbFExitBreakMode" () As Long
    Private Declare Function apiEbProjectReset Lib "vba6.dll" Alias "EbProjectReset" () As Long 'bump out of debug, ie stop
    Private Declare Function apiEbNotifyWindow Lib "vba6.dll" Alias "EbNotifyWindow" (ByRef param1 As Long, ByRef param2 As Long, ByRef param3 As Long) As Long 'highlights line for compile error/exception
    Private Declare Function apiEbTerm Lib "vba6.dll" Alias "EbTerm" (ByRef param1 As Long, ByRef param2 As Long) As Long 'pauses the debugger on the selected line, highlighted in yellow
    Private Declare Function apiEbReset Lib "vba6.dll" Alias "EbReset" () As Long 'step into/over
    
    'Project analysis
    Private Declare Function apiTipGetArgCount Lib "vba6.dll" Alias "TipGetArgCount" (ByVal pFuncInfo As Long, ByRef lCount As Long) As Long
    Private Declare Function apiTipGetArgType Lib "vba6.dll" Alias "TipGetArgType" (ByVal pFuncInfo As Long, ByVal lIndex As Long, ByRef lType As Long) As Long
    Private Declare Function apiTipReleaseFuncInfo Lib "vba6.dll" Alias "TipReleaseFuncInfo" (ByVal pFuncInfo As Long) As Long
    
    'IDE commands
    Private Declare Function apiEbGetRedoText Lib "vba6.dll" Alias "EbGetRedoText" (ByRef param1 As Long) As Long 'non zero
    Private Declare Function apiEbGetUndoText Lib "vba6.dll" Alias "EbGetUndoText" (ByRef param1 As Long) As Long 'non zero
    'find/replace
    Private Declare Function apiEbStartSearch Lib "vba6.dll" Alias "EbStartSearch" (ByRef param1 As Long) As Long
    Private Declare Function apiEbSearchFind Lib "vba6.dll" Alias "EbSearchFind" () As Long 'non zero
    Private Declare Function apiEbSearchDone Lib "vba6.dll" Alias "EbSearchDone" () As Long
    Private Declare Function apiEbSearchCanReplace Lib "vba6.dll" Alias "EbSearchCanReplace" () As Long
    Private Declare Function apiEbSearchReplace Lib "vba6.dll" Alias "EbSearchReplace" () As Long 'non zero
    Private Declare Function apiEbSearchReplaceAll Lib "vba6.dll" Alias "EbSearchReplaceAll" () As Long
    Private Declare Function apiEbSearchGetCurState Lib "vba6.dll" Alias "EbSearchGetCurState" () As Long
    
    'error
    Private Declare Function apiEbGetExceptionInfo Lib "vba6.dll" Alias "EbGetExceptionInfo" (ByRef param1 As Long) As Long
    Private Declare Function apiEbShowError Lib "vba6.dll" Alias "EbShowError" (ByVal param1 As Long) As Long
    Private Declare Function apiEbExceptionHandled Lib "vba6.dll" Alias "EbExceptionHandled" () As Long
    Private Declare Function apiEbAskUserForStateLoss Lib "vba6.dll" Alias "EbAskUserForStateLoss" (ByRef param1 As Long) As Long
    Private Declare Function apiEbContextHelpMode Lib "vba6.dll" Alias "EbContextHelpMode" (ByRef param1 As Long) As Long
    'misc/unknown
    Private Declare Function apiEbCheckOptions Lib "vba6.dll" Alias "EbCheckOptions" (ByRef param1 As Long, ByRef param2 As Long) As Long
    Private Declare Function apiEbAddAvailEbref Lib "vba6.dll" Alias "EbAddAvailEbref" (ByRef param1 As Long, ByRef param2 As Long) As Long
    Private Declare Function apiEbConfigureUi Lib "vba6.dll" Alias "EbConfigureUi" (ByRef param1 As Long) As Long
    'compile/make
    'Private Declare Function apiTipMakeExe2 Lib "vba6.dll" Alias "TipMakeExe2" () As Long
    'Private Declare Function apiTipFinishExe2 Lib "vba6.dll" Alias "TipFinishExe2" () As Long
    Private Declare Function apiTipStartMakeExe Lib "vba6.dll" Alias "TipStartMakeExe" (ByVal cproj As Long) As Long

  21. #21

    Thread Starter
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    685

    Re: Need help or documentation on vba6.dll functions, Eb api

    Trick, do you know how to declare and use EbRecordSet? I think this is an very old version of OpenRecordSet applied to Visual Basic internally.
    It seems to need an object, or perhaps more than 5 parameters.

    I also could not get EbJournalCancel to work in a way that the hook did not crash the caller.
    EbJournalCancel seems to have a conflicting number of parameters, either 0 or 1.
    It should have one parameter, but it crashes. With no parameter declared it works, but the hook crashes the caller, indicating something wrong with parameters.

  22. #22

    Thread Starter
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    685

    Re: Need help or documentation on vba6.dll functions, Eb api



    Some of the partners and subsidiaries of Microsoft may of had the knowledge and access to these functions without rights to distribute. There is some older code mixed with newer layers as the product changed faces during the early years. Evidently, the embedded nature has been there since the beginning.

    VBA developers (office, Autodesk etc.) are the most likely to have used some of these API in production for debugging a host application with the host's specific VBA recipe and purpose. The SDK offer in 2003-2004 mentioned that you can emmit binaries needed for your application to run, just like VB6.exe. It was unclear if you were restricted to use a vb6 exe as the host.

    The original vision of Alan Cooper was to have dynamic dll communication at runtime. Many of these functions appear to have a similar purpose, but the code definitely looks re-tooled at least twice by different authors.

    Most functions have a successful return value of 0, "The operation completed successfully."

    Some functions return error 5 "Invalid procedure call", if the parameters are null (not-specified) or incorrect.
    Perhaps it means there is nothing for the function to process. The number of arguments is correct however.

    40036 is an error returned by a function defined by the appliation.
    The number of arguments is probably correct if you get this.
    For example, if EbExecuteLine has a flag set to test in the last arg, then
    a successful test will appear as 40036 if the test failed to execute. The test succeded to find a failure.
    Another example, if TipCompileProjectFull fails to fully compile, an error 40036 will appear.
    Constants could have alias names to indicate the functionality more clearly, ie
    Const ERROR_COMPILE_FULL_FAILED As Lone = 40036.
    Const ERROR_EXECUTE_TEST_FAILED As Lone = 40036.

    Functions related to EbRecord appear to return 17, "Can't perform requested operation".
    It may mean that the item is being used, ie "access denied" or "does not exist".
    DeleteModule and TipSetCompatibleExe also return 17.

    TipRevertModule and TipCreateOldAccessProject returns 440, "Automation Error".

    A return value of 53 - "File Not found" is seen by these functions:
    TipAddRefLib, TipSaveAsOldFormat, and TipGetProjectOfLibId

    Functions for creation, releasing, and deleting often return a low numeric index as the return that increments each time:
    EbGetExecutingProj 40 a: 8702096
    TipReleaseProject 42 a: 8702096

    TipSetOption 4 0|1 addin dialog checkboxes.
    Option 5 appears to be setting the dialog box, but not always seen.

    Some of these functions do not show inside the hook when called from a project being debugged.
    Some may call other functions that can be seen in the hook instead.
    These functions are probably at a higher level, calling one or more low-level public/private functions.
    These functions fire off several other functions sequentially, the function is composite, built of sub procecure blocks. This makes it easy to understand of what is going on behind the scenes. It allows a developer to access and augment functionality by intercepting low-level events and executing new code layers of extensibility.


    Function Return parameters (from caller)

    '''''''''''BEGIN - 9/30/2021 11:19:52 AM____________________________________________

    EbGetVersion 1702336 a: 6 b: 0 c: 9782 d: 16
    TipIsCurrentVersion 449 a: 0 b: 0
    TipVBATestCommands 0 a: 0 b: 0
    EbAskUserForStateLoss 0 a: 0

    '''''''''''FREQUENTLY CALLED
    EbDoIdle 0
    EbMode 1
    EbNotifyWindow 0 a: 0 b: 0 c: 0
    VbaTest 263194030 a: 0 b: 0
    EbIsResetting 0

    '''''''''''DEBUG
    EbFExitBreakMode 0
    EbGetStepMode 0
    EbSetStepToCursor -2146787939 a: 0
    EbExecuteLine 40036 a: 114183200 b: 0 c: 0 d: 1
    EbIsCodeOnStack 1
    EbGetCallstackCount 1702364 a: 1
    EbGetCallstackFunction 0 a: 0 b: 1702288 c: 1702284 d: 1702280 e: 0
    EbGetDebWndCallstackIndex 1702364 a: 0
    EbOutputDebugString 3 a: 0

    '''''''''''IDE
    EbGetRedoText 40197 a: 0
    EbGetUndoText 40197 a: 0
    EbGetKeyword 5 a: 0 b: 0 c: 0
    EbGetSelection 0 a: 0
    EbGetInsertionPoint 10 a: 22 b: 10
    EbExtGetSelection 0 a: 0 b: 0 c: 0
    EbExtReplaceSelection 0 a: 0 b: 0
    EbStartSearch 0 a: 6605988
    EbSearchCanReplace 0
    EbSearchGetCurState 0
    EbSearchFind 40203
    EbSearchReplace 40206
    EbSearchReplaceAll 40203
    EbSearchDone 0
    EbHideCode 0 a: 0
    EbShowCode 0 a: 0 b: 0
    EbIsWindowSplit 0 a: 0
    EbWinIniChange 50 a: 0
    TipCreateExtension 5 a: 0 b: 0 c: 0 d: 0
    TipGetOption 0 a: 0 b: -1
    TipSetOption 0 a: 0 b: -1
    TipGetOption 0 a: 1 b: 1
    TipSetOption 0 a: 1 b: 1
    TipGetOption 0 a: 2 b: 0
    TipSetOption 0 a: 2 b: 0
    TipGetOption 0 a: 3 b: -1
    TipSetOption 0 a: 3 b: -1
    TipGetOption 0 a: 4 b: 0
    TipSetOption 0 a: 4 b: 0
    TipGetOption 0 a: 5 b: 0
    TipSetOption 0 a: 5 b: 0
    TipGetFilenameOfProjectLibid 0 a: 0 b: 0
    EbGetNumPages 0 a: 0
    EbGetCurrentFunction 0 a: 0 b: 0
    EbIsInEvalWatch 0
    EbGetObjConnectionCounts 0 a: 0 b: 0

    '''''''''''ERROR
    EbGetExceptionInfo 0 a: 264294520
    EbCopyExceptionInfo 0 a: 264294520 b: 0
    TipEberrOfHresult 0 a: 0
    EbShowError 0 a: 0
    EbExceptionHandled 3

    '''''''''''PROJECT
    TipCreateProject 0 a: 114869184
    EbGetExecutingProj 13 a: 6872976
    TipProjAddRef 14 a: 6872976
    EbGetIntlDllFileName 48 a: 6872976 b: 0 c: 0
    TipSetLicenseInfo 0 a: 6872976 b: 0
    TipRemoveRefLib 35011 a: 6872976 b: 0
    TipReplaceRefLib 35011 a: 6872976 b: 0 c: 0 d: 0
    TipGetRefLib 0 a: 6872976 b: 0 c: 114893260 d: 1
    TipGetProjRefLib 0 a: 6872976 b: 0 c: 0 d: 6798216
    TipGetProjRefLibCount 0 a: 6872976 b: 0 c: 5
    TipGetProjRefLibFileName 0 a: 6872976 b: 0 c: 0 d: 0
    TipAddRefLib 53 a: 6872976 b: 0 c: 0 d: 0
    TipAddRefModule 15 a: 6872976
    TipCanRefLibChange 35011 a: 6872976
    TipGetTypeLibOfHProject 0 a: 6872976 b: 124522952
    TipCreateStdModule 32813 a: 6872976 b: 0 c: 0 d: 0
    TipCreateClass 32813 a: 6872976 b: 0 c: 0 d: 0
    TipProjOfHproj 0 a: 6872976 b: 6872984
    TipIsProjRefLibLoaded 0 a: 6872976 b: 0 c: 0 d: 1
    TipHprojOfProj 0 a: 6872976 b: 6872976
    EbGetBstrOfLcid 0 a: 1033 b: 0 c: 6863276
    EbObjectBrowserSelChg 0 a: 6872976 b: 0
    EbGotoProcedure 0 a: 0 b: 0
    EbGetStatusOfItems 0 a: 6872976 b: 0
    EbGetFlagsOfEbitem 0 a: 6872976
    EbIsValidIdentOfProj 0 a: 6872976 b: 0 c: 0
    TipValidateReferences 0 a: 6872976
    EbGetNameOfEbitem 0 a: 6872976 b: 0 c: 0
    TipSetProjectDestForReferences 0 a: 6872976 b: 0 c: 0
    TipGetReferencingProjCount 0 a: 6872976 b: 0
    TipGetProjName (EbLibrary) 124523516 0 a: 6872976 b: 1702252
    TipSetProjName 0 a: 6872976 b: 114197580
    TipIsProjModified 0 a: 6872976 b: -1
    TipGetCompatibleExe 0 a: 6872976 b: 0 c: 0 d: 0
    TipSetCompatibleExe 17 a: 6872976 b: 0 c: 0 d: 0
    TipCompileProjectFull 0 a: 6872976
    EberrOfScode 0 a: 0
    TipIsProjCompiled 1 a: 6872976
    TipGetCompiledOfProject 5 a: 6872976 b: 0 c: 0
    TipGetTextOfProject 5 a: 6872976 b: 0 c: 0
    TipIsEventProcEmpty 1 a: 0
    TipGetProjectDest 0 a: 6872976 b: 1 c: 6267868
    TipSetProjectDest 0 a: 6872976 b: 0 c: 0
    TipGetDocOfProject 0 a: 6872976 b: 0
    TipSetDocOfProject 0 a: 6872976 b: 0
    TipSetCalendar 0 a: 6872976 b: 0
    TipGetLcid 0 a: 6872976 b: 1033
    TipSetLcid 0 a: 6872976 b: 1033
    EbSetDatabaseLcid 0 a: 6872976 b: 1033

    '''''''''''MODULE
    TipGetModuleCount 0 a: 6872976 b: 0 c: 0
    EbGetModule 40177 a: 6872976 b: 0 c: 0 d: 0

    '''''''''''RECORD
    TipCreateOldAccessProject 440 a: 0 b: 0 c: 114921800
    TipSaveAsOldFormat 53 a: 6872976 b: 0 c: 0
    EbRecordBeginAction 17 a: 0
    EbRecordEraseAction 17 a: 0
    EbRecordUserAction 17
    EbRecordEraseUserAction 17
    EbRecordLine 17 a: 0
    CopyRecord 0 a: 0 b: 0 c: 0
    EbRecordEnd 6606252
    EbFColumnSelectionMode 0
    EbOpenNewLine 0
    EbYankCurrentLine 40244
    EbCommitAll 0 a: 0

    '''''''''''FUNCTION
    TipGetFunctionId 0 a: 6872976 b: 114206036 c: 1702256
    EbIsValidIdent 0 a: 6472356 b: 0
    TipGetExepartOffsetOfFunctionId 0 a: 6872976 b: 6472356 c: 0 d: 2644
    TipGetModOfFunctionId 0 a: 6872976 b: 6472356 c: 6754808
    TipSetModuleFlags 0 a: 6754808 b: 0
    TipIsModuleModified 0 a: 6754808 b: 0
    TestIsModLoaded 0 a: 6754808
    TestGetModCompState 0 a: 6754808 b: 0 c: 0
    TipGetModuleName 0 a: 6754808 b: 124524316
    TipIsValidModuleName 0 a: 6754808 b: 0
    TipRevertModule 440 a: 6872976
    TipGetDocOfModule 0 a: 6754808 b: 0
    TipSetDocOfModule 0 a: 6754808 b: 0
    TipGetProjOfMod 0 a: 6754808 b: 6872976 c: 0
    TipGetFunctionCount 0 a: 6754808 b: 0 c: 0
    TipGetFunctionIdOfMod 0 a: 6754808 b: 0 c: 1702228
    TipReleaseModule 19 a: 6754808
    TipDeleteModule 17 a: 6754808
    TipGetFuncInfo 0 a: 6872976 b: 6472356 c: 114164992
    TipGetArgCount 0 a: 114164992 b: 4
    ---TipGetArgType ) As Long 0 a: 114164992 b: 0 c: 3
    ---TipGetArgType ByRef x1 As Boolean 0 a: 114164992 b: 1 c: 16395
    ---TipGetArgType , ByRef x2 As Double 0 a: 114164992 b: 2 c: 16389
    ---TipGetArgType , ByVal x3 As String 0 a: 114164992 b: 3 c: 8
    ---TipGetArgType , ByRef x4() As String 0 a: 114164992 b: 4 c: 24584
    TipReleaseFuncInfo 1 a: 114164992

    '''''''''''MISC/UNKNOWN
    CreateIExprSrvObj 0 a: 0 b: 0 c: 0
    CheckExprSrvVersion 0 a: 0 b: 0
    EbGetExecutingInstance 0 a: 0
    EbObjbrwIsMemberSelected 0
    EbMemberGetCount 0
    TipMakeUniqueStreamName 0 a: 114349724
    EbInitThread 0 a: 0
    EbGetBstrOfLstClr 0 a: 0 b: 124524036
    EbFTranslateScp 0 a: 0 b: 0 c: 0 d: 0
    EbGetCurrentAllocInfo 0 a: 0 b: 0
    EbCreateCVbaExtEditors 0 a: 0 b: 0 c: 0 d: 123585808
    __vbaRecAssign 0 a: 0 b: 0 c: 0
    __vbaRecDestruct 1702360 a: 0 b: 0
    EbGetCommandLine 6868028
    EbSetCommandLine 1 a: 0
    DllUnregisterServer 0
    EbShowToolTips 6605784 a: 0
    TestGetUiPoint 0 a: 0 b: 0
    EbConfigureUi 60 a: 0
    TipGetProjectOfLibId 53 a: 0 b: 0
    TipGuidOfLibId 32797 a: 0 b: 0
    EbRegisterFunctions 35022 a: 0 b: 0 c: 0
    EbGetVBAObject -2147467262 a: 0 b: 0 c: 0 d: 0
    CreateHostedExprSrv 1 a: 114925112 b: 0
    TestGetFuncomp 40070 a: 0 b: 0 c: 0
    EbSetMsoHinst 1702364 a: 0
    EbMoveEbref 40177 a: 0 b: 0 c: 0
    EbCheckOptions 1 a: 0 b: 0
    StdcbufLink 1702364 a: 0
    EbSetMemProfLevel 1 a: 0

    TipReleaseProject 18 a: 6872976
    TipReleaseProject 0 a: 114869184
    '''''''''''TEST ENDED


    ''''''''''''''HOOK log of the call above
    Function name | parameter
    EbGetVersion 1702364 1702360 1702356 1702336
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    TipVBATestCommands 0 1702364
    TipSetOption 4 1
    TipGetProjOfMod 6754808 1695348 0
    TipReleaseModule 6872976
    TipGetModuleName 6754808 1695336
    TipGetModuleName 6754808 1695540
    TipSetOption 4 0
    TipGetProjOfMod 6754808 1699676 0
    TipReleaseModule 6872976
    TipGetModuleName 6754808 1699664
    TipGetModuleName 6754808 1699868
    EbMode
    EbMode
    EbIsResetting
    EbFExitBreakMode
    EbGetStepMode
    EbSetStepToCursor 1702364
    EbExecuteLine 114183200 0 0 1
    EbMode
    EbMode
    EbMode
    EbMode
    EbIsCodeOnStack
    EbGetCallstackCount 1702364
    EbMode
    EbGetCallstackFunction 0 1702288 1702284 1702280 1702292
    EbMode
    EbGetDebWndCallstackIndex 1702364
    EbMode
    EbOutputDebugString 0
    EbGetRedoText 1702364
    TipGetProjName 6872976 1701500
    TipGetModuleName 6754808 1701500
    TipGetProjOfMod 6754808 1701196 0
    TipReleaseModule 6872976
    TipGetModuleName 6754808 1701184
    EbMode
    EbGetUndoText 1702364
    EbMode
    EbGetKeyword 0 0 0
    EbGetSelection 1702364
    EbGetInsertionPoint 1702364 1702360
    EbExtGetSelection 1702364 1702360 1702356
    EbExtReplaceSelection 1702364 1702360
    EbStartSearch 1702364
    EbSearchCanReplace
    EbSearchGetCurState
    EbSearchFind
    EbSearchReplace
    EbSearchReplaceAll
    EbSearchDone
    EbHideCode 0
    EbShowCode 0 0
    EbHideCode 0
    EbIsWindowSplit 0
    EbWinIniChange 0
    EbMode
    TipCreateExtension 0 0 0 0
    EbMode
    TipGetOption 0 1702364
    TipSetOption 0 -1
    TipGetOption 1 1702364
    TipSetOption 1 1
    TipGetOption 2 1702364
    TipSetOption 2 0
    EbMode
    EbMode
    EbMode
    TipGetOption 3 1702364
    TipSetOption 3 -1
    TipGetOption 4 1702364
    TipSetOption 4 0
    TipGetOption 5 1702364
    TipSetOption 5 0
    TipGetOption 6 1702364
    TipGetFilenameOfProjectLibid 1702364 1702360
    EbGetNumPages 1702364
    EbGetCurrentFunction 1702364 1702360
    EbIsInEvalWatch
    EbGetObjConnectionCounts 1702364 1702360
    EbGetExceptionInfo 1702364
    EbCopyExceptionInfo 264294520 1702364
    TipEberrOfHresult 1702364
    EbShowError 0
    EbExceptionHandled
    TipCreateProject 1702480
    EbGetExecutingProj 1702496
    TipProjAddRef 6872976
    TipAddRefModule 6872976
    EbGetIntlDllFileName 6872976 1702364 1702360
    TipSetLicenseInfo 6872976 1702364
    TipRemoveRefLib 6872976 1702364
    TipReplaceRefLib 6872976 1702364 0 1702360
    TipGetRefLib 6872976 0 1702364 1702360
    TipGetProjRefLib 6872976 0 1702364 1702360
    TipGetProjRefLibCount 6872976 1702364 1701566
    TipGetProjRefLibCount 6872976 1702364 1702360
    TipGetProjRefLibFileName 6872976 0 1702364 1702360
    TipGetProjRefLibCount 6872976 1702364 1701590
    TipAddRefLib 6872976 1702364 1702360 1702356
    TipAddRefModule 6872976
    TipCanRefLibChange 6872976
    TipGetTypeLibOfHProject 6872976 1702364
    EbMode
    TipCreateStdModule 6872976 1702364 1702360 1702356
    TipCreateClass 6872976 1702364 1702360 1702356 114192836
    TipProjOfHproj 6872976 1701528
    TipProjOfHproj 6872976 1702364
    TipGetProjRefLibCount 6872976 1702364 1702198
    TipHprojOfProj 6872976 1702364
    EbGetBstrOfLcid 1033 1702364 1702360
    TipSetLcid 6872976 1702364
    EbGotoProcedure 1702364 1702360
    EbGetStatusOfItems 6872976 0
    EbMode
    EbGetFlagsOfEbitem 6872976
    EbIsValidIdentOfProj 6872976 1702364 1702360
    TipValidateReferences 6872976
    EbGetNameOfEbitem 6872976 1702364 1702360
    TipSetProjectDestForReferences 6872976 1702364 1702360
    TipGetReferencingProjCount 6872976 1702364
    TipGetProjName 6872976 1702252
    TipSetProjName 6872976 114197580
    EbMode
    EbMode
    EbMode
    TipIsProjModified 6872976 1702364
    TipGetCompatibleExe 6872976 1702364 1702360 1702356
    TipSetCompatibleExe 6872976 1702364 1702360 0
    EbMode
    TipCompileProjectFull 6872976
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    EberrOfScode 0
    EberrOfScode 0
    EberrOfScode 0
    EberrOfScode 0
    EberrOfScode 0
    EberrOfScode 0
    EberrOfScode 0
    EberrOfScode 0
    EberrOfScode 0
    EberrOfScode 0
    EberrOfScode 0
    EberrOfScode 0
    EberrOfScode 0
    EberrOfScode 0
    EberrOfScode 0
    EberrOfScode 0
    EberrOfScode 0
    EberrOfScode 0
    EberrOfScode 0
    EberrOfScode 0
    EberrOfScode 0
    EberrOfScode 0
    EberrOfScode 0
    EbMode
    EberrOfScode 1702364
    TipIsProjCompiled 6872976
    TipGetTextOfProject 6872976 0 1702364
    TipGetCompiledOfProject 6872976 0 0
    TipIsEventProcEmpty 0
    TipGetProjectDest 6872976 1702364 1702360
    TipSetProjectDest 6872976 1702364 0
    TipGetDocOfProject 6872976 1702364
    TipSetDocOfProject 6872976 1702364
    TipSetCalendar 6872976 0
    TipGetLcid 6872976 1702364
    EbGotoProcedure 1702496 1033
    EbSetDatabaseLcid 6872976 1033
    TipGetModuleCount 6872976 1702364 1702360
    EbMode
    TipCreateOldAccessProject 0 0 0 1702364
    TipSaveAsOldFormat 6872976 0 0
    EbRecordBeginAction 1702364
    EbRecordEraseAction 1702364
    EbRecordUserAction
    EbRecordBeginAction 0
    EbRecordEraseUserAction
    EbRecordEraseAction 0
    EbRecordLine 1702364
    CopyRecord 0 0 1702364
    EbRecordEnd
    EbFColumnSelectionMode
    EbOpenNewLine
    EbMode
    EbShowError 40244
    EbYankCurrentLine
    EbMode
    EbCommitAll 0
    TipGetFunctionId 6872976 114206036 1702256
    EbMode
    EbMode
    EbMode
    EbIsValidIdent 6472356 1702364
    TipGetExepartOffsetOfFunctionId 6872976 6472356 1702364 1702360
    TipGetModOfFunctionId 6872976 6472356 1702484
    TipIsModuleModified 6754808 1702364
    EbMode
    EbMode
    EbMode
    EbMode
    EbMode
    TestGetModCompState 6754808 0 0
    TipGetProjName 114869184 1701560
    TipGetProjName 114921792 1701560
    TipGetProjName 6872976 1701560
    TipGetModuleName 6754808 1702364
    TipIsValidModuleName 1702484 1702364
    TipRevertModule 6872976
    TipGetDocOfModule 6754808 0
    TipSetDocOfModule 6754808 0
    TipGetProjOfMod 6754808 1702364 0
    TipGetFunctionCount 6754808 1702364 1702360
    EbMode
    TipGetFunctionIdOfMod 6754808 114206036 1702364
    EbMode
    EbMode
    EbMode
    TipReleaseModule 6754808
    TipDeleteModule 6754808
    EbMode
    EbMode
    EbMode
    TipGetFuncInfo 6872976 6472356 1702232
    TipGetArgCount 114164992 1702220
    TipReleaseFuncInfo 114164992
    CreateIExprSrvObj 1702364 1702360 1702356
    CheckExprSrvVersion 1702364 1702360
    EbGetExecutingInstance 1702364
    EbObjbrwIsMemberSelected
    EbMemberGetCount
    TipMakeUniqueStreamName 1702364
    EbInitThread 0
    EbGetBstrOfLstClr 1702364 1702360
    EbGetCurrentAllocInfo 1702364 1702360
    EbCreateCVbaExtEditors 1702364 1702360 0 1702356
    EbGetCommandLine
    EbSetCommandLine 0
    DllUnregisterServer
    EbShowToolTips 0
    TestGetUiPoint 1702364 1702360
    EbConfigureUi 1702364
    TipGetProjectOfLibId 1702364 0
    TipGuidOfLibId 1702364 0
    EbRegisterFunctions 1702364 1702360 1702356
    EbGetVBAObject 1702364 1702360 1702356 1702336
    CreateHostedExprSrv 1702364 1702360
    TestGetFuncomp 1702364 1702360 1702356
    EbSetMsoHinst 1702364
    EbMoveEbref 1702364 1702360 1702356
    EbCheckOptions 1702364 1702360
    StdcbufLink 1702364
    EbSetMemProfLevel 1702364
    TipReleaseModule 6872976
    TipReleaseModule 114869184
    StdcbufLink 1702084

    EbMode

  23. #23

    Thread Starter
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    685

    Re: Need help or documentation on vba6.dll functions, Eb api

    I learned quite a bit more from the EbGetErrorInfo and EbShowError functions. I was able to solve a few more of the functions with the app defined error info:
    Since 40196 is "Insufficient memory to save Undo information", I created one for this return:
    EbGetRedoText 40197 a: 0
    EbGetUndoText 40197 a: 0
    "Can't save Undo/Redo information"

    Made one up for this return:
    EbSearchReplace 40244
    EbSearchReplaceAll 40244
    "Can't search or replace now."

    This one was an easy fix:
    TipIsCurrentVersion 449 a: 0 b: 0
    "Argument not optional":

    Must need a dll file path name:
    EbGetIntlDllFileName 48 a: 8741224 b: 0 c: 0
    "Error in loading DLL":

    Needs a valid library reference id:
    TipRemoveRefLib 35011 a: 9721056 b: 0
    TipReplaceRefLib 35011 a: 9721056 b: 0 c: 0 d: 0
    TipCanRefLibChange 35011 a: 9721056
    "The .VBP file for this project contains an invalid or corrupt library references ID"

    These were missing their names:
    TipCreateStdModule 32813 a: 8741224 b: 0 c: 0 d: 0
    TipCreateClass 32813 a: 8741224 b: 0 c: 0 d: 0
    "Name conflicts with existing module, project, or object library"

    These need an existing file:
    TipGetProjectOfLibId 53
    TipSaveAsOldFormat 53
    TipAddRefLib 53 a: 8741224 b: 0 c: 0 d: 0
    "File not found."

    Must have to input a registered object library:
    TipGuidOfLibId 32797 a: 0 b: 0
    "Object library not registered"

    I can't figure this one out:
    EbRegisterFunctions 35022 a: 0 b: 0 c: 0
    "Object library feature not supported"

    Ah-ha, parameter needs a module argument.
    TestGetFuncomp 40070 a: 0 b: 0 c: 0
    "Module not found":

    'Makes beep sound, search complete or can't search:
    EbYankCurrentLine 40244
    "Search end Beep":

    'Similar to return of EbGetModule failure.
    EbMoveEbref 40177 a: 0 b: 0 c: 0
    "unknown":
    Current snapshot of caller output
    Code:
    '''''''''''BEGIN - 10/10/2021 12:07:08 AM____________________________________________
    
    EbGetVersion 1702332   a: 6   b: 0   c: 9782   d: 16
    TipVBATestCommands 0   a: 0   b: 0
    EbAskUserForStateLoss 0   a: 0
    
    '''''''''''FREQUENTLY CALLED
    EbDoIdle 0
    EbMode 1
    EbNotifyWindow 0   a: 0   b: 0   c: 0
    VbaTest 263194030   a: 0   b: 0
    EbIsResetting 0
    
    '''''''''''DEBUG
    EbFExitBreakMode 0
    EbGetStepMode 0
    EbSetStepToCursor -2146787939   a: 0
    EbExecuteLine 40036   a: 219578332   b: 0   c: 0   d: 1
    EbIsCodeOnStack 1
    EbGetCallstackCount 1702360   a: 1
    EbGetCallstackFunction 0   a: 0   b: 1702284   c: 1702280   d: 1702276   e: 0
    EbGetDebWndCallstackIndex 1702360   a: 0
    EbOutputDebugString 263856098   a: 0
    
    '''''''''''IDE
    EbGetRedoText 40197   a: 0
    EbGetUndoText 40197   a: 0
    EbGetSelection 0   a: 0
    EbGetInsertionPoint 27   a: 20   b: 27
    EbExtGetSelection 0   a: 0   b: 0   c: 0
    EbExtReplaceSelection 0   a: 0   b: 0
    EbStartSearch 0   a: 6667108
    EbSearchCanReplace 0
    EbSearchGetCurState 0
    EbSearchFind 0
    EbSearchReplace 40244
    EbSearchReplaceAll 40244
    EbYankCurrentLine 40244
    EbSearchDone 0
    EbHideCode 0   a: 0
    EbShowCode 0   a: 0   b: 0
    EbIsWindowSplit 0   a: 0
    EbWinIniChange 50   a: 0
    TipGetOption 0   a: 0   b: 1
    TipSetOption 0   a: 0   b: 1
    TipGetOption 0   a: 1   b: 1
    TipSetOption 0   a: 1   b: 1
    TipGetOption 0   a: 2   b: 0
    TipSetOption 0   a: 2   b: 0
    TipGetOption 0   a: 3   b: 1
    TipSetOption 0   a: 3   b: 1
    TipGetOption 0   a: 4   b: 1
    TipSetOption 0   a: 4   b: 1
    TipGetOption 0   a: 5   b: 2
    TipSetOption 0   a: 5   b: 2
    TipGetFilenameOfProjectLibid 0   a: 0   b: 0
    EbGetNumPages 0   a: 0
    EbGetCurrentFunction 0   a: 169774756   b: 6766272
    EbIsInEvalWatch 0
    EbGetObjConnectionCounts 0   a: 0   b: 0
    EbGetKeyword  5   a: 0   b: 0   c: 0
    TipCreateExtension 5   a: 0   b: 0   c: 0   d: 0
    
    '''''''''''ERROR
    EbGetExceptionInfo 0   a: 264294520
    EbCopyExceptionInfo 0   a: 264294520   b: 0
    TipEberrOfHresult 0   a: 0
    EbShowError 0   a: 0
    EbGetErrorInfo 0   a: 0   b: 0
    EbExceptionHandled 263157969
    
    '''''''''''PROJECT
    TipCreateProject 0   a: 63394464
    TipIsProjCompiled 1   a: 63394464
    EbGetExecutingProj 50   a: 6881144
    TipProjAddRef 51   a: 6881144
    TipAddRefModule 52   a: 6881144
    TipSetLicenseInfo 0   a: 6881144   b: 6881144
    TipGetRefLib 0   a: 6881144   b: 0   c: 152541548   d: 1
    TipGetProjRefLib 0   a: 6881144   b: 0   c: 0   d: 6857512
    TipGetProjRefLibCount 0   a: 6881144   b: 0   c: 5
    TipGetProjRefLibFileName 0   a: 6881144   b: 0   c: 0   d: 0
    TipGetTypeLibOfHProject 0   a: 6881144   b: 6537464
    TipCreateStdModule 0   a: 6881144   b: 144675788   c: 0   d: 236139552
    TipDeleteModule 0   a: 236139552
    TipProjOfHproj 0   a: 6881144   b: 6881152
    TipIsProjRefLibLoaded 0   a: 6881144   b: 0   c: 0   d: 1
    TipHprojOfProj 0   a: 6881144   b: 6881144
    EbGetBstrOfLcid 0   a: 1033   b: 0   c: 186366388
    EbObjectBrowserSelChg 0   a: 6881144   b: 0
    EbGotoProcedure 0   a: 0   b: 0
    EbGetStatusOfItems 0   a: 6881144   b: 0
    EbGetFlagsOfEbitem 0   a: 6881144
    EbIsValidIdentOfProj 0   a: 6881144   b: 0   c: 0
    TipValidateReferences 0   a: 6881144
    EbGetNameOfEbitem 0   a: 6881144   b: 0   c: 0
    TipSetProjectDestForReferences 0   a: 6881144   b: 0   c: 0
    TipGetReferencingProjCount 0   a: 6881144   b: 0
    TipGetProjName (Eb Library) 272929204 0   a: 6881144   b: 1702240
    TipSetProjName 0   a: 6881144   b: 144676664
    TipIsProjModified 0   a: 6881144   b: 1
    TipCompileProjectFull 0   a: 6881144
    EberrOfScode 0   a: 0
    TipGetProjectDest (F:\VisualStudio\EbLibrary\ebexecutingproj) 0   a: 6881144   b: 1   c: 104659308
    TipSetProjectDest 0   a: 6881144   b: 0   c: 273446988
    TipGetDocOfProject 0   a: 6881144   b: 0
    TipSetDocOfProject 0   a: 6881144   b: 0
    TipSetCalendar 0   a: 6881144   b: 0
    TipGetLcid 0   a: 6881144   b: 1033
    TipSetLcid 0   a: 6881144   b: 1033
    EbSetDatabaseLcid 0   a: 6881144   b: 1033
    TipIsEventProcEmpty 0   a: 0
    TipGetCompatibleExe 0   a: 6881144   b: 0   c: 0   d: 0
    TipSetCompatibleExe 17   a: 6881144   b: 0   c: 0   d: 0
    TipIsProjCompiled 1   a: 6881144
    TipGetCompiledOfProject 5   a: 6881144   b: 0   c: 0
    TipGetTextOfProject 5   a: 6881144   b: 0   c: 0
    EbGetIntlDllFileName 48   a: 6881144   b: 0   c: 0
    TipRevertModule 440   a: 6881144
    TipSaveAsOldFormat 53   a: 6881144   b: 0   c: 0
    TipSaveAsOldFormat2 53   a: 6881144
    TipGetProjectOfLibId 53   a: 0   b: 0
    TipAddRefLib 53   a: 6881144   b: 0   c: 0   d: 0
    TipRemoveRefLib 35011   a: 6881144   b: 0
    TipReplaceRefLib 35011   a: 6881144   b: 0   c: 0   d: 0
    TipCanRefLibChange 35011   a: 6881144
    
    '''''''''''MODULE
    TipGetModuleCount 0   a: 63394464   b: 0   c: 0
    EbGetModule 40177   a: 6881144   b: 0   c: 0   d: 0
    EbMoveEbref 40177   a: 0   b: 0   c: 0
    TestGetFuncomp 40070   a: 0   b: 0   c: 0
    
    '''''''''''RECORD
    TipCreateOldAccessProject 440   a: 0   b: 0   c: 0   d: 349956136
    TipReleaseModule 0   a: 349956136
    CopyRecord 0   a: 0   b: 0   c: 0
    EbFColumnSelectionMode 0
    EbOpenNewLine 0
    EbCommitAll 0   a: 0
    EbRecordBeginAction 17   a: 0
    EbRecordEraseAction 17   a: 0
    EbRecordUserAction 17
    EbRecordEraseUserAction 17
    EbRecordLine 17   a: 0
    EbRecordEnd 6667372
    
    '''''''''''FUNCTION
    TipGetFunctionId 0   a: 6881144   b: 144684944   c: 1702244
    EbIsValidIdent 0   a: 104040012   b: 0
    TipGetExepartOffsetOfFunctionId 0   a: 6881144   b: 104040012   c: 0   d: 2564
    TipGetModOfFunctionId 0   a: 6881144   b: 104040012   c: 6766272
    TipSetModuleFlags 0   a: 6766272   b: 0
    TipIsModuleModified 0   a: 6766272   b: 0
    TipCompileModule 0   a: 6766272
    TestGetModCompState 0   a: 6766272   b: 0   c: 0
    TipGetModuleName (Module1) 0   a: 6766272   b: 1702188
    TipSetModuleName 0   a: 6766272   b: 194681596
    TipIsValidModuleName 0   a: 6766272   b: 0
    TipGetDocOfModule 0   a: 6766272   b: 0
    TipSetDocOfModule 0   a: 6766272   b: 0
    TipGetProjOfMod 0   a: 6766272   b: 6881144   c: 0
    TipGetFunctionCount 0   a: 6766272   b: 0   c: 0
    TipGetFunctionIdOfMod 0   a: 6766272   b: 0   c: 1702196
    TipReleaseModule 52   a: 6766272
    TipGetFuncInfo 0   a: 6881144   b: 104040012   c: 104275992
    TipGetArgCount 0   a: 104275992   b: 4
    ---TipGetArgType ) As Long 0   a: 104275992   b: 0   c: 3
    ---TipGetArgType ByRef x1 As Boolean 0   a: 104275992   b: 1   c: 16395
    ---TipGetArgType , ByRef x2 As Double 0   a: 104275992   b: 2   c: 16389
    ---TipGetArgType , ByVal x3 As String 0   a: 104275992   b: 3   c: 8
    ---TipGetArgType , ByRef x4() As String 0   a: 104275992   b: 4   c: 24584
    TipReleaseFuncInfo 1   a: 104275992
    
    '''''''''''MISC/UNKNOWN
    CreateIExprSrvObj 0   a: 0   b: 0   c: 0
    CheckExprSrvVersion 0   a: 0   b: 0
    EbGetExecutingInstance 0   a: 0
    EbObjbrwIsMemberSelected 0
    EbMemberGetCount 0
    TipMakeUniqueStreamName 0   a: 236184188
    EbInitThread 0   a: 0
    EbGetBstrOfLstClr 0   a: 0   b: 194681316
    EbFTranslateScp 0   a: 0   b: 0   c: 0   d: 0
    EbGetCurrentAllocInfo 0   a: 0   b: 0
    EbCreateCVbaExtEditors 0   a: 0   b: 0   c: 0   d: 194678144
    TestGetUiPoint 0   a: 0   b: 0
    __vbaRecAssign 0   a: 0   b: 0   c: 0
    __vbaRecDestruct 1702356   a: 0   b: 0
    TipIsCurrentVersion 449   a: 0   b: 0
    EbGetCommandLine 194681036
    EbSetCommandLine 1   a: 0
    DllUnregisterServer -2147319780
    EbShowToolTips 6666904   a: 0
    EbConfigureUi 60   a: 0
    TipGuidOfLibId 32797   a: 0   b: 0
    EbRegisterFunctions 35022   a: 0   b: 0   c: 0
    EbGetVBAObject -2147467262   a: 0   b: 0   c: 0   d: 0
    EbSetMsoHinst 1702360   a: 0
    StdcbufLink 1702360   a: 0
    CreateHostedExprSrv 1   a: 144837952   b: 0
    EbCheckOptions 1   a: 0   b: 0
    EbSetMemProfLevel 1   a: 0
    
    TipReleaseProject 51   a: 6881144
    TipReleaseProject 0   a: 63394464
    '''''''''''TEST ENDED

  24. #24

    Thread Starter
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    685

    Re: Need help or documentation on vba6.dll functions, Eb api

    Here is some relevant history that I didn't see before:

    wikipedia:

    Project Omega
    Microsoft's first attempt to sell a relational database product was during the mid 1980s, when Microsoft obtained the license to sell R:Base. In the late 1980s Microsoft developed its own solution codenamed Omega. It was confirmed in 1988 that a database product for Windows and OS/2 was in development. It was going to include the "EB" Embedded Basic language, which was going to be the language for writing macros in all Microsoft applications, but the unification of macro languages did not happen until the introduction of Visual Basic for Applications (VBA). Omega was also expected to provide a front end to the Microsoft SQL Server. The application was very resource-hungry, and there were reports that it was working slowly on the 386 processors that were available at the time. It was scheduled to be released in the 1st quarter of 1990, but in 1989 the development of the product was reset and it was rescheduled to be delivered no sooner than in January 1991. Parts of the project were later used for other Microsoft projects: Cirrus (codename for Access) and Thunder (codename for Visual Basic, where the Embedded Basic engine was used). After Access's premiere, the Omega project was demonstrated in 1992 to several journalists and included features that were not available in Access.

    Project Cirrus
    After the Omega project was scrapped, some of its developers were assigned to the Cirrus project (most were assigned to the team which created Visual Basic). Its goal was to create a competitor for applications like Paradox or dBase that would work on Windows. After Microsoft acquired FoxPro, there were rumors that the Microsoft project might get replaced with it, but the company decided to develop them in parallel. It was assumed that the project would make use of Extensible Storage Engine (Jet Blue) but, in the end, only support for Microsoft Jet Database Engine (Jet Red) was provided. The project used some of the code from both the Omega project and a pre-release version of Visual Basic. In July 1992, betas of Cirrus shipped to developers and the name Access became the official name of the product. "Access" was originally used for an older terminal emulation program from Microsoft. Years after the program was abandoned, they decided to reuse the name here.

    Timeline
    1992: Microsoft released Access version 1.0 on November 13, 1992, and an Access 1.1 release in May 1993 to improve compatibility with other Microsoft products and to include the Access Basic programming language.
    Name:  om.jpg
Views: 102
Size:  58.4 KB
    * Omega was considered a query building tool.

    * Omega featured pull-down help for dBase users, who could
    select a dBase language command and find out the equivalent
    command in Omega's Basic programming language.

    * Omega retained drag and drop (I thought that was the reason for possible data corruption?).

    * Both Access(Cirrus) and Omega could read and write SQL Server data...

  25. #25

    Thread Starter
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    685

    Re: Need help or documentation on vba6.dll functions, Eb api

    Quote Originally Posted by TTn View Post
    Trick, do you know how to declare and use EbRecordSet? I think this is an very old version of OpenRecordSet applied to Visual Basic internally.
    It seems to need an object, or perhaps more than 5 parameters.

    I also could not get EbJournalCancel to work in a way that the hook did not crash the caller.
    EbJournalCancel seems to have a conflicting number of parameters, either 0 or 1.
    It should have one parameter, but it crashes. With no parameter declared it works, but the hook crashes the caller, indicating something wrong with parameters.
    Trick, nevermind these API's are related to record macros, ie Record object. It needs host integration I believe.
    The whole group of Record object API declarations and documentation should be nearly identical to these:
    Code:
    'Returns S_OK Success, or E_UNEXPECTED if a RecordStart is not called.
    'Maps a keyword identifier to the string for that keyword.
    'This method can be called successfully only while recording. The keyword (kwid) values can be found in the file Kwid.h.
    Private Declare Function apiEbGetKeyword Lib "vba6.dll" Alias "EbGetKeyword" (ByRef u1 As Long, ByRef u2 As Long, ByRef u3 As Long) As Long 'rrr-vvv'S_OK Success E_OUTOFMEMORY Out of memory E_INVALIDARG One or more of the arguments is invalid.
    '
    'Checks whether lpstrIdent is a valid identifier for the named macro.
    'lpstrIdent Pointer to the identifier string.
    Private Declare Function apiEbIsValidIdent Lib "vba6.dll" Alias "EbIsValidIdent" (ByVal lpstrIdent As Long, ByRef u2 As Long) As Long 'Returns S_OK, S_FALSE, E_OUTOFMEMORY, or E_INVALIDARG
    '
    'Returns the name of the macro currently being recorded.
    'pbstrMacroName Name passed to RecordStart that is coerced into a valid, unique Basic identifier.
    'If no name is passed to RecordStart, NULL is returned.
    'This method is valid only while a macro is being recorded. If you attempt to call this method at any other time, it fails with E_UNEXPECTED.
    Private Declare Function apiTipGetFunctionName Lib "vba6.dll" Alias "TipGetFunctionName" (ByVal pbstrMacroName As Long) As Long 'S_OK E_OUTOFMEMORY E_INVALIDARG E_UNEXPECTED
    '
    'Record object (macro)
    'Marks a particular point in the macro’s recorded text.
    'uActionId - Sequential number of the action. Must always be less than the value of VBARECORD_ActionMax and greater than zero.
    'This function is called to associate the current recording point with a particular ActionId.
    'This is done so the host application can erase the recorded lines using the EraseAction method.
    'Each call to this function begins a new user action with the specified ActionId.
    Private Declare Function apiEbRecordBeginAction Lib "vba6.dll" Alias "EbRecordBeginAction" (ByRef uActionId As Long) As Long 'Returns S_OK Success,E_OUTOFMEMORY, or E_INVALIDARG
    '
    '
    'Erases the lines in a macro back to the line marked with BeginAction.
    'uActionId Must always be less than VBARECORD_ActionMax and greater than zero.
    'This function erases the lines between the current recording point and the line associated with the ActionId.
    'If no line is associated with the ActionId, VBA_E_NoUserAction is returned.
    'Once the deletion is completed, the recording point is set to the beginning of the specified ActionId.
    Private Declare Function apiEbRecordEraseAction Lib "vba6.dll" Alias "EbRecordEraseAction" (ByRef uActionId As Long) As Long 'Returns S_OK Success,E_OUTOFMEMORY, E_INVALIDARG, or VBA_E_NoUserAction (No line is associated with ActionID.)
    '
    Private Declare Function apiEbRecordUserAction Lib "vba6.dll" Alias "EbRecordUserAction" () As Long
    Private Declare Function apiEbRecordEraseUserAction Lib "vba6.dll" Alias "EbRecordEraseUserAction" () As Long
    '
    'Returns the project and module in which the macro recording point is set.
    'If the user is not currently recording, and therefore no recording point is set, pVbaProjItem is set to NULL.
    'ppVbaProj Pointer to the VBA project. Optional; can be NULL.
    'pVbaProjItem Pointer to the project item. Optional; can be NULL.
    Private Declare Function apiEbRecordSet Lib "vba6.dll" Alias "EbRecordSet" (ByVal bstrMacroRecPoint As Long, ByVal pVbaProj As Long, ByRef pVbaProjItem As Long) As Long 'Returns S_OK Success or E_FAIL
    '
    'Inserts one line of text at the current recording point of the macro.
    'lpstr Pointer to a string representing the text to be recorded.
    Private Declare Function apiEbRecordLine Lib "vba6.dll" Alias "EbRecordLine" (ByRef lpstr As Long) As Long 'Returns S_OK Success,E_OUTOFMEMORY, or E_INVALIDARG
    '
    'Ends the recording of a macro.
    Private Declare Function apiEbRecordEnd Lib "vba6.dll" Alias "EbRecordEnd" () As Long 'Returns S_OK Success, or E_UNEXPECTED if a RecordStart is not called.
    '
    'Cancels the recording of a macro and reverses any actions taken during the recording.
    Private Declare Function apiEbJournalCancel Lib "vba6.dll" Alias "EbJournalCancel" (ByVal u1 As Long) As Long 'Returns S_OK or E_UNEXPECTED.
    
    'Record - Records the specified text into the destination macro. A String expression containing the text to be recorded.
    'This parameter can contain multiple lines of text, that is,
    'you can embed carriage-return/line-feed pairs to separate lines of text.
    Private Declare Function apiCopyRecord Lib "vba6.dll" Alias "CopyRecord" (ByVal uIn As Long, ByVal u2 As Long, ByRef uOut As Long) As Long
    The VBA6 API are the building blocks for the extensibility model of both VB6 and VBA, with old school access to the old project format as well.
    I found a bunch more since last post, but I'll save it all for one big publish.

    Right now, I'm most interested in solving TipCreateReloadableModule and what that is all about...

  26. #26

  27. #27

    Thread Starter
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    685

    Re: Need help or documentation on vba6.dll functions, Eb api

    Quote Originally Posted by The trick View Post
    Code:
    Private Declare Function TipCreateReloadableModule Lib "vba6" ( _
                             ByVal cProj As IUnknown, _
                             ByVal lType As Long, _
                             ByVal pszName As Long, _
                             ByVal lFlags As Long, _
                             ByRef cMod As IUnknown) As Long
    Thank you once again Trick!

    I'm not exactly sure what function name means, because it seems to be the opposite of reloadable, ie cannot be released or deleted. If anyone else is curious or want to contribute information please post here. A quick sample based on Trick's declaration with constants:
    Code:
       Const VBAMODTYPE_StdMod As Long = 1
       Const VBAMODTYPE_ClassMod As Long = 2
    Private Declare Function apiEbGetExecutingProj Lib "vba6.dll" Alias "EbGetExecutingProj" (ByRef ppVbaProj As Long) As Long 'S_OK Success or E_INVALIDARG.
    Private Declare Function TipCreateReloadableModule Lib "vba6" (ByVal cproj As Long, ByVal lType As Long, ByVal pszName As Long, ByVal lFlags As Long, ByRef cmod As Long) As Long
    Code:
       
       Dim cproj As Long
       Dim cmod As Long
       Dim ret As Long
       
       apiEbGetExecutingProj cproj
       ret = TipCreateReloadableModule(cproj, VBAMODTYPE_ClassMod, StrPtr("ClassReloadable1"), 1025, cmod)
       MsgBox ret & "  " & cmod
    I'm still trying to figure out the flags. I just grabbed 1025 from EbGetModuleFlags with the executing module. It appears to work, with TipCreateReloadableModule returning 0 for success.

  28. #28
    Fanatic Member
    Join Date
    Nov 2013
    Posts
    600

    Re: Need help or documentation on vba6.dll functions, Eb api

    Unfortuanately, MS removed all these useful functions from VBA7

  29. #29

    Thread Starter
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    685

    Re: Need help or documentation on vba6.dll functions, Eb api

    Quote Originally Posted by JAAFAR View Post
    Unfortuanately, MS removed all these useful functions from VBA7
    I don't see them in any of the VBE6.dll either, for versions 6.0-6.5. The object model may still be powerful but it is limited for certain purposes. Good point.

    I think the reloadable module would work well with TipMakeUniqueStreamName, since it makes no attempt to avoid the name collision like the other module related API. I may end up using this one in VB6Porter. I recently separated the VBA 6.5 class and dll dependency from VB6Porter, so I had to drop support for auto-API insertion and the custom error parsing abilities that reveal subtle insidious errors in large projects. I should be able to resurrect them with these API.

    However, I can't figure out how to get compile/syntax error strings out of the API's in a direct call.
    For example, the following should work, but does not.

    Code:
    Private Const VBA_E_COMPILEERROR As Long = 40036 '&H9C64 ' A compiler error has occurred
    Private Const VBA_E_SYNTAX As Long = 40048 '&H9C70 ' A syntax error has occurred.
    Private Declare Function apiEbGetErrorInfo Lib "vba6.dll" Alias "EbGetErrorInfo" (ByVal hres As Long, ByRef pperrinfo As Any) As Long 'Returns S_OK Success, or E_INVALIDARG.
    Private Declare Function apiEbExecuteLine Lib "vba6.dll" Alias "EbExecuteLine" (ByVal lpstrLine As Long, ByVal u1 As Long, ByVal u2 As Long, ByVal bTest As Long) As Long 'Returns S_OK, E_OUTOFMEMORY, E_INVALIDARG, or E_COMPILEERROR (A compile error occurred.)
    Code:
       Dim ei As String
       Dim ret As Long
       Dim ret2 As Long
       ret = apiEbExecuteLine(StrPtr("If True The"), 0, 0, 1)
       ret2 = apiEbGetErrorInfo(ret, ByVal VarPtr(ei))
       MsgBox ret2 & " " & ei
    I tried the several other API's related to errors and nothing worked to output the same string that EbShowError displays.
    If there are dozens of errors in a project, it is better to list them with an ability to navigate and sort.

  30. #30

    Thread Starter
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    685

    Re: Need help or documentation on vba6.dll functions, Eb api

    eVB (Embedded Visual Basic 3.0)


    I was looking through my old CD's and found the old Embedded Visual Tools 3.0.
    It includes Embedded Visual Basic 3.0 (EVB3) and EVC3.

    The IDE of EVB3 is basically the same as VB6/VBA6 with some interesting differences.
    The documentation says that EVB2 had previously used the .vbp project extension, and now uses the .ebp in version 3. EVB3 can still open .vbp extensions though, which presents a few interesting possibilities.

    One, VB6 can make intermediate files with the .vb extension that can be executed at runtime, unless VB.NET is installed on the machine, then it opens the file as shown in the video. The task manager displays a file image with its extension appended as "Project1.vb.exe"

    The menu items for adding a class module and user control are missing, from the "project" menu.
    The "make exe" function is hidden from use, but can be activated by mixing project file data.
    Addins are missing from the main menu.
    EVB3 has a small subset of controls that also work in the VB6 IDE. The converse is not true.
    The project properties dialog window is trimmed down with a few targeting options in the "platform" tab item.

    There are additional remote "tool" options in the main menu.
    heap walker
    process viewer
    registry editor
    file viewer
    spy
    zoom
    configure platform manager
    control manager
    application install wizard

    About the eMbedded Visual Basic Language
    Small, lightweight, and interpreted, the language used by eMbedded Visual Basic is a subset of that used by the desktop version of Visual Basic. Related to VBScript, eMbedded Visual Basic combines the robust power of Visual Basic with the compact portability and ease of use characteristic of VBScript.

    Although eMbedded Visual Basic uses constants and variables as the desktop version of Visual Basic does, the only data type it employs is the Variant data type. The power of this development software is extended through the host of Intrinsic and ActiveX controls which are included. The power of the IDE is further extended through the opportunity it affords you to create and use Procedures.

    The language used by Microsoft eMbedded Visual Basic 3.0 is an interpreted language. This means that instruction statements are sequentially executed by an intermediate program called a command interpreter. So, rather than creating a stand-alone executable (.exe) file, eMbedded Visual Basic creates an intermediate (.vb) file, which is interpreted by the target device at run time.

    Some of the benefits of eMbedded Visual Basic over straight VBScript include:
    eMbedded Visual Basic can access files using the common dialog control; VBScript cannot.
    eMbedded Visual Basic can access Windows CE APIs; VBScript cannot access local OS APIs.
    Using the ADOCE control, eMbedded Visual Basic can access data sources; VBScript cannot.


    Data Types
    Microsoft® eMbedded Visual Basic® 3.0 has only one data type, called a Variant. A Variant is a special kind of data type that can contain different types of information, depending on how it is used. Because Variant is the only data type in eMbedded Visual Basic, it is also the data type returned by all functions.

    At its simplest, a Variant can contain either numeric or string data. A Variant behaves like a number when you use it in a numeric context and as a string when you use it in a string context.

    Porting VB Applications
    Porting desktop Visual Basic applications to an eMbedded Visual Basic platform presents some challenges, but some code may be reusable on the Windows CE platform without any modification.

    When porting a desktop Visual Basic application to eMbedded Visual Basic, keep the following issues in mind.

    User Interface (UI) design or redesign
    A complete redesign of the UI may be necessary to facilitate usability on a smaller screen. For more information about designing UIs on Windows CE devices, see the topic Designing a User Interface.

    A redesign of functionality for the platform may be necessary
    It may not be necessary to include all the functionality of a robust desktop application on a Windows CE device. This is especially true if your application is designed to interact with a desktop application. The desktop application can collect information from the device and manipulate that information on the desktop. You may also find that functionality you design into your Windows CE application is not needed in your desktop application.

    Controls
    Many of the controls available to the desktop Visual Basic are not supported in eMbedded Visual Basic. Some controls have been ported to eMbedded Visual Basic with reduced functionality. Check the eMbedded Visual Basic reference documentation for details about the controls that are bundled in the IDE. The Programmatic IDs that refer to specific controls are unique to that control; update these references in your code.

    Only the Variant data type is supported in eMbedded Visual Basic; User Defined Types (UDTs) are not supported.
    The eMbedded Visual Basic language is based on VBScript, and thus has the same limitations inherent in that language. If you have UDTs or other Data Types in your code, you will have to write new code to make up for this limitation in eMbedded Visual Basic.

    To open a desktop Visual Basic application in eMbedded Visual Basic
    Copy all the existing project files into a new directory and manually change the extension of the project file from .vbp to .ebp.
    Double-click the renamed project file to open the eMbedded Visual Basic IDE.
    When the IDE opens, it prompts you to select a platform for the application. Select a platform for the application.
    Build, compile, and download the updated application to the device. During compilation you may receive an error that a particular property is not supported. To remove this error you will have to manually comment out the line that contains this property setting in the existing form (.frm) files.
    Troubleshoot any errors that occur. Generally porting errors are related to ActiveX controls used by your application. Confirm that the control your application uses is registered on the device and that the relevant ProgID has not changed.

    Porting VBCE Applications
    You can port applications that were written using Visual Basic for Windows CE (VBCE) to eMbedded Visual Basic. The language itself has not changed except for the inclusion of some newly supported items in eMbedded Visual Basic. Porting existing applications from Visual Basic for Windows CE to eMbedded Visual Basic involves working around the incompatible structure of the project files of each of the IDEs.

    To port an existing VBCE application for use on the same platform in eMbedded Visual Basic.
    Copy all the existing project files into a new directory and manually change the extension of the project file from .vbp to .ebp.
    Double-click the renamed project file to open the eMbedded Visual Basic IDE.
    When the IDE opens, it prompts you to select a platform for the application. Choose the same platform that the application was originally designed to run on.
    Build, compile, and download the updated application to the device. During compilation you may receive an error that a particular property is not supported. To remove this error you will have to manually comment out the line that contains this property setting in the existing form (.frm) files.
    Troubleshoot any errors that occur. Generally porting errors are related to ActiveX controls used by your application. Confirm that the control your application uses is registered on the device and that the relevant ProgID has not changed.

    To port an existing VBCE application for use on a new platform
    Copy all the existing project files into a new directory and manually change the extension of the project file from .vbp to .ebp.
    Double-click the renamed project file to open the eMbedded Visual Basic IDE.
    When the IDE opens, it prompts you to select a platform for the application. Select a platform for the application.
    Modify the User Interface, if necessary, to take advantage of the new platform's visual presentation. For more information about designing UIs on Windows CE devices, see the topic Designing a User Interface.
    Build, compile, and download the updated application to the device. During compilation you may receive an error that a particular property is not supported. To remove this error you will have to manually comment out the line that contains this property setting in the existing form (.frm) files.
    Troubleshoot any errors that occur. Generally porting errors are related to ActiveX controls used by your application. Confirm that the control your application uses is registered on the device and that the relevant ProgID has not changed.
    Remarks
    Applications files (.vb) designed and compiled for use on the Palm-size PC run on the Pocket PC without modification. However, because of the way the eMbedded Visual Basic application files are interpreted on the device, the User Interface will appear different. The Palm-size PC application may not display menus or title bars on a Pocket PC device.

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