|
Hi all,
Does anyone know how I can initialize a VMI interface for Network adapters in Borland C++ 2006.
The class Win32_NetworkAdapter is not recognized by C++ Builder.
Generally is there any other means to detect and control (enable/disable) WiFi and Ethernet network adapters?
Thanks,
Nektarios
|
|
|
|
|
Hi All,
I need a documentation proof for the following observation i have made(presuming my observations are correct )
I have written a addin for Microsoft Excel.
This addin handles the CLOSE event from the Excel.
But now , I have a Macro in an Excel sheet which is also listening for the close event.(the macro is as below)
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If MsgBox("Confirm exit", vbYesNo) = vbNo Then
Cancel = True
End If
End Sub
And in the Addin , i am using the Cancel parameter as below.
OnWorkbookBeforeClose(IDispatch* pWorkbook, VARIANT_BOOL* pbCancel)
{
//So here pbCancel value is depending on what is clicked in that message box --
// As it is seen Message box has two buttons "Yes" and "No"
// If "No" button is clicked , the Cancel parameter value we get is "True"
// If "Yes" button is clicked, the addin does what is intend it to do.(i:e it closes the Excel)
}
As it is understood
This macro pops up a message box and can alter the "cancel" depending on what is clicked.
And in the Addin,
what i get now is the edited value of the "Cancel" parameter if "NO" button is clicked.
So, what i am assuming is, THE EVENT FIRST GOES TO THE MACRO AND ONLY THEN COMES TO MY ADDIN.
So, is my assumption Correct, if so , can i have some Documentation proof for the same(i:e - The control goes to the macro first and then will be sent to the Addin's (if any))
So, has any one come across the same situation.
It would be of great help if you reply me on this.
Thanks in Advance.
Harish
|
|
|
|
|
Hi ,
i have a vb com component dll , can i pass a parameter to this dll from the windows component services ?
i need that coz the dll connect to a database so i want to send the database from outside and not be
hard coded.
thanks
|
|
|
|
|
Hi all.
This is my 1st post to the Code Project so please excuse me if I step on some toes.
My question relates to polymorphism (I'm using VS 8.0 with ATL/COM). Assume the following (off the top of my head). What I want to do is to have a ITestOne interface with CTestOne implemented and a ITestTwo interface with CTestTwo implemented. I want to use ITestTwo to access ITestTwo interface implementations and to access ITestOne Interface implementations. I will have other classes derived from ITestTwo (e.g., ITestThree, ITestFour) and CTestThree derived from CTestTwo, etc.
Any suggestions???
TIA,
Kim
[
object,
uuid(F799607A-47E7-4582-B056-9FD4F5381BA5),
helpstring("ITestOne Interface"),
pointer_default(unique)
]
interface ITestOne : IUnknown{
};
[
object,
uuid(9AE009F8-99D9-4C4A-B0BC-9A34EEFCF78B),
helpstring("ITestTwo Interface"),
pointer_default(unique)
]
interface ITestTwo : IUnknown{
};
[
uuid(B7AB057E-F270-4019-966F-52E9994F82C2),
version(1.0),
helpstring("COMTest 1.0 Type Library")
]
library COMTestLib
{
importlib("stdole2.tlb");
[
uuid(F019A63E-D8ED-463B-AB5F-996A9231E448),
helpstring("TestOne Class")
]
coclass TestOne
{
[default] interface ITestOne;
};
[
uuid(31E6DA9C-DE0D-4B69-A259-1D39E136D31F),
helpstring("TestTwo Class")
]
coclass TestTwo
{
[default] interface ITestTwo;
};
};
Now I want to _really_ derive ITestTwo from ITestOne so both interfaces will be available in ITestTwo. To do this I change the following:
From: interface ITestTwo : IUnknown {};
To: interface ITestTwo : ITestOne
So far so good???... If so I then should be able to do the following (I only added the TestOneInterface() function to existing code generated by VS):
/**** CTestTwo Declarations ****/
class ATL_NO_VTABLE CTestOne : public CTestTwo
public CComObjectRootEx<ccomsinglethreadmodel>,
public CComCoClass<ctestone, clsid_testone="">,
public ISupportErrorInfo,
public ITestOne
{
public:
CTestOne()
{
}
DECLARE_REGISTRY_RESOURCEID(IDR_TESTONE)
BEGIN_COM_MAP(CTestOne)
COM_INTERFACE_ENTRY(ITestOne)
COM_INTERFACE_ENTRY(ISupportErrorInfo)
END_COM_MAP()
// ISupportsErrorInfo
STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct()
{
return S_OK;
}
void FinalRelease()
{
}
public:
/**** CTestOne Implementations ****/
STDMETHOD(TestOneInterface)( void ) { }
};
OBJECT_ENTRY_AUTO(__uuidof(TestOne), CTestOne)
/**** CTestTwo Declarations ****/
class ATL_NO_VTABLE CTestTwo :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CTestTwo, &CLSID_TestTwo>,
public ITestTwo
{
public:
CTestTwo()
{
}
DECLARE_REGISTRY_RESOURCEID(IDR_TESTTWO)
BEGIN_COM_MAP(CTestTwo)
COM_INTERFACE_ENTRY(ITestTwo)
END_COM_MAP()
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct()
{
return S_OK;
}
void FinalRelease()
{
}
public:
/**** CTestTwo Implementations ****/
STDMETHOD(TestTwoInterface)( void ) { }
};
OBJECT_ENTRY_AUTO(__uuidof(TestTwo), CTestTwo)
|
|
|
|
|
Hello
I am using multicast delegate as follows, but the effect in the server is undesirable:
Thing.OnEvent1 += new IThingEvents_OnEvent1EventHandler(OnEvent1);
Thing.OnEvent2 += new IThingEvents_OnEvent2EventHandler(OnEvent2);
Thing.OnEvent3 += new IThingEvents_OnEvent3EventHandler(OnEvent3);
The problem is that the (C++ COM) server it thinks it has all the connections for each event.
So in the below example it trys to send the event 3 times. Apart from the unecessary processing, I am worried it is making the inter-process call each time (the incorrect calls are being thrown away on the client side somewhere).
HRESULT Fire_OnOrderCancel(lots of params)
{
HRESULT hr = S_OK;
T * pThis = static_cast(this);
int cConnections = m_vec.GetSize();
for (int iConnection = 0; iConnection < cConnections; iConnection++)
{
pThis->Lock();
CComPtr punkConnection = m_vec.GetAt(iConnection);
pThis->Unlock();
IDispatch * pConnection = static_cast(punkConnection.p);
if (pConnection)
{
CComVariant avarParams[20];
//set avarParams
CComVariant varResult;
DISPPARAMS params = { avarParams, NULL, 9, 0 };
hr = pConnection->Invoke(1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, ¶ms, &varResult, NULL, NULL);
}
}
return hr;
}
What c# thing do I need to use to get the desired behaviour, namely events to be fired once and the c# client to do the correct delegation?
Many Thanks
deds
|
|
|
|
|
Hi,
I need to get the physical name of the currently selected spreadsheet, like MySpreadsheet.xls. How do I do this?
Brendan
|
|
|
|
|
Application.ActiveWorkbook.Name
Application.ActiveWorkbook.FullName
in terms of your programming language.
With best wishes,
Vita
|
|
|
|
|
Hai all..
I am using ISpecifyPropertyPages and OleCreatePropertyFrame to displayed webcam videostreaming property dialog but i want get the output image size that is selected from webcam property dilaog.. Pls help me some sample code.
Thanks in advance
Mani..
|
|
|
|
|
We have a windows service executing on a windows 2003 box as the 'LocalSystem' account.
This service spawns off a executable.
The executable in turn tries to create an instance of a COM object housed in a dll.
However we find that in a particular host,the executable fails at the point where it tries to intialize COM through CoInitialize.
We believe it is due to some permission violations on the box.
What are the services/permissions to be in place for a windows service account to be able to invoke COM?
|
|
|
|
|
The problem is that the application does not even start executing a single line and returns with a file not found error ;however when the same application is executed from console(and not from a service as 'localsystem' account),it executes fine.
But we found that when we comment off the 'CoInitiliazie' call then things seem fine for the application (though we obviously cannot invoke COM)
|
|
|
|
|
So were you able to figure out what was wrong with CoInitialize?
|
|
|
|
|
I want to write a ActiveX control for word, which has the transparent effect,which can't envelop the test in word document no matter what drawn in the control. But I don't know how to achieve the transparent effect. My English is poor. I hope you can follow me and can help me
|
|
|
|
|
Does anyone know how to use these new Vista COM objects in a C# project. I am talking about the IFileDialog objects/classes/libraries/idl's and all that inherit from it.
Thanks,
Adam
|
|
|
|
|
The best place to point you is probably the Common Item Dialogs[^] documentation.
I would expect Microsoft to change OpenFileDialog (etc) to eventually wrap these new interfaces, for whatever new functionality is available (if they haven't already in v3.5). What specifically does this do that you don't get from OpenFileDialog ?
DoEvents: Generating unexpected recursion since 1991
|
|
|
|
|
Follow this step:
1.You can download
Windows® API Code Pack for Microsoft® .NET Framework
2.See how the "\Windows API Code Pack 1.1\source\WindowsAPICodePack\Shell\CommonFileDialogs\CommonFileDialog.cs" make use of IFileDialogCustomize from com.
3.If you want to add a stuff to the "Open" dropdownlist,
you can write code below
customize.EnableOpenDropDown(0);
customize.AddControlItem(0, 0, "Open as XXX");
customize.AddControlItem(0, 1, "Open in YYY");
Note: 0 is the Open Button ID
After user selected, you can get the selectedIndex through
this.customize.GetSelectedControlItem(0, out openindex);
Note again: 0 is the Open Button ID
And then you can do something imply with filename and this openindex.
Wish to help you~
|
|
|
|
|
hi,
I am not familiar with COM objects,we are trying to run a process that will replicate data from notes database to SQL database,this is developed using COM objects by the person who is not available now.
We have a process called replicaNotesToSQL.exe running in the process list of tast manager and this process is suppose to populate SQL tables with Notes data,This worked fine,until we turned the process off and tried to resatart it,replication is nomore done,but we can see the exe running in the process list.
I have no idea if this is a problem with COM,but the applciation is developed using COM objects.
All we have is a project file in visual studio developed using C#(replicaNoteToSQL.sln) and output file folder with 2 output files(ReplicaNotesToSQL.exe and ReplicaNotesToSQl.config)
when you run the ReplicaNotesToSQl.exe the replication should take place and SQL tables has to be populated.
If you want to see the code i can send you the code,when I debug the Code there are no errors and no warnings.
Thanks in advace.
|
|
|
|
|
how selective loading BHO in Chtmlview environment
wqewqqeweqwrwerewrwe
|
|
|
|
|
Please don't cross-post, it's considered rude and won't help you get an answer to your question any faster. The original message is here[^].
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
|
|
|
|
|
Hello dear COM experts,
While trying to compile a VC++ 6.0 project with VC++ 7.1, I have got the following error :
d:\TESTINGONLY\dbstudio\DSIFormat.h(58) : error C2664: '_com_ptr_t<_IIID>::_com_ptr_t(int)' : cannot convert parameter 1 from 'ATL::CComPtr<T>' to 'int'
with
[
_IIID=_com_IIID<StdFormat::IStdDataFormatDisp,& _GUID_6c51b910_900b_11d0_9484_00a0c91110ed>
]
and
[
T=StdFormat::IStdDataFormatDisp
]
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
This error is caused by the following instanciation
CComPtr<StdFormat::IStdDataFormatDisp> m_fmtBinary;
StdFormat::IStdDataFormatDisp is located in a .tlh file.
I am a newbee with COM and I guess it is an interface generated by the compiler.
Here is its definition
struct __declspec(uuid("6c51b910-900b-11d0-9484-00a0c91110ed"))
IStdDataFormatDisp : IDataFormatDisp
{
//
// Property data
//
__declspec(property(get=GetType,put=PutType))
enum FormatType Type;
__declspec(property(get=GetFormat,put=PutFormat))
_bstr_t Format;
}
It derives from
struct __declspec(uuid("e675f3f0-91b5-11d0-9484-00a0c91110ed"))
IDataFormatDisp : IDispatch
{};
IDataFormatDisp does nothing so I wonder why not deriving IStdDataFormatDisp direcly from IDispatch
Indeed the project works fine with visual c++ 6.0.
I thank you very much for your help.
|
|
|
|
|
.tlh files are generated by the compiler when it encounters a #import directive. The exact behaviour of what the compiler does depends on the options to that directive.
The compiler has a COM support library which already supplies smart pointers, so use of ATL's CComPtr is unnecessary. See the definitions of _com_ptr_t . If you don't want the compiler to generate smart pointer wrappers, specify no_smart_pointers in the #import directive.
I would generally try to avoid reusing the .tlh file from a previous compilation session, particularly when moving between compilers. The underlying compiler support classes may have changed. That's probably what's happened here.
DoEvents: Generating unexpected recursion since 1991
|
|
|
|
|
Hi All,
I am using the VC++ Single Doc Template for Building an MFC Application with supports OLE Compound Document as FULL SERVER.
When the user drops a file generated by my application into MSWORD, I want to insert the file in MSWORD showing the file path.
for eg. Assume the MFC App, saves a document in the location c:\folder\ as "fileondisk.xht". If I drag the file from desktop and drop it on MS-WORD, the file should be embedded in MS-WORD and print the name of the dragged file as "c:\folder\fileondisk.xht" in the embedded region.
Can some one please help me in getting the path of the file name dropped on MS-Word. I can show some hard-coded text in the embedded region, but I need to display the actual path of the file name on the disk.
Thanks
Sunil
|
|
|
|
|
at the risk of being pelted with fruit / eggs or worse...
What is this L"" notation? It isn't particularly easy to find with a search engine (Here or at google), as I suppose this[^]
isn't what I'm looking for..
I'm also looking for a solid COM reference (book, website, wiki, whatever) if you happen to have any favorites that you'd like to share.
|
|
|
|
|
|
Thanks. I couldn't find that #define in any of the code, but that makes so much sense now
|
|
|
|
|
Assuming I understand what you're referring to, you put L in front of a string in C++ to signify that it should be a Unicode string (using wide-characters). T is often used instead, as this is has the same effect if the code is being compiled with Unicode (i.e. _UNICODE is #defined . In fact, it is #defined as L), and otherwise has no effect (the preprocessor strips it out).
Can't help with the COM reference I'm afraid, except what's on this site and in the MSDN documentation.
|
|
|
|
|