Solved

Passing HBitmap from Delphi to C DLL.

Posted on 2004-03-23
1
489 Views
Last Modified: 2010-04-05
Hi,
   I am trying to pass a HBITMAP from Delphi to a C DLL and am getting access violation.

Here's my delphi wrapper. "myPic" is a TBitmap object.
result      := TEST_DLL( HBITMAP(myPic.Handle) );

and here is the C function declaration:

IMGPRO_API IMGP_RESULT Test(HBITMAP i_HBmp);

Any idea why this is so.

Thanks a lot.
0
Comment
Question by:limin123
1 Comment
 
LVL 26

Accepted Solution

by:
Russell Libby earned 100 total points
ID: 10664314
Only 3 things come to mind...

1.) myPic object is nil (not assigned)
2.) There is a problem in the dll function itself
3.) Calling convention is not correct (one is cdecl, the other stdcall, etc). Check the calling convention for the C dll and make sure your Delphi declaration matches

eg:

function FunctionName(params....): ResultType; stdcall; external 'dllname.dll';
or
function FunctionName(params....): ResultType; cdecl; external 'dllname.dll';
etc...

-----

Regards,
Russell

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now