Win32 dll into Delphi .Net
Posted on 2006-06-14
I have a problem with gething Win32 dll into a Delphi .Net. (I'm using Borland 2006)
I have found in the help:
You can call unmanaged Win32 APIs (and other unmanaged code) by prefixing the function declaration with the DllImport custom attribute. This attribute resides in the System.Runtime.InteropServices namespace, as shown below:
function MessageBeep(uType : LongWord) : Boolean; external;
But I got the error: Cannot have both a DLLImport attribute and an external or calling convention directive (E2293)
I haven't added other dll's, but I think it is somone that is there from the start. I have tryed with bouth .Net VCL Forms Application and .Net Windows Forms Application. But it is .Net VCL Forms Application I want too use.
A bit more describing of the error:
The compiler emits DLLImport attributes internally for external function declarations. This error is raised if you declare your own DLLImport attribute on a function and use the external name clause on the function.
I have also tryed to use "ADD REFERANCE"; but I got the error: "user32.dll is not a valid assembly, type library, or COM object."
Anybody know how too solve this problem, pleace?