VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Debug.Print...from an Exe

by Duncan Jones (19 Submissions)
Category: Windows API Call/Explanation
Compatability: Visual Basic 3.0
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (3 Votes)

Everyone knows how useful Debug.Print can be when debugging a program in the run time environment...but why not make these debug comments available from an executable.
Simply replace Debug.Print with the following, and then when your application is running as an executable you can use a debugger (such as DBMON.EXE, downloadable form MSDN) to see the debug comments as they occur:

API Declarations
Private Declare Sub OutputDebugString Lib "kernel32" Alias "OutputDebugStringA" (ByVal lpOutputString As String)
Private Declare Function IsDebuggerPresent Lib "kernel32" () As Long

Rate Debug.Print...from an Exe

Private Sub DebugNote(ByVal DebugString As String)
If IsDebuggerPresent Then
 Call OutputDebugString(DebugString)
End If
End Sub

Download this snippet    Add to My Saved Code

Debug.Print...from an Exe Comments

No comments have been posted about Debug.Print...from an Exe. Why not be the first to post a comment about Debug.Print...from an Exe.

Post your comment

Subject:
Message:
0/1000 characters