Announcement

Collapse
No announcement yet.

DLL from VB IDE

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • DLL from VB IDE

    How write DLL routine with PB wich check if the calling program
    run into Visual Basic IDE ?
    - For example

    myProgram.frm call the myPBDll.dll
    if myProgram run into VB Ide
    then myPBDll return True
    else
    return False

    ---
    if myProgram.exe call the muPBDll.dll
    then myPBDll return false

    I find this in VB KB

    >Public Function ASC_IsIDE() As Boolean
    > ' trap error
    > On Error GoTo IsIDE
    > ' error line
    > Debug.Print 1 / 0
    > ' exit sub without error, the debug.print was not execute
    > Exit Function
    >
    > IsIDE:
    > ' if error, I am on IDE 'cause debug.print was called
    > ASC_IsIDE = True
    >
    > End Function



    ------------------

  • #2
    You could call GetModuleFileName, which returns the name of the running
    program. If the result is, say,
    "c:\microsoft likes to bury programs really deep in folders\VB6.EXE"
    you can be pretty sure that the calling program is running in the VB IDE.


    ------------------
    Tom Hanlin
    PowerBASIC Staff

    Comment


    • #3
      Tom,
      thanks for your attention.
      Excuse me for my very bad English.
      Have You an example for me?

      Very thanks in advance.
      Mimmo


      ------------------

      Comment


      • #4
        The GetExeName function below will tell you the complete filespec
        of the .EXE that's calling your DLL. Visual Basic 6.0 will end with
        a filename of "VB6.EXE". You may also wish to check for the other
        32-bit VB compilers, VB 4.0 and VB 5.0. I don't have these installed,
        so I can't tell you for sure what filenames they use.
        Code:
        #COMPILE DLL
        #IF NOT %DEF(%WINAPI)
          DECLARE FUNCTION GetModuleFileName LIB "KERNEL32.DLL" ALIAS _
             "GetModuleFileNameA" (BYVAL hModule AS LONG, lpFileName AS ASCIIZ, _
             BYVAL nSize AS LONG) AS LONG
        #ENDIF
        FUNCTION GetExeName () AS STRING
        
          LOCAL f AS ASCIIZ * 256
        
          GetModuleFileName 0, f, SIZEOF(f)
        
          FUNCTION = f
        
        END FUNCTION
        ------------------
        Tom Hanlin
        PowerBASIC Staff

        Comment


        • #5
          Tom,
          You are Fantastic (as all the PowerBasic company)!!!
          I hope, that your help, can be minimized this problem.
          I write free source code for VB5 and VB6, for Italian Lotto
          website visitors. But they,in illegal reason, copy and write
          my code in their comercial software...
          I write part of my code in PBDLL 6.0. So, and with your important
          suggest, I will make run my code only into VB IDE.

          Infinite Thanks
          Mimmo




          ------------------

          Comment

          Working...
          X