Microsoft Communication control 6.0 - visual-c++

Hello previously i was using VC++ 6.0 and MFC where i used Microsoft Communication Control 6.0 for serial communication its fine.But now i am using vc++.net 2003 and MFC, i added Microsoft Communication Control (MSComm1) but in class view there is no CMSComm class will creating . But in VC++ 6.0 if i add the this ActiveX Control.The CMSComm class will created by default where i can call member functions like SetPortOpen() , GetPortOpen() .
so any body tell me how to insert the MScomm control along with class.
Thanks in Advance

You may be having problems because this Microsoft update set the ActiveX killbit on the control. It will no longer function. MS suggests that we use a newer version of the control or the API.

EDIT: I did this with VC# and am not sure if the steps are the same with VC++. I need to install it and try it before providing a better response.
Since serial port support wasn't added to .Net until version 2.0 I had to do the same thing for .Net 1.1 apps. In my project I added a reference to MSCommLib and added the MS Communications Control, version 6.0, to my toolbox. After dragging one onto the form I was able to program against it. You should also have a reference to AxMSCommLib, AxInterop.MSCommLib.dll (COM interop not port).
Sorry, I opened the project and can't find a way to add it to the Class View, but once you have a reference and create a variable like "private AxMSCommLib.AxMSComm com;" you can use the intellisense to see the methods and members of the object.
You can also see these with the Object Browser. If you have the reference set, open the object browser and then click on AxMSComm. All of the members should be listed in the pane to the right side. There isn't much help for how to use each of the members here.

Related

ActiveX control '{XXX-XXX}' is not registered in this computer. Register the control and try again

While migration of old application, which built on VC6.0 framework. I am getting below error message when I tried to open Dialog box from Resource View windows.
The ActiveX control 6262D3A0-531B-11CF-91F6-C2863C338E30', is not registered on this computer. Register the control and try again.
Please suggest step to open the dialog. (Dialog having ActiveX control, which is absolute in latest window OS i.e. Window 10/11)
I tried to find ActiveX components on MS site, but no luck.
Two possibilities come to mind after you have ruled out that this is a standard Microsoft component:
It might be that this is a 3rd party component someone once bought. Look for an .ocx that might be present in the project files in a 3rd party folder. It could help, if you disclose the relevant lines in the resource file, so people have the chance to identify the component and with some luck tell you where you could get it.
There is a chance that this is a custom-made component: Look for a subproject and build it.
In any case register the component before use, for example regsvr32.exe path\to\your\component\the_comp.ocx. (On a 64-bit Windows, you might want to use C:\Windows\SysWOW64\regsvr32.exe, suppose this is a x86 project.)

.NET Core / .NET 6: Creating a TLB or DLL that can be added as reference in VBA

I am trying to do basically what it says in the title: I have created a class library (dll) using .NET 6.0 and I would like to add that as a reference in an Excel/Access VBA document. I diligently followed the steps here:
https://learn.microsoft.com/en-us/dotnet/core/native-interop/expose-components-to-com
No matter what I try, I cannot add the resulting dll as a reference in Excel. I just keep getting the message: 'Can't add reference to the specified file'.
A bit more info: I am able to create the Assembly.comhost.dll file, and I think I have done everything correctly, but no joy.
This is rather frustrating, as doing this in .NET Framework is but a click of a couple of checkboxes. In .NET Core (.NET 6) It seems to be a bit of a nightmare. Also, being able to create a tlb from the dll was always a perfect confirmation that you would be able to add your reference in Excel.
ANY help is most welcome!
Thanks!
in the tutorial you hav ementioned, ther is a topic "Register the COM host for COM". here a file named "ProjectName.comhost.dll" is used to register the assembly to the registry as a COM type library.
After doing this, i could the assembly in VBS with the fowing conde:
set projectObject = CreateObject("ProjectNamespace.ProjectClass")
newValue = projectObject.ComputeNewValue("abc")
Right now, I was not able to establish a reference to that type library in my Excel 2016, but the code sample works in VBA as well.
I could also in VBA
Set projectObject = CreateObject("COMServer.Server")
MsgBox projectObject.ComputePi()
with this repository : https://github.com/dotnet/samples/tree/main/core/extensions/COMServerDemo
But that works only with Registered COM not with RegFree COM (Go check README).
Not every component is a suitable candidate for use under Reg-Free COM. A component is not considered suitable if any of the following are true:
The component is an out-of-process (ActiveX EXE) server. Only DLLs
are supported.
The component is a system component or part of the operating system,
such as XML, Data Access, Internet Explorer, or DirectX® components.
For example, you should not attempt to isolate components such as
Microsoft XML (MSXml.dll) or Microsoft Internet Controls
(SHDocVw.dll). These components are either part of the operating
system, or can be installed with a separate redistributable package.
The component is part of an application, such as Microsoft Office.
For example, you should not attempt to isolate components such as the
Microsoft Word Object Model or Microsoft Excel Object Model. These
two components are part of Office and can only be used on a machine
that has the full Office product installed on it.
The component is intended for use as an add-in or a snap-in, such as
an Office add-in or a control in a Web browser. Such components
typically require some kind of registration scheme defined by the
hosting environment that is beyond the scope of the manifest itself.
The other problem is an arbitrary application may not be designed to
recognize isolated components, as it probably doesn't have a way to
reference your component through a manifest.
The component manages a shared physical or virtual system resource.
For example, it could manage some kind of data connection shared
between multiple applications or a device driver for a print spooler.
Source : https://social.msdn.microsoft.com/Forums/en-US/cc08575d-3506-4a0f-a9e2-f23c2162ad38/using-net-excel-addin-with-registrationfree-com?forum=innovateonoffice
But I couldn't find a way to add it in Excel as a reference.

