Solved

how dll detect whether i run in runtime or ide

Posted on 2000-04-12
4
223 Views
Last Modified: 2010-05-02
i have a dll which i've with visual basic and i've make other project that call this dll...

all i want is, the dll which i've called can differenciate whether i running my project in ide or in runtime?
0
Comment
Question by:cindafuzzy
  • 2
4 Comments
 
LVL 28

Expert Comment

by:Ark
ID: 2707137
Public Function IsIDE() As Boolean
    On Error GoTo ErrHandler
    'because debug statements are ignored when
    'the app is compiled, the next statment will
    'never be executed in the EXE.
    Debug.Print 1 / 0
    IsIDE = False
Exit Function
ErrHandler:
    'If we get an error then we are
    'running in IDE / Debug mode
    IsIDE = True
End Function
Cheers
0
 

Author Comment

by:cindafuzzy
ID: 2708390
Adjusted points from 150 to 200
0
 

Author Comment

by:cindafuzzy
ID: 2708391
ok... it is orait then to detect whether the program is running in ide or not

but may be i should clearify it...

i have made the dll using visual basic, the main objective of the dll is to detect whether the program calling him is running in ide or not.
0
 
LVL 6

Accepted Solution

by:
DrDelphi earned 200 total points
ID: 2708483
This will show if VB is running.


Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Private Sub Command1_Click()
If VBRunning Then
 MsgBox ("yes")
Else
MsgBox ("Nope")
End If
End Sub

Function VBRunning() As Boolean
If FindWindow("IDEOwner", "") = 0 Then
 VBRunning = True
Else
VBRunning = False
End If
End Function





Good luck!!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question