none
C# When importing the User32.DLL this error message keeps arising: An unhandled exception of type 'System.EntryPointNotFoundException' occurred in project craig.exe RRS feed

  • Question

  • After trying an assortment of supposed resolutions, still haven't come to any definitive answer to why the message keeps appearing. 

    System.Runtime.InteropServices is added to the accessing libraries

    Also when referencing the dll library i've added this 

    [System.Runtime.InteropServices.DllImport("User32.dll", CharSet = CharSet.Auto)]

    Problem arises when the program calls the class procedure: 

    (Inside class)

    public static extern int AnimatedWindow(IntPtr Hwand, int DwTime, int DwFlag);

    (Inside event)

     Transition.AnimatedWindow(this.Handle, 2000, Transition.Blend);

    Sunday, June 23, 2019 3:17 PM

All replies

  • [...]

    public static extern int AnimatedWindow(IntPtr Hwand, int DwTime, int DwFlag);



    Try AnimateWindow.

    Sunday, June 23, 2019 5:12 PM
  • why did that work and Animated didnt xD. Thanks regardless mate 
    Sunday, June 23, 2019 8:21 PM
  • why did that work and Animated didnt xD. Thanks regardless mate 

    Because AnimateWindow is the correct name of the function.

    Sunday, June 23, 2019 8:30 PM
  • Hi iExcelerate,

    Thank you for posting here.

    Based on your description, you want to solve the exception that you got.

    I noted that the code you provided has some errors, you could look at the following modified code.
    Code:

     enum AnimateWindowFlags : uint
            {
                AW_HOR_POSITIVE = 0x00000001,
                AW_HOR_NEGATIVE = 0x00000002,
                AW_VER_POSITIVE = 0x00000004,
                AW_VER_NEGATIVE = 0x00000008,
                AW_CENTER = 0x00000010,
                AW_HIDE = 0x00010000,
                AW_ACTIVATE = 0x00020000,
                AW_SLIDE = 0x00040000,
                AW_BLEND = 0x00080000
            }
    
            [System.Runtime.InteropServices.DllImport("User32.dll", CharSet = CharSet.Auto)]
            static extern bool AnimateWindow(IntPtr hwnd, int time, AnimateWindowFlags flags);
    
            private void Button1_Click(object sender, EventArgs e)
            {
                Form2 f2 = new Form2();
                AnimateWindow(f2.Handle, 1000, AnimateWindowFlags.AW_VER_NEGATIVE |AnimateWindowFlags.AW_SLIDE);
                f2.Show();
            }

    Result:

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, June 24, 2019 6:18 AM
    Moderator