Create a universal custom control

Hi I created one app that show you all your devices in your network. I would like to encapsulate all this code and controls in one "custom control" for use it in others apps.
I only find information about WPF custom controls, however when I tried to create a WPF custom control and then reference it to my Universal App, I got an error. I have searched about it and It seems that you can't use WPF controls in Universal Apps.
My idea is create something like "NetworkDevices", then I would put in my Universal App Main XAML:
<NetworkDevices Property1= .. Event1=........ ></NetworkDevices>
and then I would have my custom control embebed in my Universal App.
Thanks for your time.
Update:
Visual Studio Solution and the error
What you need is a Templated Control in a Universal Windows class library (so it can be reused in other apps).
I suppose you know how to do the rest (as you've created WPF custom controls, but as a reference you can use this MSDN article as well to guid you through step by step.

Are Windows Security hide some methods from .NET classes?

I'm working under windows Server 2008 :S
with restricted user not administrator.
using Visual Studio 2010
I try to run write this code
ApplicationClass app = new ApplicationClass();
Workbook book = app.Workbooks.Open("");
Worksheet sheet = (Worksheet)book.Worksheets[1];
Picture pict = sheet.Pictures(pictureName) as Picture;
Pictures() method not exist in sheet object !
But
When I try this code under windows 7 with Administrator user
The Picture() method is exist and every thing is OK
I wonder, if there is some thing with interop and windows security ?
If you visit the MSDN page for this, I can see two issues:
http://msdn.microsoft.com/en-us/library/microsoft.office.tools.excel.worksheet.pictures.aspx
This API supports the Visual Studio infrastructure and is not intended to be used directly from your code.
Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
It seems the reason is indeed a restricted user. Is there a reason you are using this API since documentation suggests that it should not be used directly. Perhaps you are missing a wrapper.

How can I add a ribbon menu to an existing MFC application?

Microsoft Visual C++ 2008 Feature Pack has ribbon menu support. Is it possible to make use of that in an existing MFC application that was not created with a ribbon menu?
It certainly is possible to take an existing MFC application and update it to use the ribbon in the MFC Feature Pack, and I've done this myself.
There are a couple of walkthrough articles on MSDN here that show how to do it, using the Scribble MFC sample application that you may be familiar with.
In essence, what you need to do is change your code to use the Feature Pack base classes instead of the standard MFC base classes - for example, replace CWinApp with CWinAppEx, CFrameWnd with CFrameWndEx, etc. Then you can add CMFCRibbonBar and CMFCRibbonApplicationButton objects to your main window class to create the ribbon itself. To get started I'd suggest downloading the Scribble sample and following the walkthough articles.
I hope this helps!
In addition to the resources pointed out by ChrisN, I recommend creating a new MFC application that includes a ribbon and examining the generated code..
Yes, it is surely possible to use the ribbon classes provided with the MFC Feature Pack.
A basic introduction is available here: Quick Tour Of New MFC Functionality and a more detailed tutorial can be found here: MFC Feature Pack Tutorial.
However, be aware that there is a rather strict license attached to it. For the conditions see Licensing the 2007 Microsoft Office User Interface and this related discussion on SO.

Resources