471,049 Members | 1,575 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,049 software developers and data experts.

Preprocessor directive for program files folder

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

Jan 8 '07 #1
6 2152
2112 wrote:
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
Jan 8 '07 #2
Ok, but it's a function, not a preprocessor directive

David Wilkinson escreveu:
2112 wrote:
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
Jan 8 '07 #3

"2112" <vc*******@gmail.comwrote in message
news:11**********************@s80g2000cwa.googlegr oups.com...
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
--
Cholo Lennon
Bs.As.
ARG
Jan 8 '07 #4
2112 wrote:
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.
Jan 8 '07 #5
2112 wrote:
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
Jan 8 '07 #6
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:
2112 wrote:
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
Jan 8 '07 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

16 posts views Thread by Trying_Harder | last post: by
13 posts views Thread by Chris Croughton | last post: by
1 post views Thread by Jim Heavey | last post: by
11 posts views Thread by Jeff | last post: by
6 posts views Thread by olivier.grant | last post: by
31 posts views Thread by Sam of California | last post: by
3 posts views Thread by vippstar | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.