943,900 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 812
  • C++ RSS
Jul 28th, 2009
0

Rename variables in .dll to manipulate excel files???

Expand Post »
Hey, I've been researching ways to code in C++ and manipulate excel files (i.e. read and write data). Right now I've written macros in VBA that output a .csv file that is read by my C++ program. It all works, but I'm still wondering if I can just write all my code in C++.

My question is concerning some code that I found that claims to allow manipulation of Excel using C++. The problem with the code (as far as I can tell) is that the program tries to open a .dll file and rename variables in the .dll file. From what I've read, .dll's are binary and can't be edited like a simple text file.

The full code start on page 62 of this pdf: http://www.maths.manchester.ac.uk/~ahazel/EXCEL_C++.pdf

I think the code is flawed in trying to rename variables in the .dll, which it can't do since .dll's are in binary. I don't really know, though. Here's the code that won't compile:

C++ Syntax (Toggle Plain Text)
  1. #import \
  2. "C:\Program Files\Common Files\Microsoft Shared\OFFICE11\mso.dll" \
  3. rename("DocumentProperties", "DocumentPropertiesXL") \
  4. rename("RGB", "RBGXL")

Any ideas? Thanks.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
timbuck2 is offline Offline
2 posts
since Jul 2009
Jul 28th, 2009
0

Re: Rename variables in .dll to manipulate excel files???

Take a look at http://msdn.microsoft.com/en-us/libr...b6(VS.71).aspx. The rename attribute doesn't actually rename anything within the DLL, it simply gives an alias for any property to avoid naming conflicts.
Reputation Points: 69
Solved Threads: 48
Posting Whiz in Training
nmaillet is offline Offline
203 posts
since Aug 2008
Jul 28th, 2009
0

Re: Rename variables in .dll to manipulate excel files???

I guess I don't really know why I'm getting any errors, then. I'm using Dev-C++, and the compiler is giving me a number of errors (a few are listed below).

I don't really know what to make of them. When I double click them so that I can see where the error is, it opens mso.dll and shows me where the error is. The reason I thought the problem was that the .dll file is in binary and the compiler can't read it is because I'm looking at mso.dll and all I see are squares and other meaningless symbols. I think I read on the msdn site that the import directive creates a primary and secondary header file -- shouldn't this be where the renaming is occurring?

Here are some of the errors that I am receiving from the code I listed in my first post:
7:1 C:\Crane Program\Testing.cpp [Warning] extra tokens at end of #import directive
8 C:\Crane Program\Testing.cpp In file included from C:\Crane Program\Testing.cpp
1 C:\Program Files\Common Files\Microsoft Shared\OFFICE11\mso.dll stray '\144' in program
8 C:\Crane Program\Testing.cpp In file included from C:\Crane Program\Testing.cpp
1:4 C:\Program Files\Common Files\Microsoft Shared\OFFICE11\mso.dll [Warning] null character(s) ignored
1 C:\Program Files\Common Files\Microsoft Shared\OFFICE11\mso.dll stray '\3' in program
Reputation Points: 10
Solved Threads: 0
Newbie Poster
timbuck2 is offline Offline
2 posts
since Jul 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Adding Menu to windows dialog created with DialogBox()
Next Thread in C++ Forum Timeline: Template question





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC