|
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_
|
|
|
|
|
What event you hook in DispEventAdvise?
Also you shure that DispEventAdvise called sucessfully?
|
|
|
|
|
I want to create a smart tag application using the Word Document project in .Net 2.0. The problem I should be able to show the smart tag when the user types on the word doc.
Any help would be appreciated
|
|
|
|
|
Hi,
I'm experiencing and issue regarding System.AccessViolationException : Attempted to read or write protected memory that occurs since Vista. On XP's or previous, everything run fine. To be more specific. I have a C++ ATL/COM object (created in VS 6) that is wrapped in C# .NET 2.0 . Problem occurs when handling Strings.
I've created COM using standard tools in VS 6.
this is the method definition from Interface IDL file :
[id(9), helpstring("method GetString")] HRESULT GetString([out] LPSTR* word, [out, retval] int* count);
Inferface .h Header file :
STDMETHOD(GetString)( LPSTR* word, int* count);
Code Inferface.c file :
STDMETHODIMP CLicenser::GetString(LPSTR* word, int *count)
{
*count = this->helperClass.GetCount();
*word = this->helperClass.GetWord();
cout << "word:" << *word << endl;
return S_OK;
}
Method definition in C# wrapper looks like:
int IClassNameObject.GetString(out string);
Anytime this method is called, it finishes properly (also including that Console output word:[whatever word contains]), besides in Vista, it throws that System.AccessViolationException with name of that (GetString) method after it finishes.
Method is Supposed to return a count and fill a supplied string.
If u need I can create sample project / dll , I don't have one now....
zilo
|
|
|
|
|
From your description, it looks like the problem is with the helperClass member. How does that work?
Nathan
|
|
|
|
|
If not used in any other projects I would strongly recommend that you stick to Automation-compatible types, so here you would use a BSTR rather than LPSTR. .NET understands Automation types better than raw types.
If you can't do this, you need to ensure that the marshalling and memory model are followed correctly. You need to tell MIDL that the parameter is actually a null-terminated string (use the string attribute in addition to out ) so that the data is marshalled correctly. Otherwise it assumes that the LPSTR points to a single char .
For returning a string, you must return a new buffer allocated with the system allocator, CoTaskMemAlloc . I suspect what's happening is that .NET is trying to free the returned pointer by calling CoTaskMemFree and in Windows XP, you were getting away with it.
DoEvents : Generating unexpected recursion since 1991
|
|
|
|
|