|
Hi there,
Can anyone tell me how to set the initial postion of a deskband.
I have succesfull executed the Band Object Implementation Sample from MSDN
But the desk band Initially is always, docked on the taskbar.
What I want is, initially, the deskband to be docked on the right side of the screen.
Thanks in advance,
Kumar.
|
|
|
|
|
I've been given a task by my manager which I think is not possible to do. Our clients will be given an activeX control in which they will instantiate and make calls into. What we are trying to do is validate those calls into the activeX control. That is, when those calls are made, the parameters need to be checked and verified for proper values. Now the solution I have come up with, is to provide clients with my own activex control, which basically IS the actual activeX control they will be using except I added my own code to the implementation to do my validation and report to a file. Now in order for this to work, the client will need to instantiate MY activeX control instead of the real one, use MY activex control as if they were using the real one, and then I can validate that they are doing things properly. This of course requires the client to instantiate MY activex control hence build against my activex control. What she wants is this to be totally transparent to the client. That is, somehow do my validation on their calls to the real activex control but without getting them to have to rebuild against mine. So in other words, somehow intercept the calls from the client to the activex control and validate it with them knowing it. This sounds pretty serious in terms of security, and doesn’t seem doable. The real issue here is this: how do I get a client to use my activex control without them having to rebuild or even know that they're using my activex control? How could I make this validation totally transparent to the client? Can it be done?
|
|
|
|
|
Presumably you don't supply the original ActiveX control, or you'd simply add the validation code into that...
In terms of whether this is a security issue, I'd defer to Keith Brown; he's written a Universal Delegator, which will pretty much help you to do what you need. He's also the expert's expert on Windows Security, pretty much...
Check out this; Clickety[^]
Steve S
Developer for hire
|
|
|
|
|
yes, i wish i could modify the original activex to do my validation!
i'm going to check out that link. so i guess i'm right? without chaging the client code or rebuilding, they can't (normally) transparently do this.
|
|
|
|
|
thanks for the link. checked it out, but my question still remains. for the client to use this delegater that lets me do post-processing, the client still would need to build with this wrapper object, and use THAT object, right? that would still create the dependency for the client on using this delegator. this is essentially a wrapper, no? the key here is to keep the client totally oblivious to what's going on.
|
|
|
|
|
Hi Folks,
I am trying to add EVENT HANDLING in the COM component (attributed) in Visual C++ 7.1. But, it takes a lot of time (around 250 ms on my machine) while executing "__raise" method call for each event. This is a serious problem for me as a typical operation in my program throws around 50 events and when 250 ms are clubbed together for these 50 events, the overall operation takes hell lot of time)
Following is the event related code I have added in my program:
*****************************************************************
[
dispinterface,
nonextensible,
uuid("4700BB55-A9D2-46f8-A453-EF8F9658E56F"),
helpstring("_IMyEvents Interface")
]
__interface _IMyEvents
{
[id(1), helpstring("method OnDataChanged")] HRESULT OnDataChanged();
}
class ATL_NO_VTABLE CMyData : public IMyData
{
public:
CMyData ();
virtual ~CMyData ();
__event __interface _IMyEvents;
HRESULT FireOnDataChanged()
{
__raise OnDataChanged(); // THIS CALL TAKES TIME
}
----------
----------
}
*****************************************************************
I would look forward to your suggestions & comments.
Regards,
Arun.
|
|
|
|
|
One more clue:
This COM component accesses a webservice and invoke some methods on it. The webservice is deployed in the Tomcat Container.
(May be this is creating some problem)
|
|
|
|
|
Hi all,
Does anyonesee the following problem?
I built a COM component, and when I run my program, there's an eeror message:
Debug assertion failed!
Program: D:programs\...
File: dbgdel.cpp
Line: 47
Expression: _BLOCK_TYPE_IS_VALID(pHeap->nBlockUse)
The strange this is that if I build a dll file only (not use COM technique), that problem doesn't happen even the codes in COM and dll are exactly the same.
Thanks in advance for any help.
Nga
|
|
|
|
|
Hi,
I have created an ATL dll which has a modeless dialog box containing a WebBrowser control. My problem is that whenever I'm pressing TAB key over the WebBrowser control, the focus is not shifting to other controls or links within the web page which is getting displayed within the control.
I have implemented a hook to trap WH_GETMESSAGE message, after that I'm able to get response from the 4 arrow keys and TAB key, but that too within the dialog box.
I have to make the TAB key acting normal within the WebBrowser control that is within that dialog box.
Can anyone of you help me out? Thanks in advance.
Regards,
Ashish
|
|
|
|
|
Hi,
Does anyone know how to throw exception in COM.
Thanks in advance
|
|
|
|
|
tpndtbk wrote:
Does anyone know how to throw exception in COM.
Till i know COM
doen't support any Exception handlling.
but there other way or hack to do that
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Hi Alok,
You mean we can't throw exception in a COm interface function?
So what can we do if the exception happens??
|
|
|
|
|
Implement ISupportErrorInfo interface, and always try to get the HRESULT code. HRESULT tells whether the method executed successfully or some error occured.
I think this might be of your help.
|
|
|
|
|
Thanks very much.
Year, I always use HRESULT code... But I mean, how to throw an error message that the user can catch it and see it.
|
|
|
|
|
tpndtbk wrote:
I always use HRESULT code... But I mean, how to throw an error message that the user can catch it and see it.
Sorry for replying late, Actually when your class inherited From ISupportInterface.
it has a special function name
Error which help you to send special human readable warning message or failure reason to client which using your component
-----------------------------
"I Think this Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Hi.
If, for example, you want to throw an exception from a certain method
"Test()" of a certain COM interface "IMyInterface", a possible simple solution is proposed below.
You can use either the macro "_com_raise_error(...)" or the command "throw _com_error(...)"
inside the method "Test()" for throwing an exception.
In the "client" of your "Test()" method, you can catch this exception as a "_com_error".
In the following you can find a code example.
Hoping this could help,
Manuele
Server
======
#include "comdef.h"
...
// --------------------------------------------------------------------------
STDMETHODIMP CMyInterface::Test( int p_Int )
{
HRESULT l_HR = S_OK;
// Let's suppose we want to throw an exception if the
// parameter is zero.
if ( p_Int == 0 )
{
// Create a new error info object and fill it.
ICreateErrorInfo* l_CreateErrorInfo = NULL;
GUID l_GUID = CLSID_MyInterface;
l_HR = CreateErrorInfo( &l_CreateErrorInfo );
if ( ! SUCCEEDED( l_HR ) )
{
return E_FAIL;
}
l_CreateErrorInfo->SetDescription( L"Descrizione Errore" );
l_CreateErrorInfo->SetGUID( l_GUID );
l_CreateErrorInfo->SetHelpContext( 0 );
l_CreateErrorInfo->SetHelpFile( L"HelpFile" );
l_CreateErrorInfo->SetSource( L"Source" );
IErrorInfo* l_ErrorInfo = NULL;
l_HR = l_CreateErrorInfo->QueryInterface(
IID_IErrorInfo,
( void** ) &l_ErrorInfo );
if ( ! SUCCEEDED( l_HR ) )
{
return E_FAIL;
}
l_CreateErrorInfo->Release();
// Throw the just created error info object.
// Alternatively, here you can use
// "_com_raise_error( E_FAIL, l_ErrorInfo );" as well.
throw _com_error( E_FAIL, l_ErrorInfo );
return E_FAIL;
}
return S_OK;
}
Client
======
#import "..." no_namespace
// --------------------------------------------------------------------------
int main(int argc, char* argv[])
{
HRESULT l_HR = S_OK;
IMyInterfacePtr l_MyPtr = NULL;
l_HR = CoInitialize( NULL ;
if ( ! SUCCEEDED( l_HR ) )
{
return E_FAIL;
}
l_HR = l_MyPtr.CreateInstance( __uuidof(MyInterface) );
if ( ! SUCCEEDED( l_HR ) )
{
return E_FAIL;
}
try
{
l_HR = l_MyPtr->Test( 0 );
}
catch( _com_error e )
{
// Here, you can get information made available
// by interface IErrorInfo
_bstr_t l_Description = e.Description();
DWORD l_HelpContext = e.HelpContext();
_bstr_t l_HelpFile = e.HelpFile();
_bstr_t l_Source = e.Source();
GUID l_GUID = e.GUID();
printf( "\nCOM exception caught\n\nDescription: %s, \
HelpContext: %u, HelpFile: %s, Source: %s, \
GUID: %X-%X-%X-%X",
( char* ) l_Description,
l_HelpContext,
( char* ) l_HelpFile,
( char* ) l_Source,
l_GUID.Data1,
l_GUID.Data2,
l_GUID.Data3,
l_GUID.Data4);
IErrorInfo* l_ErrorInfo = e.ErrorInfo( );
l_ErrorInfo->Release( );
}
catch( ... )
{
printf( "\nGeneric exception caught\n\n" );
}
// Release the smart pointer before calling CoUninitialize
l_MyPtr.Release( );
CoUninitialize( );
return 0;
}
|
|
|
|
|
Hi,
I would like to create a program that scans the outgoing and
incoming mails like Norton AntiVirus. From my searches I think Norton acts like SMTP+POP3 proxy. Norton does not want its users to change the server settings of their email clients to localhost to work with Norton mail scanning ( a kind of handfree approach). Can we create such a program.
So my idea is that a program that acts as a bridge between "actual mail client" and the email client and captures the incoming and outgoing mail and process those mails (virus scanning with clamav database).
Please help.........
|
|
|
|
|
Sir,
i have a datagrid containing customer order details.i want to display it in microsoft word using automation.give me some ideas or clues
|
|
|
|
|
Hi, folks,
I am writing a database access code in VC++6 using the row OLEDB interfaces, using SQLOLEDB 2.0 and connecting SQL server 2000. Running into a problem with inserting with client cursor. I found once the client cursor is on, the rowset always gets one more column than what are in the table. (which is obviously used by client cursor engine). The question is: with this extra column, how can i possibly do insert? I tried through ADO and still use SQLOLEDB on background, it is fine. I don't know how ADO solves this problem.
By the way, update and delete is fine, which is reasonable.
pIRowsetChange->DeleteRows(...) -->fine
pIRowsetChange->SetData(...) -->fine
pIRowsetChange->InsertRow(...) -->no good! error is like:
DBSTATUS_E_BADSTATUS.. DBSTATUS_E_UNAVAILABLE
Any idea?
Jason D.
Jason D.
|
|
|
|
|
What rowset options are you requesting/getting?
I've used the ATL wrappers extensively, and not have any real problems (apart from the obvious ones, like autoincrement issues)
Steve S
Developer for hire
|
|
|
|
|
Hi, Steve,
Thanks for response. I am using the following combination. Actually DBPROP_CLIENTCURSOR is not necessary, since DBPROP_IRowsetLocate acquires client cursor automatically. Any way, I have tried other combinations, like just clientcursor nothing else. As long as I turn client cursor on, inserting alway fails.
Properties[0].colid = DB_NULLID;
Properties[0].dwOptions = DBPROPOPTIONS_REQUIRED;
Properties[0].dwPropertyID = DBPROP_IRowsetLocate;
V_VT(&Properties[0].vValue) = VT_BOOL;
V_BOOL(&Properties[0].vValue) = VARIANT_TRUE;
Properties[1].colid = DB_NULLID;
Properties[1].dwOptions = DBPROPOPTIONS_REQUIRED;
Properties[1].dwPropertyID = DBPROP_IRowsetUpdate;
V_VT(&Properties[1].vValue) = VT_BOOL;
V_BOOL(&Properties[1].vValue) = VARIANT_TRUE;
Properties[2].colid = DB_NULLID;
Properties[2].dwOptions = DBPROPOPTIONS_REQUIRED;
Properties[2].dwPropertyID = DBPROP_CANHOLDROWS;
V_VT(&Properties[2].vValue) = VT_BOOL;
V_BOOL(&Properties[2].vValue) = VARIANT_TRUE;
Properties[3].colid = DB_NULLID;
Properties[3].dwOptions = DBPROPOPTIONS_REQUIRED;
Properties[3].dwPropertyID = DBPROP_RETURNPENDINGINSERTS;
V_VT(&Properties[3].vValue) = VT_BOOL;
V_BOOL(&Properties[3].vValue) = VARIANT_TRUE;
Properties[4].colid = DB_NULLID;
Properties[4].dwOptions = DBPROPOPTIONS_REQUIRED;
Properties[4].dwPropertyID = DBPROP_IRowsetRefresh;
V_VT(&Properties[4].vValue) = VT_BOOL;
V_BOOL(&Properties[4].vValue) = VARIANT_TRUE;
Properties[5].colid = DB_NULLID;
Properties[5].dwOptions = DBPROPOPTIONS_REQUIRED;
Properties[5].dwPropertyID = DBPROP_UPDATABILITY;
V_VT(&Properties[5].vValue) = VT_I4;
V_I4(&Properties[5].vValue) = DBPROPVAL_UP_CHANGE | DBPROPVAL_UP_DELETE | DBPROPVAL_UP_INSERT;
Properties[6].colid = DB_NULLID;
Properties[6].dwOptions = DBPROPOPTIONS_REQUIRED;
Properties[6].dwPropertyID = DBPROP_IRowsetChange;
V_VT(&Properties[6].vValue) = VT_BOOL;
V_BOOL(&Properties[6].vValue) = VARIANT_TRUE;
Properties[7].colid = DB_NULLID;
Properties[7].dwOptions = DBPROPOPTIONS_REQUIRED;
Properties[7].dwPropertyID = DBPROP_COLUMNRESTRICT;
V_VT(&Properties[7].vValue) = VT_BOOL;
V_BOOL(&Properties[7].vValue) = VARIANT_FALSE;
Properties[8].colid = DB_NULLID;
Properties[8].dwOptions = DBPROPOPTIONS_REQUIRED;
Properties[8].dwPropertyID = DBPROP_CLIENTCURSOR;
V_VT(&Properties[8].vValue) = VT_BOOL;
V_BOOL(&Properties[8].vValue) = VARIANT_TRUE;
Thanks,
Jason
|
|
|
|
|
Hi all,
I created a COM, in which I defined an enum
typedef enum
{
Time_Undefined,
CA,
ms,
s
}TimeBase;
When I import this COM into a program written in C++, everything is fine. But if I import this COM into matlab, Matlab doesn't recognise the variable type above.
Does anyone know how to solve this problem.
Thanks in advance.
|
|
|
|
|
Hi!
I designed COM+ Service with .NET. (Window2003)
I deployed My COM+ Service to ClientPC. (WinXP)
(deployed type is Application proxy)
I installed deployed proxy( .MSI file) at Client PC. (installation success)
I confirmed that proxy is running.
but, when i called proxy method, error occurred.
Msg is "access is denied".
Event log is that
"aceess is denied at DCOM", while server computer is activating, this error is occurred".
i changed my COM Properties(Permission, Security ...) according to other DCOM Access Tips.
but, it didn't work.
Please, give me an answer.
Thanks for regards.
|
|
|
|
|
I made a COM (dll) server, i hope it will work in the local
network as a DCOM , because i haven't tried it yet. So it
is three tier Database Architecture, the client programm
sends a query to the server programm ant it sends a CSV
formated data.
The first question - i tried to use ADO (_Recordset) - as
return parameter, but had error in the IDL file, i didn't
know how to avoid it, and i changed it to IUnknow, but in
the client programm i couldn't dispatch it: i did this:
In The Client:
_Recordset* pRecordset = pDatabase->GetMaterials();
ANd it ruturns 0 = WHY???
In The Server:
GetMaterials(IUnknown* pRecordset)
{
_RecordsetPtr p(__uuidof(_Recorset))
//Some Query Procedure
//And in the finish
_RecordsetPtr->QueryInterface(__uuidof(_Recordset),(void**)
&pRecordset);
return S_OK;
}
And Another Question.
Server Should be able to change the address of Database.
For example now = the addres is C:\econ.mdb;
but if the database in other place?
I tried to use GetModulFileName() - but it returned -
C:\Windows\System32\Svchost.dll.
The Main question is - how to find out where my dll
placed...
Thanks.
|
|
|
|
|
I have this strange bug witih safearrays. I was hoping you understood what is going on, so I could learn something from my mistake.
The interface I’ve designed has a method Foo
[id(7)] HRESULT Foo([in] SAFEARRAY(double)* pSA);
The function goes like this:
Foo(SAFEARRAY** pSA)
{
//destroy the incoming array
SafeArrayDestroy (pSA);
//create a new one of desired size
*pSA = SafeArrayCreateVector(VT_R8,0,10);
return S_OK;
}
In VB, I am calling the function:
Public Sub Func()
Dim arr1() as double
Dim arr2(1) as double
Obj.Foo(arr1)
MsgBox UBound (arr1)
//messagebox reports UBound is 9
Obj.Foo(arr2)
MsgBox UBound (arr2)
//messagebox reports UBound 1
End Sub
|
|
|
|
|