#if kMAXVersion = Version.normal then
If Globals.thePrefs.GetPrefString("Export_FormatMain") = "" Then globals.thePrefs.setPrefString("Export_FormatMain", "Valentina")
#elseif kMAXVersion = Version.Server then
If Globals.thePrefs.GetPrefString("Export_FormatMain") = "" Then globals.thePrefs.setPrefString("Export_FormatMain", "ValentinaServer")
#else
If the conditional statement is working out just fine and it’s only the window that’s causing you trouble you don’t even need to use or define constants (though great advice from Beatrix). Just use the compiler conditional #if statements.
#if myGreatApp = "xxx" then
windowA.Method
#elseif myGreatApp = "yyy" then
windowB.Method
#endif
However, I would argue that because of what you’re doing the code shouldn’t be in a shared module. You’re going out of your way to find what app it is? That code should be local to the app! You may want to reconsider the design, there’s probably a better way to approach what you’re attempting.