|
Hello.
I have a forms application in C# and Visual Studio. Tis app interacts with Excel and is workin fine.
I installed the executable and the configuration file in another computer and whe the app calls excel I received a message stating that a library was not registered. The error message says that it's not possible to convert a COM object type 'System.___ComObjet' into the interface 'Microsoft.Office.Interop.ExcelApplication'.
Does anyone know what to do to correct it? Which DLL should be copied too?to correct it? Which DLL should be copied too?
|
|
|
|
|
Perhaps you're suggesting that in order to run your app on a computer that does not have VS installed, copy the C:\Program Files\Microsoft Visual Studio #.0 (your version)\VC\redist content to that computer. Just a thought. If the app runs then ytou can start worrying about whether this is legal or not.
Lookup MSVCR and where to download it from Microsoft. That should do it.
[EDIT POST 16pt hit]
You mention a library ... what library?
[/EDIT]
modified 26-Aug-21 12:16pm.
|
|
|
|
|
It means that the system does not have the Interop.Excel libraries installed. As far as I am aware you can only get these by installing a legal version of Excel on the system.
|
|
|
|
|
Hi, Richard. The excel is legal. So, what should I do? Which files should I copy?
|
|
|
|
|
The interop libraries should be installed automatically with Excel. On my system I have the following:
Microsoft.Office.Core: C:\WINDOWS\assembly\GAC_MSIL\Office\15.0.0.0__71e9bce111e9429c\Office.dll
Microsoft.Office.Interop.Excel: C:\WINDOWS\assembly\GAC_MSIL\Microsoft.Office.Interop.Excel\15.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.Excel.dll
The versions on your system may be different, but the dll files should still be there.
It would also appear that Microsoft make them available for download at Download Microsoft Office 2010: Primary Interop Assemblies Redistributable from Official Microsoft Download Center[^].
|
|
|
|
|
Richard.
Ok, I found these files in my computer. Now I will see if they are in the other computer.
Thanks.
|
|
|
|
|
Richard.
I checked the other computer and those files are there and are the same. I don't know what to do. If you have any suggestion, I would appreciate it.
|
|
|
|
|
Sorry Ismael, I have never encountered this problem, so I have no suggestions. You could try a Google search, or one of the Microsoft support sites.
|
|
|
|
|
No problem, Richard. You've helped me anyway. 
|
|
|
|
|
What version of Office is installed on the other computer?
|
|
|
|
|
It's version 2013. Do you think it makes difference?
|
|
|
|
|
You have to have Microsoft Excel, or Office, installed on the machine. Interop doesn't mean you get the functionality without the app. It means it's an "interoperability" interface between your app and the app you're trying to use in it, like Excel.
|
|
|
|
|
|
Try reinstalling Excel on the problem machine.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
We just change netcore to framework and it works
Hello,
We have a WS, if you go to server you can run it and see the 2 methods, you can invoke then and WORK
If you go to Visual Studio 2019 and add a reference to the project using the: http://xxx.xxx.xxx.x/wsxxx/wseps.asmx?wsdl you can see the method and add to the project:
But when we try:
ServiceReference1.WPSSOAPCLIENT oClient= new ServiceReference1.WPSSOAPCLIENT()...
1. The new ServiceReference1.WPSSOAPCLIENT() is marked as an error.: Does not contanins a constructor that take 0 argument
modified 24-Aug-21 10:16am.
|
|
|
|
|
So take a look at the new constructor. The error is really self explanatory, so follow the instructions and see what constructors are available now.
|
|
|
|
|
I have such a clicker, I want to be able to continue, for example, after opening another application, or vice versa. Please help
All code here:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Klikacz____TzPw
{
public partial class Form1 : Form
{
[DllImport(dllName: "User32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
public static extern void mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo);
private const int LEFTUP = 0x0004;
private const int LEFTDOWN = 0x0002;
public Form1()
{
InitializeComponent();
this.ActiveControl = button1;
button1.Focus();
}
private void Click_clock_Tick(object sender, EventArgs e)
{
Random rnd = new Random();
int maxcps = (int)Math.Round(1000.0 / (trackBar1.Value + 0 * 0.2));
int mincps = (int)Math.Round(1000.0 / (trackBar1.Value + 0 * 0.4));
try
{
Click_clock.Interval = rnd.Next(mincps, maxcps);
}
catch
{
}
bool mousdown = MouseButtons == MouseButtons.Left;
if (mousdown)
{
mouse_event(dwFlags: LEFTUP, dx: 0, dy: 0, cButtons: 0, dwExtraInfo: 0);
Thread.Sleep(millisecondsTimeout: rnd.Next(1, 6));
mouse_event(dwFlags: LEFTDOWN, dx: 0, dy: 0, cButtons: 0, dwExtraInfo: 0);
}
}
private void button1_Click(object sender, EventArgs e)
{
if (button1.Text.Contains("Uruchom"))
{
Click_clock.Start();
button1.Text = "Wstrzymaj";
}
else
{
Click_clock.Stop();
button1.Text = "Uruchom";
}
}
private void trackBar1_Scroll(object sender, EventArgs e)
{
CPSValue.Text = "CPS = " + trackBar1.Value.ToString();
}
}
}
|
|
|
|
|
1) you can keep things in your app running, whether or not your app is the current active application, by using a Timer, or having a some form of 'while loop. advice : don't use a 'while loop.
2) when your app is not active ... it can still get messages by using a GlobalKeyBoardHook it defines, and registers, that intercepts some keyboard combination of keys. warning: you override some other app's keyboard hooks, and you are in trouble.
I believe what you probably need to use is the SystemTray app model, and CP has several articles that will show you how to use that: [^]
However, if what you want is some kind of stealth monitoring app: you won't get help with that here.
«The mind is not a vessel to be filled but a fire to be kindled» Plutarch
|
|
|
|
|
Just had one of those moments where I thought I was going mad. I had put a method implementation in an interface (not quite sure how I got there) and not only did the compiler not complain, it actually worked. After several minutes questioning my sanity, I recalled something new in the language about this, and it turns out its C#8 'default implementations' or some such.
Thus the central tenet of an interface 'can't contain an implementation' is gone, well sort of. I think its probably the case that the source can contain an implementation, but its just lifted into the implementer by the compiler, which I guess creates a type of static polymorphism. Haven't actually read about it too closely so that might be wrong. There certainly seems to be parallels to a virtual function. I really feel I need to sit down and think out my understanding and implications of all this now.
It warrants the question whether they are messing with the language too much? As it turns out this feature is of use to me if I don't think about it too much, allowing me to provide a simple helper property which just combines other properties, but it seems an interface is just that bit closer to an abstract class now.
I have to say these updates to the language generally aren't met with pleasure by me. They're just more things I feel I need to keep on top on rather than things that actually make my life easier. Old dog maybe, I still haven't got over extension methods yet!
Regards,
Rob Philpott.
|
|
|
|
|
Yes, default interface methods look like a complete mess to me:
Interfaces can now include static members, including fields and methods. Different access modifiers are also enabled. The additional fields are private, the new method is public. Any of the modifiers are allowed on interface members.
Thankfully, it's restricted to .NET Core 3.0 or later. With no SSRS support in .NET Core / .NET 5, we're sticking with .NET Framework 4.8, so our interfaces shall remain untainted by this abomination.
If you're interested, Matt Warren digs into the low-level "behind the scenes" details here:
Under the hood of "Default Interface Methods" · Performance is a Feature![^]
Oh, and things are set to get even worse in C# 10:
[Proposal]: Static abstract members in interfaces · Issue #4436 · dotnet/csharplang · GitHub[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
static members as well?? Well, at this point that makes entirely zero sense to me. Oh, the horror..
Regards,
Rob Philpott.
|
|
|
|
|
God what a dogs breakfast
"I didn't mention the bats - he'd see them soon enough" - Hunter S Thompson - RIP
|
|
|
|
|
Interfaces are somewhat lame, but needed; extensions work here and there; inheritance is "bad". I think it provides some middle ground.
If it avoids having to implement every interface member, all the time, that's good too.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
using Framework 4.8, WinForms (classic).
I'm doing some complex run-time stuff with a TableLayoutPanel in a UserControl ... adding, replacing Controls, resizing columns, changing ColumnSpans ... even though the UserControl is double buffered, as well as its hosting Form (site) ... the usual bracketing in Suspend/Restore-Layout blocks does not prevent cascades of spastic stuttering.
But, one little dose of good old CreateParams
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ExStyle = cp.ExStyle | 0x2000000;
return cp;
}
} I thought that had gone extinct with other VB-heritage dinosaurs like 'DoEvents.
«The mind is not a vessel to be filled but a fire to be kindled» Plutarch
modified 18-Aug-21 2:05am.
|
|
|
|
|
Yeah, I've had to use it occasionally as well: Disable the Close box on a form[^]
But ... at least MS provided a nice, easy way to do something they didn't think you'd ever want to!
If they hadn't ... it would have been a real PITA.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|