Preprocessor directive for program files folder

  • Thread starter Thread starter 2112
  • Start date Start date
2

2112

I'm compiling a dll that imports msado15.dll.

When I'm using Windows in English, the msado15.dll is located at
<drive>:\Program Files\Common Files\System\ADO\msado15.dll". When using
Windows in Portuguese, the msado15.dll is located at <drive>:\Arquivos
de programas\Arquivos comuns\System\ADO\msado15.dll

I'd know if exists some preprocessor directive that could identify the
language of Windows and import msado15.dll from the correct path. For
example, suppose that WIN_ENG return the language of Windows, like
this:

#if WIN_ENG
#import "C:\Program Files\Common Files\System\ADO\msado15.dll" \
rename("EOF", "ADOEOF")
#else
#import "C:\Arquivos de programas\Arquivos
comuns\System\ADO\msado15.dll" \
rename("EOF", "ADOEOF")
#endif

Is there something that I can use?

thanks in advance
 
2112 said:
I'm compiling a dll that imports msado15.dll.

When I'm using Windows in English, the msado15.dll is located at
<drive>:\Program Files\Common Files\System\ADO\msado15.dll". When using
Windows in Portuguese, the msado15.dll is located at <drive>:\Arquivos
de programas\Arquivos comuns\System\ADO\msado15.dll

I'd know if exists some preprocessor directive that could identify the
language of Windows and import msado15.dll from the correct path.

2112:

Take a look at SHGetSpecialFolderPath().

David Wilkinson
 
2112 said:
I'm compiling a dll that imports msado15.dll.

When I'm using Windows in English, the msado15.dll is located at
<drive>:\Program Files\Common Files\System\ADO\msado15.dll". When using
Windows in Portuguese, the msado15.dll is located at <drive>:\Arquivos
de programas\Arquivos comuns\System\ADO\msado15.dll

I'd know if exists some preprocessor directive that could identify the
language of Windows and import msado15.dll from the correct path. For
example, suppose that WIN_ENG return the language of Windows, like
this:

#if WIN_ENG
#import "C:\Program Files\Common Files\System\ADO\msado15.dll" \
rename("EOF", "ADOEOF")
#else
#import "C:\Arquivos de programas\Arquivos
comuns\System\ADO\msado15.dll" \
rename("EOF", "ADOEOF")
#endif

Is there something that I can use?

thanks in advance

One solution (in general, not recommended due to version updates, but may be
valid in this case) could be to maintain a copy of msado15.dll in the
project directory for to import tlb data from there.

BTW, I have the same problem by with spanish/english versions of Windows ;-)

Regards
 
2112 said:
When I'm using Windows in English, the msado15.dll is located at
<drive>:\Program Files\Common Files\System\ADO\msado15.dll". When using
Windows in Portuguese, the msado15.dll is located at <drive>:\Arquivos
de programas\Arquivos comuns\System\ADO\msado15.dll

#import "C:\Program Files\Common Files\System\ADO\msado15.dll" \
rename("EOF", "ADOEOF")

What you could try is just write

#import "msado15.dll"

and add the respective path for every VC installation under the VC
installation-wide settings (as opposed to the project specific settings)
under Options | Directories| Executable Files. I believe #import follows
this path. (Add a comment to the #import line then.)

What you could try alternatively is #import via progid or libid instead
of the explicit DLL.
 
2112 said:
Ok, but it's a function, not a preprocessor directive

2112:

Oops, sorry, didn't read your post properly. I'll try again:

Can you not, on each machine, just put the appropriate path in the list
of executable directories in the VC settings? Then you can just write

#import <msado15.dll>

David Wilkinson
 
I solved the problem adding the macro $(CommonProgramFiles) in the
Addictional Include Directories of project properties

C/C++ -> General -> Additional Include Directories.

and changing that #import directive for this:

#import "System\ADO\msado15.dll" \
rename("EOF", "ADOEOF")

This worked fine for me.

Thank you all.


David Wilkinson escreveu:
 
Back
Top