|
Hi,
I have been working with the XYNTService, which has been a great help to me.
What I'm currently looking at is a facility for installing this under an account other than "Local System"? I have configured the logon credentials manually, but I need a way to push this out across a large user base using an account with network access.
Any thoughts?
Thanks,
John
|
|
|
|
|
You need admin right on each computer that you want to install the service.
I have a utility program[^] that can install a service to be run under a given user account. However, it does not create the user account nor does it grant the necessary rights to it.
It is possible to write a program that creates a new account on a computer, if you are familiar with ADSI (com interfaces).
My articles and software tools
|
|
|
|
|
Thanks -- that's perfect.
The service will be pushed out via SMS and I am setting up a generic user account which will have access to the network share, so that's no problem. I just needed to be able to logon under the correct account.
Thanks again for all your help!
Regards,
John
John A. Berry
Analyst, Application & Database Services
Shared Information Management Services (SIMS)
University Health Network
700 Bay Street, Suite 201
Toronto, ON
M5G 1Z6
|
|
|
|
|
Hi Xiangyang Liu,
I've been using XYDispatch and am very happy with your creation! I have a question regarding the "InvokeMethod" call.
I have a COM object that provides the following MethodName:
3: DispID = 34003
MethodName = MessageParameter
PropertyGet
VTable offset: 0
Calling convention: 4
Return type = 8
ParamCount = 1
Param(0) type = 3
I call this methodname like this:
VARIANT* pOutput;
long myIdx = 0; //Set to any value and I've also attempted to use "int" rather than "long" parm
pOutput = dispDriver.InvokeMethod("MessageParameter", myIdx);
pOutput is always NULL (0x00000000) after this call. I think it has something to do with the
"PropertyGet". I usually see "DispatchMethod" associated with the MethodName. I have checked my "dispDriver" and it's a good and valid address. I can cal other Methods with InvokeMethod but only "MEssageParameter" returns NULL always.
What am I doing wrong? I'm sure it's my ignorance.
Thanks,
Brian
|
|
|
|
|
It looks like the "method" you want to invoke is actually a parameter. InvokeMethod does not work with parameters. You should use GetParameter instead.
However, GetParameter does not take any input for the parameter. That is a flaw of the XYDispDriver class (it was designed for "simple" com programming).
You can call the static method InvokeVariantMethod to get around this problem. Assume you have created your com object using an instance of XYDispDriver, dispDriver, here is the code:
VARIANT varOutput;
VARIANT varInput;
varInput.vt = VT_I4;
varInput.lVal =1;
HRESULT hRet =
XYDispDriver::InvokeVariantMethod
(
dispDriver.GetDispatch(),
"MessageParameter",
DISPATCH_PROPERTYGET,
&varOutput,
NULL,
1,
varInput
);
if(hRet==S_OK)
{
}
Good luck.
P.S. I hope it works.
My articles and software tools
|
|
|
|
|
Hello Again,
I have a rather strange situation with XYDispDriver. I'm calling from Java into a JNI DLL that instantiates a class that wraps a few more classes that use XYDispDriver class. The DLL has just a few methods. We'll just call them method1 and method2. Here's the classes:
class Application
{
XYDispDriver dispDriver;
Connection* pConnection;
public:
Application(){dispDriver.CreateObject("MyControl")};
Connection* getConnection()
string getPropertyId() // dispDriver.GetProperty("Id");
class Connection
{
XYDispDriver dispDriver;
Session* pSession;
public:
Connection(const XYDispDriver &src);
Session* getSession()
string getPropertyId() // dispDriver.GetProperty("Id");
}
class Session
{
XYDispDriver dispDriver;
public:
Session(const XYDispDriver &src);
string getPropertyId() // dispDriver.GetProperty("Id");
}
The JNI DLL looks like this:
//Global declarations
Application* pAppl;
Connection* pConnection;
Session* pSession;
JNIEXPORT ... method1()
{
pAppl = new Application();
pConnection = pAppl.getConnection();
pSession = pConnection.getSession();
cout << pAppl->getPropertyId() << endl;
cout << pConnection ->getPropertyId() << endl;
cout << pSession ->getPropertyId() << endl;
}
JNIEXPORT ... method2()
{
cout << "Application " << pAppl->getPropertyId() << endl;
cout << "Connection " << pConnection ->getPropertyId() << endl;
cout << Session " << pSession ->getPropertyId() << endl;
}
So .. Java calls method1 and everything works fine and I can call all the methods and properties asociated. Then I exist back to Java and call method2. Both pAppl->getPropertyId() and pSession ->getPropertyId() execute fine. However, when I call pSession ->getPropertyId() XYDipDriver is failing on the Invoke of the dispDriver.GetProperty("Id") call. I have no idea why this is happending? Any idea? I checked all addresses and even looked at the information in XYDispInfo instance which still had the"Id" method listed with a valid index. Why would Invoke fail?
Output looks like this:
Application ID=/app
Connection ID=/app/con[0]
Invoke failed, no exception: 800401fd
To make matters even more tricky, I take the JNIEXPORT DLL and remove the JNI types and create an identical DLL which I call from a C++ console application. The Invoke works every time!!
Can you shed any light on why the Invoke might be failing when I call from Java through JNI?
Thanks,
Brian
|
|
|
|
|
Hi Xiangyang Liu,
It appears that the dispDriver IDispatch pointer is stale even though XYDispInfo contains valid information. It looks like I need to refesh the IDispatch pointer from the Parent class between JNI Metod calls from Java. So, as usual, it looks like I have a problem with my code. No need for you to answer or think about this question.
Thanks for all your help,
Brian
|
|
|
|
|
Thanks Xiangyang Liu! (if that's how you pronounce it )
I've recently had to add the ability to download and process emails to my ASP application (quite a hefty one, at that), and was at a loss as to how to get an ASP page to run without having a constantly refreshing web window open under a constantly logged-in user... (secure, yeah)
With your XYNTService application I can now run my ASP thing as a service! It's amazing!
Thank you, thank you
"Rainy days and automatic weapons always get me down." - Anon.
|
|
|
|
|
|
are you form china ?
ÊÇÖйúÈËÂð?¿ÉÒÔ½»¸öÅóÓÑÂð?ÎÒµÄEMAILÊÇ
degede@163.com
I like free...
|
|
|
|
|
dalaroseyeah wrote:
are you form china ?
I currently live in USA. I came from China more than 15 years ago. I had problem reading the Chinese text in your post, you can email me if you want to.
Nice to meet you.
My articles and software tools
|
|
|
|
|
Hello Xiangyang Liu,
I am attempting to use your XYDispDriver and I am a COM novice. When I create my COM object one method is shown in output as follows with DEBUG turned on:
1: DispID = 32905
MethodName = OpenConnection
DispatchMethod
VTable offset: 0
Calling convention: 4
Return type = 26 (Not sure what this represents?)
ParamCount = 3
Param(0) type = 8
Param(1) type = 12
Param(2) type = 12
My Code to Invoke this Method is like this:
VARIANT* pOutput = disp.InvokeMethod("OpenConnection", "My Info",true, true);
When I call this method it returns OK with a VT_DISPATCH vartype.
I opened an MFC project and added the OCX Control and it generated the following method code:
CSapConnectionTarget Csapfewse::OpenConnection(LPCTSTR Description, const VARIANT& Sync, const VARIANT& Raise)
{
LPDISPATCH pDispatch;
static BYTE parms[] =
VTS_BSTR VTS_VARIANT VTS_VARIANT;
InvokeHelper(0x8089, DISPATCH_METHOD, VT_DISPATCH, (void*)&pDispatch, parms,
Description, &Sync, &Raise);
return CSapConnectionTarget(pDispatch);
}
CSapConnectionTarget has its own methods and properties which I would like to call. Can you help me understand how I would do this through the "pOutput" return type of VT_DISPATCH? I think I'm interested in the "IDispatch FAR* pdispVal" of pOutput?
Brian
|
|
|
|
|
In this case, the method "OpenConnection" returned a SapConnection object (VT_DISPATCH, an IDispatch pointer). You can use the returned "object" with another instance of the XYDispDriver class, like the following:
<br />
VARIANT* pOutput = disp.InvokeMethod("OpenConnection","My Info", true, true);<br />
XYDispDriver disp2;<br />
if(disp2.Attach(pOutput->pdispVal)!=false)<br />
{<br />
}<br />
The Attach method of XYDispDriver allows you to use an existing IDispatch pointer, it is the same as the CreateObject method except that it does not create a new com object (it only attaches the existing com object to the XYDispDriver instance).
Good luck.
My articles and software tools
|
|
|
|
|
Thank you very much! I'll give it a try right now.
Brian
|
|
|
|
|
Hi Xiangyang Liu,
Hopefully one last question. I was successful with the code you mentioned. One of the "properties" of that Object are defined as follows:
/////////////////////////////////////////////////////////////////////////////
// CSapConnectionTarget properties
CString CSapConnectionTarget::GetDescription()
{
CString result;
GetProperty(0x80ea, VT_BSTR, (void*)&result);
return result;
}
In the DEBUG Output on attach I see:
11: DispID = 33002
VarName = Description
VarKind = VAR_DISPATCH
VarType = 8
VarType 8 looks like a VT_BSTR!
I run this code ....
VARIANT* pProperty = connection.GetProperty("GetDescription");
but I get 0x00000000 (NULL) for pProperty. How would I get at that variable "VarName = Description"?
Thanks you so, so much.
Brian
|
|
|
|
|
|
Hi, I'm running windows XP Pro and I've registered VBThread.dll in COM+.
When I run the VBThreadTest program I get 'Automation Error' on the line 'Set vbThreadObj = New VBTHREADLib.ThreadObj' in the form load event.
If I remove 'WithEvents' from the vbThreadObj declaration I do not get this error (but of course I get no completion event raised) and the program works correctly.
I recompiled VBThread.dll and re-registered it but it didn't help.
Can you think of anything I did wrong?
Thanks
Terry Hutt
terryhutt1959@hotmail.com
|
|
|
|
|
I figured it out...
I destroyed the COM+ package and registered the dll with regsvr32. All is now working.
Great job on the article.
Terry Hutt
|
|
|
|
|
terryhutt1959@hotmail.com wrote:
I destroyed the COM+ package and registered the dll with regsvr32. All is now working.
I just love users who can figure out problems themselves.
Thanks for the comment, by the way.
My articles and software tools
|
|
|
|
|
Hi.
I need some help with my connection string. Im trying to connect to a password protected MS Access database. This is my connection string:
"Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin; Password=whatever;Data Source=E:\\BN\\test\\ht.mdb;"
When I use this connection string I get the following error:
"System.Data.OleDb.OleDbException: Cannot start your application. The workgroup information file is missing or opened exclusively by another user. at System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) at System.Data.OleDb.OleDbConnection.InitializeProvider() at System.Data.OleDb.OleDbConnection.Open() at webchange.attachme.InsertRow(String myConnectionString, String myInsertQuery) at webchange.attachme.Upload_ServerClick(Object sender, EventArgs e)"
The thing is... when i remove the password in the database and use this connection string: "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\\BN\\test\\ht.mdb;" .... it works fine. I've allready tried all the workarounds i've found on Microsofts pages (http://support.microsoft.com/default.aspx?scid=kb;en-us;316675) but i allways get the same error...
Any ideas?
tnx in advance
-dodge
|
|
|
|
|
Here is the solution to the problem you have, it took me a while to figure it out.
In your connection string, you need to change the Password string to Jet OLEDB:Database Password, like the following:
<br />
Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Jet OLEDB:Database Password=123456;Data Source=E:\\BN\\test\\ht.mdb<br />
It worked for me.
My articles and software tools
|
|
|
|
|
Tnx alot! Works fine. It might have taken you a while to figure out, but it sure would have taken me forever
|
|
|
|
|
To use your class ,how can I receive the events fired by COM
|
|
|
|
|
chaocai wrote:
To use your class ,how can I receive the events fired by COM
To receive com event, you need to set up the event sink and connect it to the outgoing event interface in the com object.
If you are developing a GUI application (MFC or VB), then using com and receiving com event is easy, you don't need to use my class at all.
If you are familiar with ATL or want to learn it, you don't need to use my class either.
To use the XYDispDriver class to handle com event, you need to implement the event interface in another com object, please read Handling COM Events in a Console Application for more details. This is definitely not the easiest way for beginners.
Good luck.
My articles and software tools
|
|
|
|
|
I have try what you said,but it did not run.
I think your GetObject method must invoke the CreateInstanceEx not the CreateInstance.
MSDN say CreateInstance can only create a local instance of the class.
I do not know much about how to use the CreateInstanceEx.How to change your program?
Thank a lots
|
|
|
|