Newsgroup: it.comp.lang.visual-basic
Titolo: compilazione diversa per w95 e nt4. perche?

Sto modificando un sorgente complesso 
Richiede una compilazione separata (a seconda dell'ambiente in cui
verrà fatto girare).
Per la compilazione devo attivare una sessione di NT4 e generare l'exe
per quel s.o. (ottengo XXnt4.exe)
Poi devo attivare una sessione w95 e rifare la stessa cosa. (ottengo
XXw95.exe)
I due compilati sono reciprocamente incompatibili. Naturalmente pero'
eseguono le IDENTICHE COSE, avendo caricati gli stessi componenti.
Qualcuno sa perchè?
C'e' una soluzione che semplifica questa macchinosa gestione?
Al s.o. (windows) non basta sapere che deve usare una tal dll o ocx,
indipendentemente dalla versione usata in fase di compilazione?
Come sempre MOLTE grazie a chi legge e risponde ai messaggi del NG
   Nicola Tornieri
   ----------------------------
  Manens Intertecnica srl
  tornieri[at]
manens.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Qualcuno sa perchč?


Puoi usare la compilazione condizionale. Io la uso spesso per avere versioni
demo, debug, w9x, wnt, amici, nemici, ecc.
Copio e incollo da msdn:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Using Conditional Compilation
Conditional compilation lets you selectively compile certain parts of the
program. You can include specific features of your program in different
versions, such as designing an application to run on different platforms, or
changing the date and currency display filters for an application
distributed in several different languages.
Structuring Code for Conditional Compiling
To conditionally compile a part of your code, enclose it between #If...Then
and #EndIf statements, using a Boolean constant as the branching test. To
include this code segment in compiled code, set the value of the constant
to -1 (True).
For example, to create French language and German language versions of the
same application from the same source code, embed platform-specific code
segments in #If...Then statements using the predefined constants
conFrenchVersion and conGermanVersion.
#If conFrenchVersion Then
   ' <code specific to the French language version>.
#ElseIf conGermanVersion then
   ' <code specific to the German language version>.
#Else
   ' <code specific to other versions>.
#End If
If the value of the conFrenchVersion constant is set to True at compile
time, the conditional code for the French language version will be compiled.
If the value of the conGermanVersion constant is set to True, the compiler
uses the German language version.
Declaring Conditional Compilation Constants
There are three ways to set conditional compilation constants: in the
Conditional Compilation Arguments field of the Make tab on the Project
Properties dialog box, on a command line, or in code.
Conditional compilation constants have a special scope and cannot be
accessed from standard code. How you set a conditional compilation constant
may depend on the scope you want the constant to have.
How Set Scope
Project Properties dialog box Public to all modules in the project
Command line Public to all modules in the project
#Const statement in code Private to the module in which they are declared
Setting Constants on the Project Properties Dialog Box
Before creating the executable file, from the Project menu, choose Project
Properties, click the Make tab on the Project Properties dialog box, and
enter an argument, such as conFrenchVersion = -1, in the Conditional
Compilation Arguments field (if you are compiling your application for the
French language version). When you compile the program, this argument will
satisfy the #If...Then condition, and the code between the #If...Then and
#EndIf statements will be included in the compiled program.
If you have a complex #If...Then statement, containing one or more #ElseIf
statements, you will need to set additional constants. You can set multiple
constants by separating them with colons, as in the following example:
conFrenchVersion=-1:conANSI=0
Setting Constants on the Command Line
If you want to start compilation from a command line, use the /d switch to
enter conditional compilation constants, as shown here:
vb6.exe /make MyProj.vbp /d conFrenchVersion=-1:conANSI=0
No space is required between the /d switch and the first constant.
Command-line declarations override declarations entered on the Project
Properties dialog box, but do not erase them; arguments set on the Project
Properties dialog box remain in effect for subsequent compilations.
For More Information   See "#If.Then.#Else Directive" and "#Const
Statement."
----------------------------------------------------------------------------
---
Ciao
Aldo