After running my project multiple times I get the error: Could not resolve COM reference "f8937e53-d444-4e71-9275-35b64210cc3b", what is it?

This is a complete error:

Error   1   Could not resolve COM reference "f8937e53-d444-4e71-9275-35b64210cc3b" version 1.0. The specified image file did not contain a resource section. (Exception from HRESULT: 0x80070714)   UsingAutoIt

      

Never before google found anything with this link long number and letters.

This is my complete form1 code not that long. Maybe DllImport is causing the problem? But this was not the case before. Strange mistake.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Threading;
using AutoItX3Lib;
using System.Runtime.InteropServices;
using System.Diagnostics;

namespace UsingAutoIt
{
    public partial class Form1 : Form
    {
        [DllImport("USER32.DLL")]
        public static extern bool SetForegroundWindow(IntPtr hWnd);


        static AutoItX3Lib.AutoItX3Class au3;
        static Thread thread;
        static bool threadshouldexecute = true;
        static int i = 0;
        string processName = "GameCapture";
        string existingProcessName = "Game Capture HD";
        string processFileName = @"C:\Program Files (x86)\Elgato\GameCapture\GameCapture.exe";
        IntPtr windowHandle;

        public Form1()
        {
            InitializeComponent();


            au3 = new AutoItX3Lib.AutoItX3Class();
            au3.AutoItSetOption("WinTitleMatchMode", 4);

            if (au3.WinExists(existingProcessName, "") == 0) // Window not found
            {
                int processId = au3.Run(processFileName, "", au3.SW_SHOW);
                BringToFront(processId);
                Thread.Sleep(10000);
                au3.MouseClick("LEFT", 358, 913, 1, -1);

            }
            else
            {
                Process[] processes = Process.GetProcessesByName(processName);
                BringToFront(processes[0].Id);
                au3.MouseClick("LEFT", 358, 913, 1, -1);
            }
        }

        public static void BringToFront(int processId)
        {
            Process process = Process.GetProcessById(processId);
            IntPtr handle = process.MainWindowHandle;

            if (handle == IntPtr.Zero)
                return;

            SetForegroundWindow(handle);
        }


        private void Form1_Load(object sender, EventArgs e)
        {
            System.Windows.Forms.Timer t1 = new System.Windows.Forms.Timer();
            t1.Interval = 50;
            t1.Tick += new EventHandler(timer1_Tick);
            //t1.Enabled = true;
            t1.Enabled = false;
        }

        public static Point GetMousePosition()
        {
            var position = System.Windows.Forms.Cursor.Position;
            return new Point(position.X, position.Y);
        }

        private void Form1_MouseMove(object sender, MouseEventArgs e)
        {

        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            label1.Text = string.Format("X={0}, Y={1}", GetMousePosition().X, GetMousePosition().Y);
        }
    }
}

      

+3


source to share


1 answer


But for this I had to first register with regsrv32 only after registering, I could add the dll file as a reference.

This is fine, Visual Studio stores the type library guide in the project file. A type library is a description of the types exported by a COM component. Very similar to metadata in a .NET assembly. Finding the library back from the file "f8937e53-d444-4e71-9275-35b64210cc3b" in the project file requires Visual Studio to look at the HKCR \ TypeLib registry key. It will not be present until the COM component is registered. Yes, Regsvr32.exe is generally better to use the component installer.

I had to change the Embed Interop Types property to false



This is because you used AutoItX3Lib.AutoItX3Class

in your original code. It is a synthetic class that is generated from a type library, making COM components that implement multiple interfaces a little easier to use. However, such a synthetic class cannot be inlined, so you had to set the property to false. A simple workaround for this is to omit the "class" from the type name, so you only use the interface. Fix:

    static AutoItX3Lib.AutoItX3 au3;
    ....
    au3 = new AutoItX3Lib.AutoItX3();

      

+2


source







All Articles