|
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
|
|
|
|
|
Hello!
I am trying to write a web application that allow me to search and view outlook 2003 calendars.
so far I have only been able to read my own calendar information via the Microsoft.Office.Interop.Outlook 11 in a console application.
do any one have an idea of how I could search other peoples calendar ? and how to do it in a console application would be fine too
so what I am trying to do is really
1. logon a outlook account
2. read other peoples calendar <-- where I am
3. upload the results to a web application so other can view them and search them
Thanks in advance
modified on Wednesday, January 28, 2009 4:07 AM
|
|
|
|
|
Hi all,
I want to pass a userdefined structure using variant from a COM client to COM server. Can any one help me?...
Regards
Arun
|
|
|
|
|
You need to use idl file. Refer this[^] article by ioannhs_s.
|
|
|
|
|
Thanks for the reply.
I already got this article.But recordinfo failure occurs at that time.
Do u have any example?.
Now i can pass the structure to the COM server without using VARIANT.
|
|
|
|
|
Arun Menon wrote: But recordinfo failure occurs at that time
What kind of error is this?
Arun Menon wrote: Now i can pass the structure to the COM server without using VARIANT.
As said earlier and shown in article, use idl to declare structure as interface. You can use it as function parameter.
|
|
|
|
|
Hi all
I've searched and searched but I can't find a method that will enable me to intercept requests from a WebBrowser control and then provide my own, programmatically generated responses.
Currently, my application uses the control to provide 90% of the UI by loading HTML, CSS and Javascript from disc using the "file" protocol. The scripts then call my app's dispatch interface to make things happen.
What I would like to be able to do is effectively serve these files without coding my own HTTP server. I'm hoping there's a point at which I can intercept the WebBrowser's request and then write my own response back to it. This response will usual consist of the contents of a file extracted from an archive or from the app's resources.
I would also like to be able to spot requests for images (by parsing the URL) so that I can render SVG graphics to a file as a PNG (or similar) and stream that file back to the browser.
So, is there some interface I can implement and supply to the browser in order to achieve the above? As I said, I'd like to avoid writing my own HTTP server or Asynchronous Pluggable Protocol handler.
Thanks in advance
Simon
modified on Friday, January 30, 2009 10:56 AM (typo)
|
|
|
|
|
Well, in case anyone stumbles across this post, I thought I'd let you know how I solved my problem (well, this one anyway)...
Turns out a pluggable protocol is the solution. The basics are easy to write and, critically, they can be registered on a per-process basis.
I invented my own URL scheme, implemented an APP for it, registered my APP class factory using CoInternetGetSession and IInternetSession::RegisterNameSpace and away I went.
The UI is now "served" via my own URL scheme by my own APP on a per-process basis.
|
|
|
|
|
Hi,
I am trying to access a aspx page controls from a COM component, in particular I need to know the position of different controls on the web page so that I can, for example, click on a button or enter text in an editbox...
So far I have found that it can be done from .NET framework as explained in http://msdn.microsoft.com/en-us/library/ms178509.aspx[^]
Now I would like to know how the same can be done in COM.
Any help would be greatly appriciated.
Thanks in advance!
|
|
|
|
|
Hello I´m new in developes Controls with VC++ (VS2005)
When I use a activex, creating in desinger mode, the message OnLButtonUp (WM_LBUTTONUP) define in Warpper class return very well, but when I Create the activex in runtime mode, it don´t work.
What is my error ? I mistake some code ?
Parts of my code to better explain ..
class CTest2001Dlg : public CDialog
{
public:
CListView2 LV1;
CListView2 *pLV3;
afx_msg void OnBnClickedButton1();
};
void CTest2001Dlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_LISTVIEWCTRL1, LV1);
}
void CTest2001Dlg::OnBnClickedButton1()
{
CRect cPosition(300, 100, 400, 200);
pLV3 = new CListView2();
pLV3->Create(_T("{BDD1F04B-858B-11D1-B16A-00C0F0283628}"),NULL, WS_TABSTOP | WS_VISIBLE,cPosition,this,IDC_LISTVIEWCTRL_3,NULL);
}
#pragma once
class CListView2 : public CWnd
{
DECLARE_MESSAGE_MAP()
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
};
#include "stdafx.h"
#include "CListView2.h"
IMPLEMENT_DYNCREATE(CListView2, CWnd)
BEGIN_MESSAGE_MAP(CListView2, CWnd)
ON_WM_LBUTTONUP()
END_MESSAGE_MAP()
void CListView2::OnLButtonUp(UINT nFlags, CPoint point)
{
AfxMessageBox (_T("Clicked in CListView2::OnLButtonUp " ) , MB_OK|MB_ICONSTOP);
CWnd::OnLButtonUp(nFlags, point);
}
thank´s
|
|
|
|
|
hi,
if you are trying to create an ActiveX control at runtime , be sure that you are calling the
AfxEnableControlContainer() of method. and CoInitialize() also.
call these functions in OnInitIntstance()/CWinApp
hope this works!
^-^
@|@
- redCat
|
|
|
|
|
Hi, thank's so much, but i'm using :
InitCommonControls();
AfxEnableControlContainer();
CoInitialize(NULL);
on MyApp.InitInstance();
A think my problem is beacause a Runtime Acitivex don´t have a :
DDX_Control(pDX, IDC_LISTVIEWCTRL1, LV1);
On
:DoDataExchange(CDataExchange* pDX);
Somebody have anything idea ?
One more Thank You.
|
|
|
|
|
Here goes my problem :
I have a IStream interface pointer created using SHCreateStreamOnFile() for a text file..
When I try to write into the stream using IStream::Write() function, the function returns with a success code S_OK. But the issue is that when look back to the file, I see the file empty..
Please help !!!!!
|
|
|
|
|
Are you sure IStream can be used to write to a text file? I've always used it for writing to a structured storage file. If I'm wrong and it will write to a text file, have you opened the stream in transacted mode and so have to call ISteam->Commit to make any IStream->Write calls be seen in the ouput file?
|
|
|
|
|
Hi,
I am a newbie to the COM and Microsoft technologies. i have a COM dll to be used in my C++ program to connect to remote server and handle events recieved from the remote server.
COM dll contains the single interface and following functions are available
setIpAddr()
setPort()
Connect()
startRequest()
Also available events are
onConnect() :- occurs when the server responds to to Connect() call above
onRecieveData() :- occurs when the call startRequest() is made and this is continuous event happens when ever the remote server sends the message.
I am able to create the COM object and call the methods. my question is, how take care of the event handlers.(creating stubs for the events above).
Here is the code snippet
#include "stdafx.h"
#using <mscorlib.dll>
#import "XYZCom.dll"
#include <string>
using namespace System;
int main(){
XYZCom::ITXYZCom *interfaceXYZ = NULL;
HRESULT hr;
CoInitialize(NULL);
hr = CoCreateInstance ( __uuidof(XYZCom::ITXYZCom), NULL, CLSCTX_INPROC_SERVER, __uuidof(XYZCom::ITXYZCom), ( void** ) &interfaceXYZ );
if( ! SUCCEEDED( hr ) )
{
interfaceSinal = NULL;
printf( "Unable to create instance of the object.\n" );
// goto _EndMain;
}
interfaceXYZ->setIpAddr("127.0.0.1")
interfaceXYZ->setPort("15000")
interfaceXYZ->Connect();
Google talks about ATL i am not sure about it. How to implement the event handlers for the event interfaces defined in the COM DLL
|
|
|
|