Announcement

Collapse
No announcement yet.

DLL from VB IDE

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

  • Mimmo Labate
    replied
    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




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

    Leave a comment:


  • Tom Hanlin
    replied
    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

    Leave a comment:


  • Mimmo Labate
    replied
    Tom,
    thanks for your attention.
    Excuse me for my very bad English.
    Have You an example for me?

    Very thanks in advance.
    Mimmo


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

    Leave a comment:


  • Tom Hanlin
    replied
    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

    Leave a comment:


  • Mimmo Labate
    started a topic DLL from VB IDE

    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



    ------------------
Working...
X