?
Solved

Passing HBitmap from Delphi to C DLL.

Posted on 2004-03-23
1
Medium Priority
?
497 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 26

Accepted Solution

by:
Russell Libby earned 400 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

777 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