|
ForNow wrote: Filename is Of type LPCTSTR Then you should provide a LPCTSTR in your call, rather than providing a LPCSTR , and then telling the compiler to ignore the fact that the string may not be in the correct format. Lookup the use of the TEXT() macro and make sure your strings are generated correctly, and read the documentation on the correct use of casts.
Use the best guess
|
|
|
|
|
The Text macro interperts the string if ansi is defined according to the current codepage
I think the string I am passing is being interpetted correctly
looking at the varaint type of the file it was being interpetted as a VT_BSTR
and had the correct value
case VT_BSTR:
{
LPCOLESTR lpsz = va_arg(argList, LPOLESTR);
pArg->bstrVal = ::SysAllocString(lpsz);
if (lpsz != NULL && pArg->bstrVal == NULL)
AfxThrowMemoryException();
|
|
|
|
|
ForNow wrote: I think the string I am passing is being interpetted correctly By luck, not judgement; if your project is built in UNICODE mode then it will be wrong. You should not use a cast unless you understand the consequences. Instead, use the TEXT() macro to ensure that your character string is generated in the appropriate character set to match the build. Your cast in the foregoing code is telling the compiler to ignore the fact that the string may be in the wrong character set.
Use the best guess
|
|
|
|
|
I am getting the above error from WorkBooks::OpenText
As all of the 18 paramters are optional
besides the first
I VT_NULL'ed all of them besdies the file name and still got the error
Since there is a lot of security where I work
I used the program name as the text file and still got the above errors
Any Help would be appreciated
|
|
|
|
|
You should make an effort to research error codes first: see here[^] for a number of possibilities.
|
|
|
|
|
Hi,
I am get an assert error when calling WorkBooks::OpenText
I traced it down the code to dispatch->invoke and the return code from that
was 0x80020008 DISP_E_BADVARTYPE One of the arguments in rgvarg is not a valid variant type.
I had a VARIANT for all my arguments besides the 5th which is a long
My question is then the following almost all the paramters are optional
besdides the first which is the filename
I assumed optional was a NULL so.
I coded the following for NULL
VARIANT varfalse.
varfalse.intVal = 0;
varfalse.vt = VT_INT;
is this correct ?
thanks
.
|
|
|
|
|
ForNow wrote: is this correct ?
no ... you should use
varfalse.vt = VT_EMPTY
or
varfalse.vt = VT_NULL
|
|
|
|
|
Hi,
I getting the above return code the following is my code sequence
CLSID clsid;
HRESULT hr = CLSIDFromProgID(L"Excel.Application",&clsid)
IDispatch *pWApp;
hr = CoCreateInstance(clsid, NULL, CLSCTX_LOCAL_SERVER,
IID_IDispatch, (void **)&pWApp);
LPOLESTR ptName = (LPOLESTR) _T("OpenText");
DISPID dispID;
hr = pWApp->GetIDsOfNames(IID_NULL, &ptName, 1 , LOCALE_USER_DEFAULT,&dispID);
I am using VIsual C++ 6.0 excel 2003
Thanks
|
|
|
|
|
|
For CoInitialize I am getting a 0x00000001 S_FALSE (already initliazed)
For CLSIDFromProgID I am getting a 0x00000000 S_OK
For CoCreateInstance I am getting a 0x00000000 S_OK
For GetIDsOfNames I am getting a 0X80020006 DISP_E_UNKNOWNNAME
Thanks
|
|
|
|
|
I have tried this code with a variety of names (supposedly in Excel) but get the same response each time. The MSDN documentation is not very helpful so I'm not sure where to go from here. However, once again I would ask, what problem are you actually trying to solve?
|
|
|
|
|
I just tried again with the name "worksheets" and it worked. So, the code is correct, but the name you are using is not.
|
|
|
|
|
Very good you are right on the key is the first paramter
_In_ LPCOLESTR lpszProgID,
The Class id name, Excel is divded into for objects Application, Workbook, Worksheet, and I think Range
In Visual C++ 6.0 there is a OLE/COM viewer which might kind a hint of the names
What I am trying to do,
My boss gave me an assignment to automate the pasting of .txt file onto a Excel Worksheet
I wanted this app to be MFC based as I might need to employ windows services
Hence the main thread CWinApp and associated mainwindow
Thanks again for your help
|
|
|
|
|
|
|
I am going to go with the method you pointed out had using AS i GET BY THE
DISP_E_UNKNOWN
Maybe the way excel was installed it ddn't make entries
for HKCR\Typlib for the excel methods properties
Thanks
|
|
|
|
|
|
|
Greetings!
I have a complex scheduling application written in VB.NET (.NET Framework 4.0) that must use a Data Access Layer consisting of a bunch of C++ DLLs which are in-turn accessed via a COM API library. Of course when the COM API is referenced in the VB.NET application an Interop Assembly is created by Visual Studio.
The problem I am having is that some users are experiencing an APPCRASH (c0000005 exception code) several times per day, but this only occurs if they have the my application open all of the time and they are continually moving between it and other apps (e.g. to MS Word or MS Outlook etc). The APPCRASH occurs as soon as the shift their focus back to my application. I do have a suspicion as to why this may be occurring but my lack of knowledge of the way in which Windows and the .NET Framework manage memory precludes me from being sure.
My suspicion is that when users are using other applications for some time, and Windows requires more memory for those other apps, that it caches my app’s memory to disk. When they return to my app then Windows loads it back into memory, but because I am using COM it is placing the COM related memory into a different address and then when my app attempts to access the COM objects then an Access Violation is occurring and hence the APPCRASH. The faulting module is nearly always the COM API library, but sometimes it is ntdll.dll or clr.dll.
Does this sound like a reasonable hypothesis? And if so, what are my options (if any) for resolving this?
Here are a sample of problem signature traces. Note that they do not all have the same faulting module.
Signature du problème :
Nom d’événement de problème: APPCRASH
Application Name: VM2305.EXE
Application Version: 2.1.0.5
Application Timestamp: 4f44820b
Fault Module Name: a4wcomex.dll
Fault Module Version: 6.0.0.0
Fault Module Timestamp: 4cfb1354
Exception Code: c0000005
Exception Offset: 0001de92
Version du système: 6.0.6002.2.2.0.768.3
Identificateur de paramètres régionaux: 3084
Problem signature:
Problem Event Name: APPCRASH
Application Name: VM2305.EXE
Application Version: 2.1.0.9
Application Timestamp: 4fa218fd
Fault Module Name: clr.dll
Fault Module Version: 4.0.30319.261
Fault Module Timestamp: 4ec9f6ff
Exception Code: c0000005
Exception Offset: 00020ed1
OS Version: 6.1.7601.2.1.0.256.48
Locale ID: 4105
Additional Information 1: 93e2
Additional Information 2: 93e2ab0171a7a6ff1415f9bd2ed3bdf7
Additional Information 3: be03
Additional Information 4: be03af409f1ea363e69fa074d659b668
Problem signature:
Problem Event Name: APPCRASH
Application Name: VM2305.EXE
Application Version: 2.1.0.10
Application Timestamp: 4faca846
Fault Module Name: StackHash_0a9e
Fault Module Version: 0.0.0.0
Fault Module Timestamp: 00000000
Exception Code: c0000005
Exception Offset: 08000400
OS Version: 6.1.7601.2.1.0.256.48
Locale ID: 3084
Additional Information 1: 0a9e
Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
Additional Information 3: 0a9e
Additional Information 4: 0a9e372d3b4ad19135b953a78882e789
Problem signature:
Problem Event Name: APPCRASH
Application Name: VM2305.EXE
Application Version: 2.1.0.10
Application Timestamp: 4faca846
Fault Module Name: StackHash_0a9e
Fault Module Version: 0.0.0.0
Fault Module Timestamp: 00000000
Exception Code: c0000005
Exception Offset: 41080414
OS Version: 6.1.7601.2.1.0.256.48
Locale ID: 3084
Additional Information 1: 0a9e
Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
Additional Information 3: 0a9e
Additional Information 4: 0a9e372d3b4ad19135b953a78882e789
Problem signature:
Problem Event Name: APPCRASH
Application Name: VM2305.EXE
Application Version: 2.1.0.16
Application Timestamp: 4fea898a
Fault Module Name: a4wcomex.dll
Fault Module Version: 6.0.0.0
Fault Module Timestamp: 4cfb1354
Exception Code: c0000005
Exception Offset: 0001de92
OS Version: 6.1.7601.2.1.0.256.48
Locale ID: 4105
Additional Information 1: 0a9e
Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
Additional Information 3: 0a9e
Additional Information 4: 0a9e372d3b4ad19135b953a78882e789
|
|
|
|
|
Tony Tullemans wrote: Does this sound like a reasonable hypothesis? No. Why, because if this was the case we would expect to see crashes occurring everywhere and all the time. The only way to identify what is happening is to add some debug code to your application so you capture more information prior to the crashes occurring.
|
|
|
|
|
Thanks for your reply Richard, but the problem is that the AccessViolationException very rarely ever occurs when the application is running within the VS development environment, and furthermore it does not occur on all client computers. The only common factors I have been able to establish is that (1) the user has had the program running for several hours, and (2) the user has just switched back to my application after using some other program.
I have come to this forum in the hope that anyone who may have experienced similar errors may give me some clue as to what to look for. I have literally spent over one hundred hours trying to debug this issue.
|
|
|
|
|
You have my sympathy, but unfortunately the only way to track this sort of error is to add logging and debugging code to your application. I worked in technical support for many years and often saw problems such as you describe, and yes, they were extremely difficult to diagnose.
|
|
|
|
|
That's not how paging works, addresses will be preserved. Get as many crash dumps as you can from the client and start debugging.
Steve
|
|
|
|
|
as the title, I try to use use webbrowser to visit many webs one by one without a break. the memory grows up little by little, finally my program crash down.
I did a lot research, but got little useful information,(somebody said that memory leaks,but I don't know the reason and how to avoid) so I'm here. my code like this.
try
{
_variant_t vTmp;
m_webBrowser.put_Silent(TRUE);
m_webBrowser.Navigate(strWeb, &vTmp, &vTmp, &vTmp, &vTmp);
}
catch (...)
{}
I will call this every 10 seconds continuously. any tips will be appriciate. thanks for your attention.
|
|
|
|
|
Hi,
I have a scenario where i should copy and register a com exe but the problem is i don't have admin rights on that pc.
I know that if it is a com dll then using manifest file i can use it without even registering.
Can someone suggest me if there is a way to register com exe without admin rights or use a unregistered com exe using the manifest file?
Thanks in Advance,
Hari krishna
|
|
|
|