Solved

how dll detect whether i run in runtime or ide

Posted on 2000-04-12
4
217 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 27

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

786 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