Solved

Passing HBitmap from Delphi to C DLL.

Posted on 2004-03-23
1
488 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
Comment Utility
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

763 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

6 Experts available now in Live!

Get 1:1 Help Now