473,396 Members | 2,024 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Run Time Error #0 MSVS 2003, with COM

Hi all,

This is my first post here. I am new to COM, but I have read through many postings trying to get to the bottom of this, to no avail. Here is my problem.

I get the error Run Time Error #0, value of ESP not properly saved.......

From what I can tell, there are two possible causes.

1. In the advanced tab, there are the calling options. cdecl, stdcall, etc....
Everything in every project is set to cdecl, so I don't think that is it.

2. Typecasting or otherwise improper variable initialization/casting.
Maybe. I don't know the first thing about COM, so maybe this is really dumb. This is code that used to work, and all of a sudden doesn't.

Expand|Select|Wrap|Line Numbers
  1. void GetPFPSDataPaths(std::vector<std::string> &aDataPaths)
  2.     {
  3.         aDataPaths.clear();
  4.         CoInitialize(0);
  5.         bool ComEstablished(true);
  6.         try
  7.         {
  8.                       HRESULT hr;
  9.  
  10.         // Create our COM objects
  11.         IMapSeriesRowsetPtr spMapSeries;
  12.         hr = spMapSeries.CreateInstance(__uuidof(MapSeriesRowset));
  13.         if (hr != S_OK)
  14.                          throw _com_error(hr);        
  15.  
  16.         ICoverageRowsetPtr spCoverage;
  17.         hr = spCoverage.CreateInstance(__uuidof(CoverageRowset));
  18.         if (hr != S_OK)
  19.                          throw _com_error(hr);        
  20.  
  21.         IDataSourcesRowsetPtr spDataSources;
  22.     hr = spDataSources.CreateInstance(__uuidof(DataSourcesRowset));
  23.                     if (hr != S_OK)
  24.                    throw _com_error(hr);
  25.  
  26. I use the spDataSources for lots of things, and all is well. Then, these few lines happen:
  27.  
  28.    // attempt to grab all paths from the map data manager
  29.            spCoverage->Initialize("cadrg");
  30.  
  31.            hr = spDataSources->SelectAll(TRUE);
The SelectAll is where it dies.

Is there a problem with how I initialized the spDataSources?
Any other ideas?

Thanks,
Grommit.
Apr 8 '08 #1
1 1219
weaknessforcats
9,208 Expert Mod 8TB
spCoverage->Initialize("cadrg");
"cadrg" is a char char string. COM uses Unicode. I would be suprised to see a method have a char* argument, I would expect to see an LPWSTR instead.

You don't check the HRESULT from spCoverage->Initialize("cadrg") to see if it worked.

Maybe try:

Expand|Select|Wrap|Line Numbers
  1. LPWSTR str = SysAllocString("cadrg");
  2. spCoverage->Initialize(str);
  3.  
If you use SysAllocString(), don't forget to use SysFreeString() to release the allocation.
Apr 9 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Gerrit Holl | last post by:
Posted with permission from the author. I have some comments on this PEP, see the (coming) followup to this message. PEP: 321 Title: Date/Time Parsing and Formatting Version: $Revision: 1.3 $...
2
by: KULJEET | last post by:
control file not created at time of installtion of oracle database now how we can create it see alert file Dump file e:\ORacle\admin\new\bdump\newALRT.LOG Tue Sep 09 10:45:53 2003 ORACLE...
0
by: anita hery | last post by:
Hi All I found an error ( run time error 3669. Execution cancelled) when ran the following query via VB6 SP5. select crc,month,sum(v) as v from ( select crc,v, case when fadate between...
4
by: Vince | last post by:
Hi, I am not used to template and I cannot find what's wrong with this code : Compiler(MSVS 7) complains at line : class iterator : public std::iterator<... Here is the source code
0
by: Joachim | last post by:
I have, in order, installed MS Visual Studio 6, MS Visual Studio .NET and MS Visual Studio 6 SP 6. After installing MSVS SP6 I frequently get the following errors when compiling my projects ...
1
by: Alfonso Morra | last post by:
Hi I'm compiling some code and need to generate some random numbers. To save time, I decided to use the srand, rand and time functions. My code worked (atleast built fine) until I added time.h,...
5
by: eberesche | last post by:
Hello, as a novice in ASN.1 I have me to a project in C ++ under use of ASN.1 - structures risquély. One of my colleagues means, this would deal something with masochism ;-). Result should be a DLL...
9
by: zman77 | last post by:
Hi. How do I use gcc to compile C code into a .dll file that can be used by my C# project? The problem I am faced with is this: I have C code compiled with gcc. I tried making a new C++ project...
3
by: Bev in TX | last post by:
I am a complete newbie at building Python. I am trying to build it under MS Windows Vista (64-bit AMD) with MS VS2005. I'm doing that because I need debug libraries, which I did not see in the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.