Solved

how dll detect whether i run in runtime or ide

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Write data from SQL to CSV file - position 1 53
String manipulation in Visual Basic 7 60
Add a task in Outlook from access 11 35
Problem to With line 4 43
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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 process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

861 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now