![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]() Hi, I'm really struggling with this so any help would be appreciated. Outlook 2007, VS2008 Pro, VSTO 3, XP Pro x64 (dev) and x32 (test). I've a C++ dll with a bunch of functions to handle the registry, some custom authentication of the product, and some comms. I'd rather not have to rewrite them in VB.NET/C# (I'm primarily a C++ developer). There are extern "C" wrappers for the C++ calls. The product was originally done in VBA, and everything works fine there ![]() I've written an add-in and I've got the pinvoke stuff in place. I can call Win32 functions - for testing, I pop up a message box and get the system directory. All is well, works exactly as I'd expect. However, when I call the functions in my unmanaged dll, the functions get entered, but their arguments are garbage. I'm passing in a StringBuilder to get a string of text back, but writing to the StringBuilder parameter in the unmanged function (wchar_t*) causes an access violation. I've written a test project to make sure there's nothing funny with my machine setup. I've got my unmanaged dll and a VB.NET console app. The unmanaged functions return an int, accept a string, modify the string as a side effect, and it all works fine. But, when I do exactly the same thing in the add-in, it fails ![]() Is there something I'm missing? Is this a CAS issue? Does VSTO just not like unmanaged code? ![]() Thanks. -R. -- scot_paro http://forums.slipstick.com |
Ads |
#2
|
|||
|
|||
![]()
What if instead of passing a StringBuilder object you pass a string and
Marshal it as UnmanagedType.BStr, does that work? -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "scot_paro" scot_paro.3y5jco@invalid wrote in message news:scot_paro.3y5jco@invalid... Hi, I'm really struggling with this so any help would be appreciated. Outlook 2007, VS2008 Pro, VSTO 3, XP Pro x64 (dev) and x32 (test). I've a C++ dll with a bunch of functions to handle the registry, some custom authentication of the product, and some comms. I'd rather not have to rewrite them in VB.NET/C# (I'm primarily a C++ developer). There are extern "C" wrappers for the C++ calls. The product was originally done in VBA, and everything works fine there ![]() I've written an add-in and I've got the pinvoke stuff in place. I can call Win32 functions - for testing, I pop up a message box and get the system directory. All is well, works exactly as I'd expect. However, when I call the functions in my unmanaged dll, the functions get entered, but their arguments are garbage. I'm passing in a StringBuilder to get a string of text back, but writing to the StringBuilder parameter in the unmanged function (wchar_t*) causes an access violation. I've written a test project to make sure there's nothing funny with my machine setup. I've got my unmanaged dll and a VB.NET console app. The unmanaged functions return an int, accept a string, modify the string as a side effect, and it all works fine. But, when I do exactly the same thing in the add-in, it fails ![]() Is there something I'm missing? Is this a CAS issue? Does VSTO just not like unmanaged code? ![]() Thanks. -R. -- scot_paro http://forums.slipstick.com |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
calling ms word | Southern at Heart | Outlook and VBA | 1 | February 25th 08 06:16 AM |
contacts calling | Jeff | Outlook - Using Contacts | 3 | March 1st 07 10:39 PM |
How to use "Look up Outlook Contact" function with code? VSTO 2005 | David Webb | Outlook and VBA | 1 | July 28th 06 07:29 PM |
Calling all MVPs | Rob | Outlook - General Queries | 1 | July 25th 06 04:04 AM |
Calling For Backup! | Ron | Outlook Express | 2 | July 14th 06 05:42 PM |