|
Apologies for the shouting but this is important.
When answering a question please:
- Read the question carefully
- Understand that English isn't everyone's first language so be lenient of bad spelling and grammar
- If a question is poorly phrased then either ask for clarification, ignore it, or mark it down. Insults are not welcome
- If the question is inappropriate then click the 'vote to remove message' button
Insults, slap-downs and sarcasm aren't welcome. Let's work to help developers, not make them feel stupid.
cheers,
Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
|
|
|
|
For those new to message boards please try to follow a few simple rules when posting your question.- Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
- Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
- Keep the subject line brief, but descriptive. eg "File Serialization problem"
- Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
- Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
- Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
- If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode "<" (and other HTML) characters when pasting" checkbox before pasting anything inside the PRE block, and make sure "Use HTML in this post" check box is checked.
- Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
- Please do not post links to your question into an unrelated forum such as the lounge. It will be deleted. Likewise, do not post the same question in more than one forum.
- Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
- If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
- No advertising or soliciting.
- We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
cheers,
Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
|
|
|
|
I'm currently working in the development team, we both work from home as the epidemic is serious outside. But we just found it is harder to collaborate efficiently than we work together at the workplace. Any useful tools for us to collaborate on developing projects during remote work?
|
|
|
|
|
Does this have anything to do with COM?
|
|
|
|
|
Someone still remembers the COM Compound File Binary format? Microsoft used to store their office files in this format. It is a great format, providing a FAT-like file system within a single file, via storages (directories) and streams (files).
Microsoft's attempts to port Structured Storage technology to .NET were... sloppy, to put it friendly. For instance can you define sector sizes not only of 512 bytes, but also of 4,096 bytes. You can instruct the .NET code to use 4k, but when it doesn't work and you dig into the reference source you'll find, that they accept and comment on the argument, but do not use it. At all.
I created a fully functional wrapper from scratch. It took some weeks to get this one right, but I'm glad to share the heavily documented results with you.
Google Drive: Google Drive[^] (Rev. 4354)
Chapter 4.5 (marginal notes 662 ff.): Structured Storages (byte access only as in the original)
Chapter 4.6 (mn. 1124 ff.): General Structured Storages (added support for strings and all value types)
Let me know what use you make of it. General design reviews are welcome.
If there's a better forum, please let me know. I'm new here (SO refugee).
|
|
|
|
|
Been programming for too long, but always wanted to understand how to call
a COM object from within a win32 c application.
So I'm starting here hoping for some guidance.
Although I have VS 2008, I would like to do this in Codeblocks.
The COM object I want to use is for Sage 100. I currently load the COM object using Lazarus (DELPHI) like so:
unit header_boi.pas
const
boi_so_err = 1;
boi_data_path = '\\MM-2012-MAS-DEV\Sage\Sage 100 Advanced ERP\MAS90';
boi_script = 'ProvideX.Script';
boi_session = 'ProvideX.PvxDispatch';
unit boi_api.pas
hboi_script := CreateOleObject(boi_script);
In C, it is my understanding, I need to use CoCreateInstance?? Is this correct?
Problem is, I just don't know.
I have lots of books, but would love some guidance.
Best in 2021, Good karma promised.
Bret
|
|
|
|
|
|
How to get header and footer value in MS Project file format(.mpp) using office interope (C#)
modified 30-Jun-23 18:44pm.
|
|
|
|
|
Who would've thought? Of all the things to ask of a project file.
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
|
|
|
|
|
|
I have a type libray xxx.tlb which is used without any problem in vb6, now when trying to use it in .net i import it by using the tlbimp utility, aparently it works fine except that the functions are not seen anywhere, just the enums. Ive never worked on this before so im a total ignorant of the matter. I would appreciate any help , i could also give more info if required, thanks
|
|
|
|
|
Which library? Can we reproduce it on our machines?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
sir how to serial key match pc serial no.?
how to my excel softwar license key version created?
please helpme.
|
|
|
|
|
We cannot tell you, even if we knew and wanted to: that is proprietary to Microsoft and is part of a legitimate security system. We do not help people to bypass legitimate security and the information could help with that. There is no legitimate reason that you need to know the information!
And please, if your message does not appear immediately do not repost it: both of these went to moderation because the automated system wasn't sure they should be allowed through. I've deleted the spare, but reposting increases the likelihood that more of your messages will be captured, not lessens it.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Boy this place is a ghost town! I guess everyone already knows everything about COM, and so doesn't need to ask any questions.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Or the silly buggers still working with COM haven't worked out there is a forum for that and continue to ask in VB/C# forums.
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
Now, we have a hsajet printer system for control and printing barcode. So i want to write a new application to control it.
I try find document to program but it not foud.
I want everyone help me.
And this is my document of hsajet that i find it on website. I dont know it is correct or not correct.
hsausa.com/Downloads/Manuals/HSAJET_CU_REMOTE_PROTOCOL_2011_03_01.pdf
Please help me.
|
|
|
|
|
Sorry, but this site does not provide code to order.
|
|
|
|
|
Hey Everyone, I have been searching the web for days to try and find a potential solution to my problem, and so far I have only gathered bits and pieces of a potential solution. I need to be able to make API calls to a CAD program from an Excel macro. The CAD program is called NX. It was developed by Siemens. They have an API called NXOpen that was written in VB.NET. I have tried referencing the appropriate DLL in Excel, however the DLL is not registered and nor can it be in my limited development environment. I do not have registry access. If I am able to pull this off I would like to distribute the workbook to my co-workers as well.
So I have been exploring the possibility of using Registration Free COM in Excel 2010 (Windows 7 64 bit) to make the API calls I need from Excel. To try and do this I was going to use the following code to instantiate an object that points to the manifest for the NXOpen.dll file. I want to access a subroutine in the DLL called "Highlight". Also, from what I have read I will also need the dlls CLSID to reference in the manifest as well. That I don't know how to get. Any help would be very appreciated. Thank you.
Sub EXCELNX()
Dim actCtx As Object
Set actCtx = CreateObject("Microsoft.Windows.ActCtx")
actCtx.Manifest = ThisWorkbook.Path & "\NXOpen.dll.manifest"
Dim myNX As Object
Set myNX = actCtx.CreateObject("Highlight")
End Sub
|
|
|
|
|
If the API was written in .NET, it might not be exposed as a COM library. There are specific steps you have to take to make that happen:
Exposing .NET Components to COM[^]
If there isn't a COM API available, you have a couple of choices. You could write your own wrapper API in .NET, and expose that wrapper as a COM-callable library. Or, you could use VSTO to write a .NET Execl add-in[^], and call the API from that.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Okay, so if I create my own Library exposing the .NET calls to be consumed in VBA I can reference this Library in Excel? I have Visual Studio so I can build DLL files and anything that does not require installation (or registry access) to run. If I can consolidate the functionality to an Excel workbook that would be great. Which is why I was thinking of Reg Free COM. How can I call the Library in Excel VBA?
Edit: I can't build executables either. IT is picky about what we can and cannot do. However Excel is free game.
|
|
|
|
|
Yes, if you follow the instructions in the article I linked to, you can create your own .NET library to call the API, and then call that as a COM component from Excel.
Or you could use VSTO to create an Excel add-in or workbook with .NET code running behind it. But it sounds like you might be locked out from doing that as well.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hello, in the article you linked in your post, there are two different GUIDs. What are the differences in the 2, and which ones should I be using?
Also, in the article to call the COM object he was able to reference the COM wrapper class built to expose the .NET calls to VBA in Visual Studio. I am trying to do this in Excel, where I can't simply reference the dll. Can somebody tell me how I can call COM objects in Excel? Here is my code for the COM Wrapper Class:
Imports System
Imports System.Collections.Generic
Imports System.Runtime.InteropServices
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.Assemblies
Namespace ExcelNXInterface
<Guid("bbe0089d-a732-4743-922b-180b30006fa4"), _
InterfaceType(ComInterfaceType.InterfaceIsIDispatch)> _
Public Interface _ExcelNXInterface
<DispId(1)> Sub HighlightCompTag(ByRef tag As Long)
<DispId(2)> Sub Echo(ByVal output As String)
End Interface
<ComVisible(True)>
<Guid("975DC7E0-4596-4C42-9D0C-0601F86E3A1B"), _
ClassInterface(ClassInterfaceType.None), _
ProgId("ExcelNXInterface.Open")> Public Class ExcelNXInterface
Implements _ExcelNXInterface
Public _ExcelNXInterface
Dim theSession As Session = Session.GetSession()
Dim ufs As UFSession = UFSession.GetUFSession()
Public Sub HighlightCompTag(ByRef tag As Long) Implements _ExcelNXInterface.HighlightCompTag
Try
ufs.Disp.SetHighlight(tag, 1)
Echo("Component(s) Highlighted...")
Catch e As NXException
Echo("NX Exception is: {0} " + e.Message)
Catch e As Exception
Echo("Exception is: {0} " & e.Message)
Echo("DONE!" & vbLf)
End Try
End Sub
Sub Echo(ByVal output As String) Implements _ExcelNXInterface.Echo
theSession.ListingWindow.Open()
theSession.ListingWindow.WriteLine(output)
theSession.LogFile.WriteLine(output)
End Sub
End Class
End Namespace
Here is the manifest I built to reference in Excel:
="1.0"="utf-8"
<asmv1:assembly
manifestVersion="1.0"
xmlns="urn:schemas-microsoft-com:asm.v1"
xmlns:asmv1="urn:schemas-microsoft-com:asm.v1"
xmlns:asmv2="urn:schemas-microsoft-com:asm.v2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<assemblyIdentity
type="win32"
version="1.0.0.0"
name="ExcelNXInterface"/>
<clrClass
clsid="{975DC7E0-4596-4C42-9D0C-0601F86E3A1B}"
progid="ExcelNXInterface.Open"
threadingModel="Both"
name="ExcelNXInterface.Open">
</clrClass>
<file name = "ExcelNXInterface.dll"></file>
</asmv1:assembly>
Here is the VBA code I am using to try and call the COM objects in Excel's IDE:
Sub ExcelNX()
Dim actCtx As Object
Set actCtx = CreateObject("Microsoft.Windows.ActCtx")
actCtx.Manifest = ThisWorkbook.Path & "\ExcelNXInterface.dll.manifest"
Dim myNX As Object
Set myNX = actCtx.CreateObject("ExcelNXInterface.Open")
End Sub
So far I am getting an error stating "Method 'CreateObject' of object IActCtx' failed" when it attemps to run this line of code:
<br />
Set myNX = actCtx.CreateObject("ExcelNXInterface.Open")<br />
The DLL I built to expose .NET calls to VBA, the Excel Workbook making the VBA calls and the Manifest are all in the same directory.
Any help or guidance is appreciated. Thank you.
modified 19-Oct-16 12:05pm.
|
|
|
|
|
Obviously, you need to create your own Guids.
I believe you'd use the Guid from the IDispatch interface, but it's a long time since I've had to touch COM at that level.
Member 12336929 wrote:
progid="ExcelNXInterface.Open"
Set myNX = actCtx.CreateObject("ExcelNXInterface.Open")
That doesn't seem to match the name of the class you created. Did you mean to use ExcelNXInterface.ExcelNXInterface instead?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Okay, based on some other examples I found online I saw that some people used the progid in the manifest. I wasn't sure why, but I just followed the examples. So I went ahead and tried using your suggestion. This time around I got another error, but it seems much friendlier (maybe).
It says "ActiveX component can't create Object". So maybe using ExcelNXInterface.ExcelNXInterface was the way to go, even though it still isn't working. It seems better than the error saying the Create Object Method Failed.
Anyway, I am pretty much lost from here out. Not sure what else can be done. I have seen in other forums online that some people claim in order to pull this off you need to alter the Excel.exe.manifest file to point to your dll, and store the dll in the same folder as Excel's executable file. I'm hoping that isn't true.
|
|
|
|