Delphi Prism getting Unknown Identifier "DllImport" error

Posted by Robo on Stack Overflow See other posts from Stack Overflow or by Robo
Published on 2010-04-29T22:43:39Z Indexed on 2010/04/29 22:47 UTC
Read the original article Hit count: 575

Filed under:

I'm trying to call Window's SendMessage method in Delphi Prism, I've declared the class as follow:

type
  MyUtils = public static class
  private
    [DllImport("user32.dll", CharSet := CharSet.Auto)]
    method SendMessage(hWnd:IntPtr; Msg:UInt32; wParam:IntPtr; lParam:IntPtr):IntPtr; external;
  protected
  public
  end;

When I tried to compile, I get the error Unknown identifier "DllImport"

I used this as an example, http://stackoverflow.com/questions/2708520/how-to-call-function-createprocess-in-delphi-prism and the syntax looks the same. Is there a setting I need to enable, or do I have a syntax error?

© Stack Overflow or respective owner

Related posts about delphi-prism