Debug Print in an EXE

Debug Print in an EXE

Contrary to common belief, Debug.Print statements are not always removed from an executable. This behavior can be demonstrated easily. Open a new project, place a single CommandButton on the default form, and add this code:

 Public Function DebugTime()	MsgBox "Caught!"End FunctionPrivate Sub Command1_Click()	Debug.Print DebugTimeEnd Sub

Compile the program to an EXE, run, and click on the button. Unexpectedly, the message box appears. This is obviously a contrived example, but it’s easy to imagine cases where Debug.Print is used to print the return value of a function, for example. If variables are passed as ByRef parameters, and if the function alters the value of those variables, this error is propagated through to the executable, and might be extremely difficult to find. The morals of this tip are:
1. Pass parameters ByVal unless you’re certain you’re not going to change them, or you’re using them as “output” parameters.
2. Be careful when using Debug.Print. It might be doing more than you think.

Share the Post:
data observability

Data Observability Explained

Data is the lifeblood of any successful business, as it is the driving force behind critical decision-making, insight generation, and strategic development. However, due to its intricate nature, ensuring the

Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved