|
In c++ you got ATL wich is a good way for developing COM objects
JO
|
|
|
|
|
C++ suport Pointer virtual mechanishm(Vtable),that ascpect will more help to develop COM application with efficent resource uses.
|
|
|
|
|
I’m using idl file to create COM Type Library,
Here is the idl:
import "oaidl.idl";
import "ocidl.idl";
[
uuid(71050F79-3FC6-4BCA-BC36-A79465500B71),
version(1.0),
helpstring("MyProj 1.0 Type Library")
]
library MyProjLib
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
importlib("..\Interfaces\Interfaces.tlb");
[
uuid(83BC908B-C13C-4D6A-B290-C97057ACEBC4),
helpstring("MyClass Class")
]
coclass MyClass
{
[default] interface IMyProjMessage;
};
};
In another project, I call the library with:
#import "..\..\MyProj\MyProj.tlb" raw_interfaces_only, raw_native_types, no_namespace, named_guids
Here’s the error I've got:
fatal error C1084: Cannot read type library file: '..\..\MyProj\MyProj.tlb': Error loading type library/DLL.
I am newer for com & activeX controls – can someone help me?
Many thanks,
S
|
|
|
|
|
Hello Sara123,
Make sure that any dependency TLB(s) (e.g. ..\Interfaces\Interfaces.tlb) is/are either registered, or it/they is/are in a path that is discoverable by the compiler (e.g. in the same directory as MyProj.tlb).
Hope this helps,
- Bio.
|
|
|
|
|
thank you so much of your briefly answer!
S
|
|
|
|
|
Hello Sara123,
No problem. But is your problem solved ? I suggest that your various dependency type libraries be registered. This way, the compiler will be able to refer to them when necessary.
- Bio.
|
|
|
|
|
You need to define your interfaces first with the associated uuid, fore example
import "oaidl.idl";
import "ocidl.idl";
[
object,
uuid(BB137454-1CB9-469b-A398-5BDB535A1920),
dual,
nonextensible,
helpstring("IMyProjMessageInterface"),
pointer_default(unique)
]
interface IMyProjMessage: IDispatch{
[id(1), helpstring("method Foo")] HRESULT Foo();
};
[
uuid(71050F79-3FC6-4BCA-BC36-A79465500B71),
version(1.0),
helpstring("MyProj 1.0 Type Library")
]
library MyProjLib
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
importlib("..\Interfaces\Interfaces.tlb");
[
uuid(83BC908B-C13C-4D6A-B290-C97057ACEBC4),
helpstring("MyClass Class")
]
coclass MyClass
{
[default] interface IMyProjMessage;
};
};
JO
|
|
|
|
|
oops sorry i didnt saw the importlib("..\Interfaces\Interfaces.tlb"); line, you should assert that MIDL can find the .tlb file
JO
|
|
|
|
|
Hello
Im Having some problems with a ocx file i got from the company im working with...
basically the control is working with winforms,but i dont want to use this control on a win forms, i want to use on a simple console app...
can someone guide me what to do?
this is the only code im using in win forms...
axVCLogAgent1.RecServerIPAddress = "172.20.1.189";
axVCLogAgent1.RecServerPort = 3001;
axVCLogAgent1.VL_connect_rec_server();
axVCLogAgent1.AgentID = UserProperties.AgentId;
axVCLogAgent1.Extension = UserProperties.Extension;
axVCLogAgent1.VL_log_in();
axVCLogAgent1.VL_start_record();
modified on Sunday, September 7, 2008 5:06 AM
|
|
|
|
|
This is an issue with the Threading Model.your ocx might have an ui, which the console cannot display.
if you are sure that does not have any ui, try registering with the COM+ and try to use from your console.
^-^
@|@
- redCat
|
|
|
|
|
Greetings to all,
My goal is to create an assembly that will allow me to print via the web directly from the Windows API, in order to make prints from any type of printer such as matrix (text mode) or others (mostly so graphic).
The problem is that the Internet Explorer (IE) recognizes and accepts the assembly set up. NET 2.0. The problem is knowing where lies the error, Below there's a brief explanation of what I have done:
I have a first project which is a class library of vb in this class is my impression that accesses the api, compiled this class and I have my first assembly. (LinePrinter.dll)
The second project is also a class library, but I have an UserControl in it because I need interaction screen in my constituent assembly to call the PrintDialog, the form has size 0px; 0px because the only thing that interests me is to show the dialog printing to choose the printer to use and then call the printing method, prior to that I refer to the assembled print (LinePrinter.dll). In this class you call PrintX in this class, which is as follows:
Imports System.Reflection
Imports System.Runtime.InteropServices
Imports Microsoft.Win32
Public Interface Printx
Sub texto(ByVal str As String)
End Interface
<comvisible(true)> _
<progid("imprimir")> _
<classinterface(classinterfacetype.autodual)> _
<guid("d6967c5a-22ee-484a-b2d6-9f90f54b85eb")> _
Public Class imprimir
Implements Printx
<comvisible(true)> _
Public Sub texto(ByVal str As String) Implements Printx.texto
If PrintDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
Try
Dim ln As LinePrinter.LinePrinter = New LinePrinter.LinePrinter(PrintDialog1.PrinterSettings.PrinterName)
ln.WriteLine(str, True)
ln.EndJob(False)
Catch ex As Exception
MsgBox("Error printin: " + ex.ToString())
End Try
End If
End Sub
End Class
Then I created a signature(.snk) assembly to each project, the snk was created from properties tab of the project "Signing the assembly" and i enable the COM visibility to the UserControl project.
Then compile and create a .CAB file to host both dlls.
HTML is composed this way:
<object id="MiPrintX" name="MiPrintX">
classid="clsid: D6967C5A-22EE-484a-B2D6-9F90F54B85EB" VIEWASTEXT codebase="../scImprX.CAB">
Testing in local network works perfectly if I upload my Web site as a secure site and lowering levels of security; but when a put it in production o a realintranet, I get a message saying that the ActiveX has no name and key safe.
Hope you can help me I'm in a big trouble
Thanks very much
LindaB
|
|
|
|
|
Hello,
Question about software and learning curve to create an addin for Office 2003.
I have an Access database of just words and expressions in two languages. I want to make an addin for Word 2003 that brings up a list of databases in a custom task pane, so that I can choose one and search it for matching terms, then be able to copy one of the results to an open word document. Being able to highlight text in the document and search that from the right-click menu would be nice, but is not necessary.
I really want to do this with freeware, but from posts here I think people usually use VC++ and Visual Basic 6, and they have a good handle on COM. If I purchase anything, including tutorials, it will be out of pocket.
My question is, what variety of software should I choose and, starting from scratch, how may hours would it take to go from zero to beta? This will be an in-house application. My programming experience is with Access VBA, only. Any advice would be appreciated. Cheers.
modified on Sunday, September 7, 2008 8:43 PM
|
|
|
|
|
When you do this kind of project (in any language), you are out of necessity dealing with Library dependencies, regardless of the resultant object structure. And, if you are totally inexperienced, you will find it insanely complicated. Keep in mind that the Office applications are linked to DLLs that are designed for automation and the type of extension or add-in that you describe. However, the existing object model that is implemented in the Office DLLs is by no means trivial or simple.
If you assemble your project within Visual Studio, you have a number of benefits, that as a novice you will find critical to your project's success. Visual Studio is designed for this kind of thing, provides an incredible quantity of documentation, and is optimized for Windows. But, most importantly, it has Intellisense, which can often show you just which interfaces are actually available once you reference the Office DLL.
Also, you might want to check out: Visual Studio Tools for the Office System[^]
|
|
|
|
|
Baltoro,
Hello. I'm very much obliged for your response. It seems clear now that, as a novice, I need a software that will help me. Really, if I tried it without that support, I'd probably spend more time on message boards and asking trivial questions than coding. The standard version of VS 2008 doesn't seem that expensive anymore, and it would be mine when it was all done.
Thanks again. I may also try to access that database with what I think is an asp.net server that is accessible through the research bar in 2003. There was an article about that on CodeProject. But if it ends up as an add-in, I'll just go VS.
Cheers - Hato
|
|
|
|
|
Hato,
With the Office DLLs, you need to understand how the various COM objects control other COM objects (there are hundreds of them); the sequence of function calls is critical. Otherwise, you do alot of coding, but, get just failing return values from your calls. Really, you need the documentation to help you code smoothly. The documentation explains the object model, and how the various COM objects relate to each other. The project is completely impractical without an understanding of how the exported COM objects work. Good luck.
|
|
|
|
|
Hi,
i am a a beginner at this....
my question is that ...From the client pc , how do i call or reference a .dll that sits on the server and get it to execute commands on the server.
sort of like it would do on the client pc.?
thanks in advance
Anoop
|
|
|
|
|
Have a dig at COM[^] section. There are quite a few articles , could help you.
|
|
|
|
|
vntFieldValue.vt =VT_VARIANT | VT_ARRAY;;
SAFEARRAY* psaOut;
psaOut =Segment->GetBlob(); // C# API return the byte() in the form of safearray
if(psaOut != 0)
{
SAFEARRAYBOUND aDim[1];
aDim[0].lLbound= 0;
aDim[0].cElements= psaOut->rgsabound->cElements;;
vntFieldValue.parray=SafeArrayCreate(VT_VARIANT,1,aDim);
SafeArrayCopyData(psaOut,vntFieldValue.parray);
}
pADORecset->Fields->GetItem(FLD_WBTRBSEG_SEGMENT)->PutValue(vntFieldValue);
The line in bold color throws an exception. Could you please help me in passing the variant safearraay to set the value for recorset parameter.
|
|
|
|
|
Have seen sample for using safearrays ?
There are quite a few on this site itself.
The bold line is having quite a few function calls, try to break it, and narrow down on function , throwing exception.
|
|
|
|
|
When I create an ATL project with appWizard in vs2005, the Dll generated by the code contains four export functions. They are :
DllCanUnloadNow PRIVATE
DllGetClassObject PRIVATE
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE
What are those functions for? And how to use them to implement the code? What's the differeces between this Dll and those normal ones(say win32 style dlls)? Seeking for help.
|
|
|
|
|
For detail information please read Gale Rogerson...
You will get all the basic updates about this...
shailesh
|
|
|
|
|
DllGetClassObject is how other code creates COM objects that are implemented in the DLL.
DllCanUnloadNow is called by COM to see whether the DLL can be unloaded from memory.
DllRegister/UnregisterServer are used in self-registration, where the DLL adds/removes the registry entries needed for it to be visible to COM.
Check out my Intro to COM[^] article for more details.
|
|
|
|
|
Hi,
I have created and maintain a VC++ .NET 2005 project that creates a dll for SQL server 2000/2005 extended stored proc.
For now it recomplies the source files(originally written in VC++ 6.0) but it required by me to use the existing COM dll written in VS6 from VC++ .NET 2005.
How can I call Com dll, written in VS 6.0, from VC++ .NET 2005?
Please feel free to ask any other info.
Thanks in advance for your help.
-Amit
|
|
|
|
|
It doesn't matter what compiler was used to create the DLL, you use the same APIs to call the COM server (CoCreateInstance() , etc)
|
|
|
|
|
I have ActiveX .ocx file registered,using "regsvr32 vid_NET.ocx"
I have another version of same ocx file and its GUID also same when i embedding it to my .Net application. I do it from editing <comreference block="" and="" guid="" of=".csproj" file.="" but="" that="" component="s behaviour is different. When i installed it to a fresh PC(newly installed XP) it is perfect.I want to embed it to my current project and run in same machine. What can i do for that?..<br mode=" hold"="" ><br="" mode="hold" >how="" can="" i="" remove="" all="" referance="" clear="" things.?="" <="" xml>"="">
|
|
|
|
|