I have an application developed in C Sharp, which is executed in QTP but i get the following error:
Cannot identify the object "2" (of class WinObject). Verify that this object's properties match an object currently displayed in your application.
Can anyone help me resolve it?
If the application is developed in C# make sure you have the .NET addin loaded, then the object should be SwfObject rather than WinObject.
In any case use the object spy to point at the control you think should match the test object in the test and see how its properties differ (you can also use the update from application button from the object repository).
Related
<--------------EDIT:-------------->
I can't use Windows.System
That assembly (and associated classes and namespaces) are for Windows Store apps only.
You cannot use them in a standard C# project.
Reference on MSDN.
Also, the first part of the question has been answered:
If it sounds simple, it is.
Process.Start("ms-settings:SomePage");
So, now the question is, how do you get that to launch inside the WPF Page/Window?
<--------------/EDIT-------------->
I am using Visual Studio 2015 to develop a WPF application. I'd prefer to use C# to launch the ms-settings:whatever page.
Ok, so I'm trying to follow the directions listed HERE on msdn.microsoft, but the assembly they reference "Windows.System" doesn't seem to exist. 0.o
"System.Windows" exists, but it doesn't contain Launcher.LaunchUriAsync...
Below is the snippet of code on that page:
using Windows.System;
...
bool result = await Launcher.LaunchUriAsync(new Uri("ms-settings:privacy-webcam"));
So the question is, what am I missing? I'm pretty sure something is flying way over my head and I can't seem to see what is.
Bonus points if you know how to get the ms-settings app to open inside the WPF page, although I'm pretty sure that isn't reasonably feasible.
It seems that Windows treats the ms-settings:... syntax as URI. So, you should be able to open it in the default browser just as you would open any other URI from within C# code:
System.Diagnostics.Process.Start("ms-settings:privacy-webcam");
However, I'm not sure how older versions of Windows (which don't know the ms-settings:... syntax) react to that...
Damn, well I found why I can't use Windows.System
That assembly (and associated classes and namespaces) are for Windows Store apps only.
You cannot use them in a standard C# project.
Reference on MSDN.
I have a need to record parameter values of methods been called with in application. A kind of log.
I don't want to touch the code of the running application dll, by adding a row in each method to log it.
Is there any way I can some kind mechanism to capture input/ouput paramert values, by inserting logger code into the dll without touching the main source code? i am trying to achive this in C#
You will achieve this by using AOP. Refer this link for more information.
Also have a look into this stackoverflow link.
I have a problem/question with some basic stuff.
I have interoptoolkit v2.1 installed and I am trying to create this form in vs 2008 with C# so this form can be accessed from a vb6 application.
I am trying to add a public property on this form, so I am thinking I am supposed to add this
[interopformproperty] above the property.
But when I do this and try to generate the wrapper using the option under Tools menu, it doesn't generate the wrapper.
I obviously searched google for a while but I couldn't find something particularly helpful.
So if you know anything about this, please give us hand.
Thanks a lot in advance. Cheers.
If the com visible type implements an interace, all the public methods, properties are com visible, provided that the types uses in their signatures are com visible. If the com visible type implements multiple interfaces, the first one (in the class definition) is used as the com interface. This behavior can be changed using the ComDefaultInterfaceAttibute.
If an interface is not implemented, all the public properties (that expose a com visible type) are automatically com visible.
regasm automatically generates a com inteface, containing all public methods/propties.
"Generating a wrapper" as you say... I don't understand this.
After compiling an assembly with com visible types register it using regasm (if the option in project properties "Register for COM interop is not active).
I always end up answering my own question :D
I am doing this just in case someone else get on this.
Go to this link and download the 2nd file.
C_Interop_Form.aspx">http://www.codeproject.com/KB/dotnet/VB6_-C_Interop_Form.aspx
Assuming you are using vs2008. Get the dll file, and the add in file.
and copy this file into My documents -> visual studio 2008>addins
Open up the addin file with notepad, and change the version number 8.0 -> *
Now save it. and reload vs2008. It should generate the wrapper file in C# instead of vb.
P.S, reading the comment of the post always helps :D
I use the WebBrowser component from WPF. I load there a page from Internet and I access the Document property to call my scripts. Unfortunately calling scripts don't work as I need. When I am calling JavaScript methods which exist in JavaScript so it works great but when I need access some methods which are available through Flash so I have problems.
document.parentWindow.execScript("document.getElementById('swfObject').methodFromActionScript();", "JavaScript");
I get an exception in the browser Object doesn't support this property or method. In C# I get Exception from HRESULT: 0x80020101
But when I try launch this code in a regular browser as IE or Chrome by passing it into URL so the code is executed and I see results.
Maybe some trustmode issues or what else could deny access to Flash properties and methods?
BTW: The var allowScriptAccess is set to always.
Thank you for help.
Ok, I've found an issue. Before this execScript. I was doing some modification of DOM and moving elements and apparently this has broken DOM so I couldn't call swfObject because during moving it was somehow modified and lost its properties and methods which were exported via ActionScript.
We had a bit of a problem where we have lost some source code for a very old ActiveX component we had. We've got a Delphi7 program that calls the Active X component. Thats a bit of a moster and can't be changed too much. However, some of the functionality in the Active X component needs to be updated. Since we've been moving our apps to C#, its been decided to redo the ActiveX as a C# class library.
I've got a basic C# class library working to prove the concept. I can hack the GUIDs and registry so it just looks liek the old one. If I look at the type lib for the old one and the new one, they are basically the same. Couple of slight differences but not anything i would have thought would be a problem.
Now as far as I can see there are three ways to use the new class library:
Late binding by looking up the ProgId. This works ok.
Import the type library. (Project| Import Type Library) This works ok.
Import as an ActiveX component. This generates a tlb file. This doesn't work. When I go to create the component I get 'No such interface exists'. The class is loading to a point but not completely.
Now unfortunately, the Delphi program is using option 3. So I have to try to get my class library working in this circumstance. Any ideas how I get past that error? I googled and found some references but nothing that says what the problem is.
Second question. I should know how to do this since I've done it once but I seemed to have fluked it. When I am in Delphi I do an Import ActiveX component to generate a TLB file. Now the first C# class library generated is showing up in the list of ActiveX controls and I can Create Unit for it. But I've created another simplier class library for testign purposes and damned if I can get the library to show in the list of ActiveX controls and so I can't import it.
The Create Unit for the Active X component generates a different format of TLB.pas to the Import Type Library format and its the ActiveX one that I require.
An ActiveX Control does way more then just implementing your interfaces. It is more like an TComponent or TWinControl. It requires you to implement a lot more ActiveX Control interfaces. Your C# object exposed through COM/ActiveX is not a Control, but a simple class.
It does not show up in Import ActiveX Control since it is not an ActiveX Control. I do not think it is feasible to make your C# class an Active Control.
Another possibility, although probably not the most elegant, would be to create a new ActiveX com object in Delphi which in turn calls your C# class by either method which you already have working.
Since you stated that this is for an existing Delphi 7 application, you might want to just use Com Interop on the C# side, expose the object as com visible, and the consume it directly from your Delphi 7 application.
The first option would probably allow you to get by with minimal changes to your existing application, but does add an additional layer that most likely is not necessary.