Advertisement
2_2002-2004 VB function enhancement #114433

Possible error in VB6 Compiler

This is possebly an error in the VB6 compiler but i have turned it into a way to find out if you are in the IDE or Compiled version.

AI

Shrnutí AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Zdrojový kód
original-source
Just simple arithmatic can give different values in IDE-mode ore EXE-mode.<BR>
Insert this piece of code into a module and call the function IsIde.<BR> it will return true if the programm is running in IDE-mode and false if running in EXE-mode (Compiled).<BR>
Take a look at the code and find out if this is an error or not.<BR><BR>
<PRE>
Option Explicit
Private Test As Long
Public Function IsIde() As Boolean
 Test = 4
 Test = (Test + 1 + GetVal)
 If Test = 9 Then IsIde = True
'Test will give 9 if IDE and 10 if EXE
'This can be done with any initial value but ofcourse you get other results
End Function
Private Function GetVal() As Long
 GetVal = 4
 Test = Test + 1
End Function
</PRE>
Původní komentáře (3)
Obnoveno z Wayback Machine