LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Bad DLL Calling Convention (Error 49)

Dear Chip,

Here is my VBA declaration:

Declare Function steam67 Lib "steam67.dll" (ByRef temperature As
Double, ByRef pressure As Double, ByRef quality As Double, ByRef
weight As Double, ByRef enthalpy As Double, ByRef entropy As Double,
ByRef saturation_temperature As Double, ByRef saturation_pressure As
Double, ByRef degrees_superheat As Double, ByRef degrees_subcooling As
Double, ByRef viscosity As Double, ByRef critical_velocity As Double,
ByVal action As Integer) As Integer

I have put steam67.dll in C:\Windows\System32 folder

Then I am calling this dll in following function:

Public Function flash67(temperature As Double, _
pressure As Double, _
quality As Double, _
enthalpy As Double, _
entropy As Double) As Variant
Dim weight As Double
Dim saturation_temperature As Double
Dim saturation_pressure As Double
Dim degrees_superheat As Double
Dim degrees_subcooling As Double
Dim viscosity As Double
Dim critical_velocity As Double
Dim action As Integer
Dim iret As Integer

action = 2 'viscosity=1, crit_vel=2

iret = steam67(temperature, pressure, quality, weight, enthalpy,
entropy, saturation_temperature, saturation_pressure,
degrees_superheat, degrees_subcooling, viscosity, critical_velocity,
action)

flash67 = Array(temperature, pressure, quality, weight, enthalpy,
entropy, saturation_temperature, saturation_pressure,
degrees_superheat, degrees_subcooling, viscosity, critical_velocity)

End Function

I am getting error at iret = steam67(temperature, pressure ....) line
of the code. I don't know what but I think there is a problem of using
this line in office 2003. Office XP (2002) uses the same structure of
the program and does not give any error.


In steam67.h file I checked the data type and they are as following:

int steam67(double *temperature, double *pressure, double *quality,
double *weight, double *enthalpy, double *entropy, double
*saturation_temperature, double *saturation_pressure, double
*degrees_superheat, double *degrees_subcooling, double *viscosity,
double *critical_velocity, int action);

I will greatly appreciate your help. Thanks


"Chip Pearson" wrote in message ...
Shaikh,

Typically, you get a Bad Calling Convention error when arguments passed to
the DLL do not match the data type (long, integer, etc) or the reference
type (byval or byref) specified by the DLL.

Post your Declare statement and the code you are using to call the function.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Shaikh" wrote in message
...
Hello,
I have the following strange problem.
I have an excel program that uses a dll. Every thing is working fine

(still now) with my old laptop. But giving me error 49 - Bad DLL Calling
Convention (Error 49) - in my new laptop. Files and dll are same in both the
machine.

Both laptops have windows XP
Old laptop has Office XP (Office 2002) and new laptop has Office 2003

I am suspecting something wrong in Office 2003. Can anybody please tell me

whats the problem?

-Thanks.



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pivot Refresh Error when calling Excel Macro from VB.NET program amdefacto Excel Discussion (Misc queries) 0 July 6th 09 10:06 AM
modified following business day convention Don Excel Worksheet Functions 1 May 17th 07 01:32 PM
Naming convention for workbook names Barb Reinhardt Excel Discussion (Misc queries) 2 March 13th 07 12:29 AM
Anyway to set numerical column name as Exel convention? Frank Cao Excel Worksheet Functions 4 December 15th 05 08:02 PM
Email using universal naming convention Tom Ogilvy Excel Programming 2 July 14th 03 02:44 AM


All times are GMT +1. The time now is 08:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"