|
Are we talking about COM as in COM1, COM2 etc or COM as in Component Object Model, or both?
|
|
|
|
|
Hi,
I would like to add some text in the cation of document. e.g. If I have a Test.doc then the caption for this document is Test.doc but I want to add some more text to it like "Mydoc" so the caption will become "Test.doc Mydoc". I know we need to change some registery entries but I want to change it for all office documents. Actually I m changing the extension of these documents as Test.gdoc so for all office docs with extension it should attach this caption.
Pls let me know that how could we achieve this.
Thanks
SNI
SNI
|
|
|
|
|
What if you handle the "Open" event for the Document object in "Normal.dot" and write code that looks like this?
Private Sub Document_Open()
If IsFileGDOC(ActiveDocument.name) Then
ActiveDocument.Windows(1).Caption = ActiveDocument.Windows(1).Caption & " - Ding"
End If
End Sub
Private Function IsFileGDOC(name As String) As Boolean
IsFileGDOC = False
If InStr(1, name, ".gdoc", vbTextCompare) Then
IsFileGDOC = True
End If
End Function To edit "Normal.dot" just open the VBA editor in Word and edit the code for the "ThisDocument" object in "Project Explorer" under the "Normal" document.
--
gleat
http://blogorama.nerdworks.in[ ^]
-- Number Two's eyes narrowed and became what are known in the Shouting and Killing People trade as cold slits, the idea presumably being to give your opponent the impression that you have lost your glasses or are having difficulty keeping awake. Why this is frightening is an, as yet, unresolved problem. -- HHGTG
|
|
|
|
|
I am using the VC 6.0 ocx in VB6.0
In this ocx I am firing the event in thread with long value as parameter.
There is only single thread.
I am getting the correct value in client(vb) application.
It's working fine when I am running it.
But when I tried to debug in VB application in event after pressing F8
application suddenly exits. But without threading it's I can debug also.
I could not get the problem. When I used try catch around fire event it gives exception as memory could not read.
Help me for this....
Thanks in advance.
|
|
|
|
|
chetanjoshi9 wrote: In this ocx I am firing the event in thread with long value as parameter.
There is only single thread.
....
But without threading it's I can debug also.
What does this mean? Are you creating secondary threads inside your ActiveX or not?
If you are firing events from a secondary thread, you have to initialize the new apartment with a call to ::CoInitialize() and marshal the event sink interface to the client from the apartment that created your server to the apartment with your secondary thread.
Another solution is to post a message to the thread that created your server and fire the event from there.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Hello,
I have created a C# DLL with two functions:
One function has two parameters: double, double
The other function has four paramters: double[], double[], double[], double[]
Using VB6, I can successfully call the first function. However, upon trying to call the second function, I get a compile-time error:
Function or interface marked as restricted, or the function uses an Automation type not supported in Visual Basic.
I need to pass arrays of doubles. How can I get the program to work? Any help is appreciated.
Regards,
Mike
|
|
|
|
|
The solution to get the VB6 program to compile is to use:
ref double[], ref double[], ref double[], ref double[]
for the parameters.
Regards,
Mike
|
|
|
|
|
Hi
I am working on DRM (Digital right management) and WMP (Window media player).
I added assembly Interop.WMRMOBJSLib.dll
While the code is executing this line then it throw the error
i.e.
Retrieving the COM class factory for component with CLSID {76FB40C2-7B90-402A-867D-73747BF85F48} failed due to the following error: 80040154.
Here I am mentioned the code.
-----------------------------------------------------------------------
WMRMOBJSLib.IWMRMChallenge objChallenge = new WMRMOBJSLib.WMRMChallengeClass(); //Instantiate challenge Object
objChallenge.Challenge = Request.Params["challenge"];
string varClientInfo = objChallenge.ClientInfo; //to retrive client information
string varHeader = objChallenge.Header; //to retrive the header information of the content
WMRMOBJSLib.IWMRMHeader objHeader = new WMRMOBJSLib.WMRMHeaderClass(); //to instantiate header object
objHeader.Header = varHeader;
string strContentID=objHeader.ContentID; //retrives the contentid of the file played
string indiVersion = objHeader.IndividualizedVersion;
//Report an error if ContentID not found in DRM headers
if(strContentID == null)
{
ReportError("Content not found.");
return;
}
//Get action currently performed
string action = Request.Params["action"];
-----------------------------------------------------------------------
In few article I read Class not registered.
I checked into regedit.
Here I mentioned used .dll
• Interop.LICENSESERVERLib.dll
• Interop.WMRMOBJSLib.dll
• MySql.Data.dll
So kindly suggest me, where is problem.
Its very urget.
Kindly reply me.
Thanks
Asit Sinha
Asit Sinha
|
|
|
|
|
Hi all,
Not sure if this is the right place to post but any help would be greatly appreciated
I've used the code from http://www.codeproject.com/KB/cs/adapterlist.aspx to enumerate adapter bindings. I need to change the network adapter binding order for laptops which have the Wireless connection set as the default (the LAN connection needs to go first). We have over 4000 laptops in our organisation, so setting the adapter order manually would be slightly difficult
In order to change the adapters binding order I need to use the interface InetCG to aquire a writelock.
object objINetCfg = null;
int nRet = 0;
nRet = Ole32Methods.CoCreateInstance(ref INetCfg_Guid.CLSID_CNetCfg, null, Ole32Methods.CLSCTX_INPROC_SERVER, ref INetCfg_Guid.IID_INetCfg, out objINetCfg);
INetCfg netCfg = objINetCfg as INetCfg;
string s;
INetCfgLock netCfgLock = netCfg as INetCfgLock;
int ret = netCfgLock.AcquireWriteLock(5000, "CLIENT", out s);
When trying using the method AcquireWriteLock I get a NullReference exception. I'm using Win XP SP3. Does anyone know what might be going wrong?
Thanks
Paul
|
|
|
|
|
|
Hi,
I am getting base64 text and i want to generate a png image from it. Can anyone please suggest me a good encoder or decode for the same. If anyone knows how to go about with yhis then plz help. The coding for the application is done using VB(using COM) and ASP. So any encoder or decoder making use of VB will be more useful. Plz provide me the details of the links if any.
Regards,
Shiney
Shiney
Shiney
|
|
|
|
|
Decoding base64 has nothing to do with COM.
Read 4 bytes, extract 6 left bits from each of the 4 bytes (24 bits) and create 3 bytes by concatenating the bits.
«_Superman_»
|
|
|
|
|
Hi,
I created an activeX control by using the details from the link
http://www.codeproject.com/KB/vb-interop/VB6InteropToolkit2.aspx?fid=422404&df=90&mpp=25&noise=3&sort=Position&view=Quick&select=2441751[^]
I am able to create the activeX control using datagridView and I even added it to VB 6.0 components (Ctrl+T) , but the problem is I am not able to access the properties of the datagrid added instead I am only able to see the basic propertis.And this ActiveX comes with the container kind of thing.
Please help me on it so that i vl be able to access the datagrid properties from VB 6.0 and be able to handle the ActiveX component created in C# as any general third party control.
Guid me if I am following any wrong process.
please reply ASAP.
Thanks in advance
Vani
|
|
|
|
|
How should declare function in COM (vc++) in order to be seen as shared in vb (no instance object needed for function call)?
thx
|
|
|
|
|
As far as I know you can't. COM is all about creating object then calling functions those object provide (via interfaces). You could call a VB Shared method and within that method create a new COM object, call its function then delete it - all within the Shared VB. On the other hand perhaps using a Shared may not be the only way to do what you want.
|
|
|
|
|
Shared vb function than creates an instance of my class, calls function (static one) then delete that object is a good solution, but not a perfect one. Was thinking perhaps there is a keyword that will expose function the way I want
If you can tell me what's the other way arround please let me know
thx
|
|
|
|
|
Sorry, I haven't got another way exactly. What I meant was that when using VB you tend to get used to the things VB lets you do and use - such as using Shared. With COM you have to think more in terms of objects and interfaces and so you tend to design solutions around them.
|
|
|
|
|
Static functions from c++ are equivalent to shared from VB; was thinking there is a way to just expose this static functions; if there isn't will just have to call code in vb common way, using object
thx
|
|
|
|
|
COM exposes interfaces and not methods.
According to your requirement, you want to expose a static method.
That is not COM.
«_Superman_»
|
|
|
|
|
Pop Cristian wrote: no instance object needed for function call
I'm not sure about your requirement, but C++ dll,with exposed methods can be used in VB.
As far as COM is concerned, it talks thorugh interfaces(so you need object) only.
|
|
|
|
|
Hi,
I guess you need to be more clear with your requirements. else you drop in such situation.
you could full fill your requirement by exposing c++ static methods. what makes to do this thru COM.
COM is full if dynamic bindings. and VB shared stuff is full of static things that are decided at compilation.....
^-^
@|@
- redCat
|
|
|
|
|
I have lots of structures/classes in my library, so I need to be COM; there is no specific requirement, all I needed was just a fancy way of exposing / calling a static vc function;
I have now in c code, CMyClass::DoThis(param1, param2), so no need to create new object in c for this; I'll just create a new object in vb, call my function and discard object afterwards
Was thinking in vb I could've have
CMyClass.DoThis(param1, param2) instead of
dim c as new CMyClass
c.DoThis(param1, paramt)
thx
|
|
|
|
|
I have a COM component in server A . I need to compile my code which calls the COM component in Server B . But server B doen not contain COM Installation . Will the compilation works .If so when i am executing it in server A ,will it be able to communicate with the COM .
Is it possible to use a dummy dll instead of the actual COM at the time of compilation and link to the original at the run time . ?
vineesh
|
|
|
|
|
A type library (.tlb), if you have one or can make one can be used to do what you want as a 'dummy dll'.
|
|
|
|
|
hi,
try to learn how to program it as a Automation client and DCOM. you do not need the signature information about the COM server if you go by this way!
^-^
@|@
- redCat
|
|
|
|