|
Thanks for your suggestions.
now instead of server capturing client messages now i want client's Gui capture messages from serevr.
how to proceed further with this.
thanks in advance
abhi
|
|
|
|
|
Please could you clarify exactly what you are requesting. i.e. Are you looking to receieve messages on your client? Is this the same client as the previous client?
If the client is the same program, then the usual way to allow the server to call the client by using an event sink, which you can search for and read about on CodeProject, and most books on COM. This generally works very well, but the security issues can be a real pain to overcome.
I cannot say any more than this at this stage without knowing more details.
|
|
|
|
|
I have an asp page that gathers the file and folder listings of the local client's hard drive by using the ActiveX Object Scripting.FileSystemObject, but I get an "Automation server can't create object" error when I run the site. It throws that error when I try to instantiate the following, "var fos = new ActiveXObject('Scripting.FileSystemObject');".
I googled this error and almost everyone says to upgrade Windows Scripting, which I did to version 5.6, but I still get the error. Weird thing is that if I run the page locally I get no errors and it works, but if I run the page under my IIS I get this error, so is there a way I can update windows scripting under my IIS or is there an alternative solution to this?
|
|
|
|
|
For the first time you have to register the class by command: 'regsvr32 <dll or="" ocx="">'. or inside your programm you have to examine the 'DllRegisterServer' function and call it.
|
|
|
|
|
Hello All,
Im using a simple ODBC connection to pull values out of an excel spreadsheet. It seems to work pretty well, except when it gets to columns with multiple 0's. It does not import the 0's even though the column is specified as text in the spreadsheet. Everything else seems to import fine. A sample excel column would look like this:
200,-,00,-,414001,-,0000,.,00,-,704
It wont import the 0 only cells. Im doing a simple import like this:
oCmd.CommandText = "SELECT * FROM \"" + sName + "$\"";
oCmd.Connection = oConnection;
oDataAdapter.SelectCommand = oCmd;
oDataAdapter.Fill(oDataTable);
Any idea's would be greatly appreciated,
Thanks,
Ryan
|
|
|
|
|
Anyone can describe the progress or drag-and-drop in the explorer.exe?
I want to catch the dragged contents in the explorer.exe and how shou I do?
|
|
|
|
|
You cannot catch or hook drag and drop between other applications. The only thing you can do is to register an DragDropHandler for the application. For the explorer it is of your own risk.
|
|
|
|
|
I have a fundamental component..
Suppose if I developed a ATL componet(DLL)and
If I want to release to the client what should be given to the client
how the client know the CLSID and IID of this component.
If I am not wrong I should deliver to the client
DLL, TLB.
could anybody clarify me this
thanks
Siva
|
|
|
|
|
Hello Siva,
At minimum, deliver the DLL itself plus other dependent DLLs. These must be registered successfully in the client's OS.
Thereafter, if the client uses VC++, the user will need to #import the DLL, e.g. :
#import "MyComponentDLL.dll"
A set of Type Library Header files will be generated by the VC++ compiler.
If the client uses VB, the user will have to reference your DLL.
.NET dev environments (e.g. C#, VB.NET) will also need to reference the DLL.
For other development environments, check out the documentation.
Best Regards,
Bio.
|
|
|
|
|
Hi
I would add something. In my work I am using a DLL (Which has been built in C#) and I am using it in VC++ by using COM. Below is how I am doing it in my case.
If client uses VC++, it has to create a Type library (TLB) file from the DLL. In microsoft visual studio (.NET) 2003 there is a tool , Regasm.Exe ..
Use Regasm.exe tool to create TLB file .. Actually it registers the DLL in the system registry as well as creates a TLB file.
Now use this TLB in #import command.
#import "MyComponentDLL.tlb"
A set of Type Library Header files will be generated by the VC++ compiler.
Now Put the TLB file in your working folder and put the DLL in the folder where your solution EXE will be created.
and Start then building the code.
-- modified at 4:51 Wednesday 1st March, 2006
|
|
|
|
|
i want to expose all of my interfaces to a Vb application, but the vb
application sees nothing except the default interface.
thanx in advance
Z.A
-- modified at 2:11 Friday 24th February, 2006
|
|
|
|
|
Hello zubair_ahmed,
Yes, COM objects will by default expose its "default" interface. However, you can DIM an object of another interface and cast the original COM object to this interface. Doing so is equivalent to performing QueryInterface().
Here is an example :
'' Let's say TestObject supports its default interface
'' plus TestInterface01 and TestInterface02.
Set TestObjectObj = New TestObject
'' Define objects of the 2 desired interfaces...
Dim TestInterface01Ptr As TestInterface01
Dim TestInterface02Ptr As TestInterface02
'' Cast TestObjectObj to the desired interfaces.
'' This action is equivalent to QueryInterface().
Set TestInterface01Ptr = TestObjectObj
Set TestInterface02Ptr = TestObjectObj
'' Use the interfaces' properties and methods as per normal...
TestInterface01Ptr.strProperty = "Hello"
TestInterface01Ptr.Method01
TestInterface02Ptr.longProperty = 101
TestInterface02Ptr.Method01
'' Set the interfaces to nothing is equivalent to Release()'ing
'' the interface pointers.
Set TestInterface01Ptr = nothing
Set TestInterface02Ptr = nothing
Best Regards,
Bio.
|
|
|
|
|
You have to add the IDispatch to all your Interfaces. For further informations see in your documentation how to implement an IDispatch-interface.
|
|
|
|
|
How to catch ActiveX Install or Excute using BHO?
I want detect ActiveX behavior about install, execute, download *.cab ...
help me~
thanks
and sorry about My little English.
|
|
|
|
|
hi,
i Create a application in ATL COM application,( for dll based application)
with simple get and set method for adding 2 nos
which is very similar to the link
http://www.codersource.net/atl_tutorial_events_properties.html[^]
but after build the appliaction i get error as
C:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\atlcom.h(1827) : error C2259: 'CComObject<class csimpleobj="">' : cannot instantiate abstract class due to following members:
C:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\atlcom.h(1823) : while compiling class-template member function 'long __stdcall ATL::CComCreator<class atl::ccomobject<class="" csimpleobj=""> >::CreateInstance(void *,const struct _GUID &,
void ** )'
C:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\atlcom.h(1827) : warning C4259: 'long __stdcall ISimpleObj::total(void)' : pure virtual function was not defined
E:\templqw12\SimpleAtlCom\SimpleAtlCom.h(106) : see declaration of 'total'
C:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\atlcom.h(1823) : while compiling class-template member function 'long __stdcall ATL::CComCreator<class atl::ccomobject<class="" csimpleobj=""> >::CreateInstance(void *,const struct _GUID &,
void ** )'
C:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\atlcom.h(1827) : error C2259: 'CComObject<class csimpleobj="">' : cannot instantiate abstract class due to following members:
C:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\atlcom.h(1823) : while compiling class-template member function 'long __stdcall ATL::CComCreator<class atl::ccomobject<class="" csimpleobj=""> >::CreateInstance(void *,const struct _GUID &,
void ** )'
C:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\atlcom.h(1827) : warning C4259: 'long __stdcall ISimpleObj::total(void)' : pure virtual function was not defined
E:\templqw12\SimpleAtlCom\SimpleAtlCom.h(106) : see declaration of 'total'
C:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\atlcom.h(1823) : while compiling class-template member function 'long __stdcall ATL::CComCreator<class atl::ccomobject<class="" csimpleobj=""> >::CreateInstance(void *,const struct _GUID &,
void ** )'
SimpleObj.cpp
reply me
send reply
|
|
|
|
|
|
This is because you haven't implemented all the methods of the ISimpleObj interface. Looks like the ISimpleObj::total method.
Steve
|
|
|
|
|
Hi All,
Can Anyone tell me how to implement and export DllRegisterServer from a VB Activex Dll?
I am a complete newbie to VB,sorry about the very basic question.
Thanks and Regards,
Anil
|
|
|
|
|
Can anyone also tell me what the default implementation of this function in VB does?
Thanks,
Anil
|
|
|
|
|
Hello Anil_vvs,
Not possible to implement DllRegisterServer() in a VB ActiveX DLL. It is automatically generated for you by the VB IDE and programmers do not have the option of modifying it.
Bio.
|
|
|
|
|
I create a C++ Powerpoint automation test program following the MSDN article "
How to create an automation project using MFC and a type library" steps.
But get serious trouble when it parses only a single rectange shape in a simple single PPT slide
The proble is always get assertion in "pptApp.put_Visible(false);"
"long nCount = shapepts.get_Count(); "
" long n = gshapes.get_Count(); "
Also I get assertion if I call shape.get_Vertice()
I ugently need the help to solve this problem.
the code is:
#include "stdafx.h"
#include "testPPT.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
#include <afxdisp.h>
#include "CPresentation.h"
#include "CApplication.h"
#include "CShapeNode.h"
#include "CSlides.h"
#include "CShapeNodes.h"
#include "CDocumentWindow.h"
#include "CPresentations.h"
#include "CShapes.h"
#include "CPageSetup.h"
#include "CFreeformBuilder.h"
#include "CPictureFormat.h"
#include "CShapeRange.h"
#include "CColorScheme.h"
#include "CMaster.h"
#include "CDesign.h"
#include "CHyperlinks.h"
#include "CActionSetting.h"
#include "CTextFrame.h"
#include "CSlide.h"
#include "CShape.h"
#include "CGroupShapes.h"
#include "CColorFormat.h"
#ifndef POWERPOINT_NOTINSTALLED
#define POWERPOINT_NOTINSTALLED 0
#endif
#ifndef POWERPOINT95
#define POWERPOINT95 1
#endif
#ifndef POWERPOINT97
#define POWERPOINT97 2
#endif
#ifndef POWERPOINT2000
#define POWERPOINT2000 3
#endif
#ifndef POWERPOINT2002
#define POWERPOINT2002 4
#endif
#ifndef POWERPOINT2003
#define POWERPOINT2003 5
#endif
//??????????????????????????????
//The Powerpoint conversion error code -- 2006-02-16, zxing
#define PPTCONV_OK 0 //OK
#define PPTCONV_NOPPT 1 //No Powerpoint installed
#define PPTCONV_NOPPTFILE 2 //No Powerpoint file
#define PPTCONV_PPTNOTRUN 3 //Cannot run powerpoint
#define PPTCONV_WRONGPPTVER 4 //Wrong Powerpoint version
//??????????????????????????????
// The one and only application object
CWinApp theApp;
using namespace std;
const OLECHAR FAR* szPPTProgID[] =
{
OLESTR("PowerPoint.Application.7"), // PowerPoint 95
OLESTR("PowerPoint.Application.8"), // PowerPoint 97
OLESTR("PowerPoint.Application.9"), // powerPoint 2000
OLESTR("PowerPoint.Application.10"), // powerPoint 2002
OLESTR("PowerPoint.Application.11"), // powerPoint 2003
};
long QueryPPTVersion(void)
{
long nRet = POWERPOINT_NOTINSTALLED;
CLSID clsid;
for (long i = POWERPOINT95; i <= POWERPOINT2003; i++ )
{
//Query class ID from system
if (SUCCEEDED(CLSIDFromProgID(szPPTProgID[i-1], &clsid)))
{
return i;
}
}
return nRet;
}
bool PPTStartup(CApplication& pptApp, long nVer, bool bShow, long& nPrevWS)
{
bool bRet = false;
if(nVer < POWERPOINT95 || POWERPOINT2003 < nVer)
{
return bRet;
}
CLSID clsid;
if(!SUCCEEDED(CLSIDFromProgID(szPPTProgID[nVer-1], &clsid)))
{
return false;
}
if(!pptApp.CreateDispatch(clsid))
{
TRACE(_T("Couldn't start PowerPoint and get Application object."));
return bRet;
}
nPrevWS = pptApp.get_WindowState();
if(bShow)
{
pptApp.put_Visible(true);
}
else
{
pptApp.put_Visible(false); //Failed get assertion
}
bRet = true;
return bRet;
}
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0;
// initialize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// TODO: change error code to suit your needs
_tprintf(_T("Fatal Error: MFC initialization failed\n"));
nRetCode = 1;
}
else
{
// TODO: code your application's behavior here.
}
nRetCode = OleInitialize(NULL);
long nVer = QueryPPTVersion();
long nPrevWS;
bool bShow;
CApplication pptApp;
if(!PPTStartup(pptApp, nVer, true, nPrevWS))
{
ASSERT(FALSE);
}
CPresentations pptPresentations = pptApp.get_Presentations() ;
CPresentation pptPresentation;
pptPresentation = pptPresentations.Open(_T("C:\\Dev\\outline.ppt"), FALSE, TRUE, TRUE);
CSlides pptSlides;
pptSlides = pptPresentation.get_Slides();
CSlide crtSlide;
crtSlide = pptSlides.Item(COleVariant((long)1));
CShapes shapes = crtSlide.get_Shapes();
CShape shape;
shape = shapes.Item(COleVariant((long)1));
CShapeNodes shapepts = shape.get_Nodes();
long nCount = shapepts.get_Count(); //Get Assertion
CGroupShapes gshapes = shape.get_GroupItems();
long n = gshapes.get_Count(); //Get Assertion
if(pptPresentation.m_lpDispatch != NULL)
{
pptPresentation.Close();
pptPresentation.ReleaseDispatch();
pptPresentation.m_lpDispatch = NULL;
}
if(pptApp.m_lpDispatch != NULL)
{
pptApp.Quit();
pptApp.ReleaseDispatch();
pptApp.m_lpDispatch = NULL;
}
return nRetCode;
}
|
|
|
|
|
It's my understanding that for every call to CoInitialize() you need a call to CoUninitialize(), at least that's my interpretation of the documents on MSDN. Please look at my code:
cParse::cParse()<br />
{<br />
try<br />
{<br />
CoInitialize(NULL); <br />
short vi = 1;<br />
xls.CreateInstance(__uuidof(clsXL));<br />
xls->Visible(&vi);<br />
} catch(_com_error &e) {<br />
bstrDesc = e.Description();<br />
MessageBox(NULL,_com_util::ConvertBSTRToString(bstrDesc),0,0);<br />
}<br />
}<br />
<br />
cParse::~cParse()<br />
{<br />
try<br />
{<br />
CoInitialize(NULL); <br />
xls->QuitAll();<br />
} <br />
catch(_com_error &e) {<br />
bstrDesc = e.Description();<br />
MessageBox(NULL,_com_util::ConvertBSTRToString(bstrDesc),0,0);<br />
}<br />
CoUninitialize(); <br />
}
If I use it any other way the program crashes. I'm not sure if what I have done is right or wrong (it works), but I would like a better understanding? The commented numbers are to make any replies easier to understand
|
|
|
|
|
CoInitialize is to initialize the com libraries and for setting up the right apartment for the current thread where you are using the com objects.
You need to do this only once for an application. For example in the caase of an MFC application u can call CoInitialize(NULL); in the initinstace and CoUninitialize(); in the ExitInstance.
No need to call this in every class and method.
If u r in a multithreded app then u need to call CoInitialize and CoUninitialize in each thread.
hope this help...mil10
|
|
|
|
|
Thanks for the reply. That is exactly how I thought it should be done, but in my above code, if I remove it from the destructor, the program crashes on exit. I'm having a nightmare trying to debug this since the xls pointer is an AxtiveX VB coded dll. But I am pretty sure the problem is not even in the dll (it only clears some memory).
I will keep trying nonetheless.
|
|
|
|
|