|
Ju@ncho wrote: Do you know if i can use C++ objects as properties in ATL or i have to use COM objects, in that case which parameters i Have to use in the definition of the property in mi idl file?
COM objects would definitely be more apropriate. They only need to have CoClasses if you need a client to be able to create instances of them directly. Within your own code, you can create an object without a CoClass using CComObject<yourclass>::CreateInstance()</yourclass>
It is possible to use plain structures if you don't need to fully support automation. (Visual Basic can handle structures though.) You need to define your structures in the idl file, and you should give each structure type its own guid.
Nathan
|
|
|
|
|
Hello Ju@ncho,
There are two ways you can achieve your design :
1. By declaring the object properties "FramesOfReference" and "Series" as of their individual interface types (e.g. IFramesOfReference, ISeries, respectively) :
interface IStudy : IDispatch
{
[propget, id(1), helpstring("property FramesOfReference")]
HRESULT FramesOfReference([out, retval] IFramesOfReference** pVal);
[propput, id(1), helpstring("property FramesOfReference")]
HRESULT FramesOfReference([in] IFramesOfReference* newVal);
}
interface IFramesOfReference : IDispatch
{
[propget, id(1), helpstring("property Series")]
HRESULT Series([out, retval] ISeries** pVal);
[propput, id(1), helpstring("property Series")]
HRESULT Series([in] ISeries* newVal);
}
2. By delaring the object properties as of type VARIANT :
interface IStudy : IDispatch
{
[propget, id(1), helpstring("property FramesOfReference")]
HRESULT FramesOfReference([out, retval] VARIANT *pVal);
[propput, id(1), helpstring("property FramesOfReference")]
HRESULT FramesOfReference([in] VARIANT newVal);
};
interface IFramesOfReference : IDispatch
{
[propget, id(1), helpstring("property Series")]
HRESULT Series([out, retval] VARIANT *pVal);
[propput, id(1), helpstring("property Series")]
HRESULT Series([in] VARIANT newVal);
};
I have written a set of sample codes. Email me :
bio_lim_2004@yahoo.com
and I will send it to you.
Best Regards,
- Bio.
|
|
|
|
|
Quit posting the same question but with different termnology. Seen the same post in the ATL forum. But asking for ATL namespace.
|
|
|
|
|
Hey guyz,
Can somebody give me a simple COM+ example based on Client-Server type?
I tried to find on the net but couldnt find any.. A simple program would do too..
Thanks.
------------------------------------------------------------------
Life would have been much easier if I had the source-code!!
|
|
|
|
|
Swader wrote: Can somebody give me a simple COM+ example based on Client-Server type?
I tried to find on the net but couldnt find any.. A simple program would do too..
What features of COM+ as opposed to plain COM do you want an example of? You might get results searching for examples of the features.
Nathan
|
|
|
|
|
Hi,
We have a windows application developed using c#. We have a process in this application where excel objects are created some data is populated and some calcualtions are done too (used various excel objects like workbook, sheet, range). The required tasks are being executed fine but there are instances where the same tasks fail. An error is being thrown at that time and it is "THERE IS NOT ENOUGH MEMORY TO RUN MICROSOFT EXCEL. PLEASE CLOSE OTHER APPLICATION AND TRY AGAIN" The error is pointed to Excel object creation and it shows - "An unhandled exception of type System.Runtime.InteropServices.COMException occurred in application_name.exe"
What could be the cause for the error? Please provide some suggestions.
Thanks
gauthee
|
|
|
|
|
gauthee wrote: "THERE IS NOT ENOUGH MEMORY TO RUN MICROSOFT EXCEL. PLEASE CLOSE OTHER APPLICATION AND TRY AGAIN"
Sohail
modified 21-Apr-21 21:01pm.
|
|
|
|
|
Hello all,
How to automate Excel 2007 with C# 2003....
As i tried to automate Excel 2007 exitsing project (which is implemented in C# 2003 & used Excel2003) ............
When i did .... it genrate errors...
Microsoft.Office.Interop.Excel.Chart' is defined in multiple places;
I am unable to understand this error ...
plz help me out...
THX
|
|
|
|
|
I've created a COM library that serves as a control/object spy, from which i would like to make calls from a vbscript.
Here's a snippet of the vbscript:
<br />
Set o = CreateObject(myBot.Windows)<br />
<br />
Path = "c:\test.exe"<br />
WndTitle = "TestApp"<br />
<br />
Parent = o.Run( Path, WndTitle )<br />
If Parent Then<br />
WScript.Echo "We've successfully Launched " & WndTitle & "!"<br />
<br />
res = o.ClickButton( Parent, "Button1", "WindowsForms10.BUTTON.app.0.378734a" )<br />
<br />
'.... and so on<br />
<br />
Else<br />
'... and so on<br />
End If<br />
Here's the thing,
The vbscript is able to run the first function "o.Run(...)", but when i try executing the next function "o.ClickButton(...)", I get a "Windows Script Host" error message saying "Class doesn't support Automation: 'ClickButton'.
I've removed all instances of the dll (com library) from the 'global assembly cache' using gacutil, and un-registered it using 'regsvscs /unregister'
Does anyone have a good idea of where I could begin to resolve this issue...?
|
|
|
|
|
Does your Library support automation? I mean, how ClickButton method is declared?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
In code it's:
<br />
Public Function ClickButton(ByVal hWndParent As IntPtr, _<br />
ByVal strCaption As String, _<br />
ByVal strClass As String) As Int32<br />
<br />
Dim newWnd As IntPtr<br />
Dim ctrlID As Int32<br />
<br />
<br />
ctrlID = myBot.GetObjectHandleA(hWndParent, strClass, strCaption)<br />
If ctrlID Then<br />
newWnd = myBot.SendMessage(ctrlID, BM_CLICK, 0, 0)<br />
End If<br />
<br />
If newWnd Then<br />
Return newWnd<br />
Else<br />
Return 0<br />
End If<br />
<br />
End Function<br />
<br />
let me know...
|
|
|
|
|
IntPtr is not an Automation-compatible type. You'll have to define two versions of the interface, one for 32-bit systems and one for 64-bit, using an Integer or a Long as appropriate.
DoEvents: Generating unexpected recursion since 1991
|
|
|
|
|
Thanks, t'was a slight oversight on my part...
I've changed the variable declarations and it works now...
Again, Many thanks!
|
|
|
|
|
hello, have some troubles getting some code working.
if you can have a look.
I have the code below, and it does insert only 2 menu items:
"Check Out" and "Delete File".
More than this at "::InvokeCommand(LPCMINVOKECOMMANDINFO pCmdInfo)"
how do I make the difference between what menu item was clicked ?
thanks
::QueryContextMenu( HMENU hmenu, UINT uMenuIndex, UINT uidFirstCmd,
UINT uidLastCmd, UINT uFlags )
{
const int size = 4;
const char* menuLabels[size] ={
"Check Out",
"Check In",
"Download",
"Delete File"
};
int menuItemPosition = uMenuIndex;
UINT menuItemID = uidFirstCmd;
for(int i=0; i<size; i++)
{
MENUITEMINFO menuItemInfo;
memset( &menuItemInfo, 0, sizeof(MENUITEMINFO) );
menuItemInfo.cbSize = sizeof(MENUITEMINFO);
menuItemInfo.fMask = MIIM_DATA | MIIM_TYPE | MIIM_ID;
menuItemInfo.fType = MFT_STRING;
menuItemInfo.wID = menuItemID++;
menuItemInfo.dwItemData = menuItemID - 1;
menuItemInfo.dwTypeData = (LPSTR)menuLabels[i];
menuItemInfo.cch = strlen(menuLabels[i]);
InsertMenuItem( hmenu, menuItemPosition++, TRUE, &menuItemInfo );
}
modified on Friday, December 14, 2007 2:37:29 AM
|
|
|
|
|
Hi everybody!!
I'm developing a web application that has embedded an activeX control. For some specific purposes I need the activeX to access the DOM elements of the page that contains it, but I don't know if this is possible. So, I need to now: first if this can be done and if so, how I could do it.
Any help or ideas will be appreciated.
Thanks
Kenia
Kenia
|
|
|
|
|
yes its possible, get IHTMLDocument2 pointer/object and you can access the element info, using several Interfaces provided by IE. look in MSDN for IHTML** interfaces...
Cheers,
Vishal
|
|
|
|
|
Thanks Vishal for your quick reply, I hope your ideas help me doing the task.
Cheers
Kenia
|
|
|
|
|
Hi All,
I am working on a project that uses interop.word COM object. But I am not able to get width and style of page border of document. Can I know how I'll get these values?
Thanks in advance,
Priyank
|
|
|
|
|
Hi
I am reading this article:
http://www.ddj.com/cpp/184403558
It says:
Suppose you want to call methods on a COM object or Automation Server, but have no header files, type library (discussed later), or any programmatic information about the object. Late binding is what makes this possible. In fact, with late binding you can even instantiate and use a COM object [2] on a remote machine.
And in his code:
wcscpy(progid, L"comcalc.calc"); <br />
CLSIDFromProgID( progid, &pclsid); <br />
HRESULT hr = CoCreateInstance(pclsid, NULL, CLSCTX_ALL, IID_IDispatch, (void **)&idsp);
While late binding , If we have nothing (no need) about COM object in remote server. How could CLSIDFromProgId work? Something must be registered in client computer before executing this line so we need dll/exe file(server) itself. Am i wrong?
I don't understand how CLSIDFromProgId could work here.
Thanks...
Edit/Delete Message
|
|
|
|
|
sawerr wrote: wcscpy(progid, L"comcalc.calc");
CLSIDFromProgID( progid, &pclsid);
HRESULT hr = CoCreateInstance(pclsid, NULL, CLSCTX_ALL, IID_IDispatch, (void **)&idsp);
While late binding , If we have nothing (no need) about COM object in remote server. How could CLSIDFromProgId work? Something must be registered in client computer before executing this line so we need dll/exe file(server) itself. Am i wrong?
IMHO the above code snippet is executed on the remote machine, where the COM server is registered.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Hi,
i am trying to a add ins which can automatically create a Button inside the send item of Outlook 2007. I have used Visual Studio Tools for Office(VSTO) and created menubars, but i need button inside the send items. Could some one help me in this.
Regards,
Jerome
|
|
|
|
|
AFAIK has the Outlook COM-API a lot of collections, so can find all objects in the right collection. You got to find the right one (first in the docs and than in your program).
Greetings from Germany
|
|
|
|
|
Hi,
I've managed to create my own custom web browser using IWebBrowser2. Also, I managed to
configure HostUI things so that the browser uses theme. Now my final problem;
The ajax behavior is different from IE7 even if I use Vista to run my own browser application.
In IE7, when I click link which executes Javascript then "click" sound does not happen, but
my own browser like other customized browsers using IWebBrowser2 or MSHTML, makes
"click" sound and the web application's ajax behavior does not work like IE7.
How can I make my own browser's ajax behavior like IE7? I've created my browser application
using C and I can upload my code if needed.
Has anyone experienced this problem? It seems that as I said before, all other browsers which
uses IWebBrowser2 or IE's engine does show this behavior.
Thanks in advance.
|
|
|
|
|
I have to use more than 255 ocx im a single dialog...I am using MDS 5.0..How could I do it.
|
|
|
|
|
Hi All,
I am currently developing an Addin for Outlook 2000 and have to intercept the Send Mail event. Before sending the mail item I need to modify the Subject line to something other than original and then send the mail. I have tried DispEventAdvise but not with any success. Any pointers/suggestions are highly appreciated.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|