|
Thank you.
That was very informative.
|
|
|
|
|
Has anyone here ever seen this error.
"fatal error C1084: Cannot read type library file: 'TLBs\astm.tlb': Error loading type library/DLL."
I really have no idea what is going on. I get that when doing a regual #import statement. We designed the TLB. The tlb file was just compiled with no errors. It isn't a sharing violation since i made a complete copy of the file just for use in this application. The TLB file comes from a ATL/COM project. (note: I have also posted this in the COM forum: Didn't really know where it belonged.) If anyone has seen this and knows whats going on please help. I have tried everything i can think of. There doesn't seem to be much of anything on the internet about it and there is NOTHING of MSDN about it.
Any help is greatly appreciated.
Joseph Dempsey
jdempsey@cox.rr.com
Joseph.Dempsey@thermobio.com
"Software Engineering is a race between the programmers, trying to make bigger and better fool-proof software, and the universe trying to make bigger fools. So far the Universe in winning."
--anonymous
|
|
|
|
|
Hello.
I am developing a project that includes a Dialog containing a CTreeCtrl object.
When running my application in a WindowsNT machine and i display the Dialog i can see correctly the CTreeCtrl.
But when i run my application in a Windows98 machine when i display the Dialog if i don´t click on the CTreeCtrl i can´t see it.
Could you help me?.
Thanks in advance
Yolanda
|
|
|
|
|
Is there a possibility to clear the output window content from C++ code ?
|
|
|
|
|
Yes. IIRC WndTabs (wndtabs.com and article(s) here at CodeProject) has complete access to the IDE.
|
|
|
|
|
Hi,
This is the code I use, the error occurs at line "delete [] helper", but why??
LPWSTR helper = new WCHAR[cchBufferSize+28];
...
...
delete [] helper; <-----here is the debug assert!
One more question: I'm working the first time with unicode strings and functions like wcs****
Will my app work in every microsoft OS or only on NT/2000?
|
|
|
|
|
I need to see the rest of the code.
Specially this part:
some string manipulations like wcsncpy and so on...
Cheers!!!
Carlos Antollini.
|
|
|
|
|
here is the complete code, hth:
LPWSTR wszURL = new WCHAR[cchBufferSize];
LPWSTR helper = new WCHAR[cchBufferSize+28];
helper = wcsrev(wszURL);
int len = wcslen(helper)-2;
wcsncpy(wszURL,helper,len);
helper = wcsrev(wszURL);
wcscpy(wszURL,helper);
wcsncat(wszURL, lpwszSearchURL, cchBufferSize);
ZeroMemory(lpwszSearchURL, wcslen(wszURL));
wcsncpy( lpwszSearchURL, wszURL, cchBufferSize);
delete [] wszURL;
delete [] helper;
|
|
|
|
|
Just hazarding a guess here, but I think your assignment to 'helper' on the line
helper = wcsrev(wszURL); are the cause of the difficulty. After this line I don't think helper points to the memory that was originally allocated.
Chris Meech
|
|
|
|
|
Hello All,
I need C++ classes for doing basic statistics-preferable a template based one!
Best regards,
Paul.
Paul Selormey, Bsc (Elect Eng), MSc (Mobile Communication) is currently Windows open source developer in Japan, and open for programming contract anywhere!
|
|
|
|
|
|
I mean basic mathematical statistics.
Best regards,
Paul.
Paul Selormey, Bsc (Elect Eng), MSc (Mobile Communication) is currently Windows open source developer in Japan, and open for programming contract anywhere!
|
|
|
|
|
Delphi can not use my lib file so how can I provide dll that I write in vc++ to client that works in Delphi ????
|
|
|
|
|
Is your DLL exporting C style functions or C++ classes?
Michael
|
|
|
|
|
I'm still working through the whole connection point fiasco, with mixed results. OK, I admit it, they aren't mixed, it all blows. I've done a *lot* of reading and at this point I am pretty confident that my connection point is set up properly on the ATL side. I added the IDL manually, like this:
interface ISAFileDB : IDispatch
{
[id(1), helpstring("method Connect")] HRESULT Connect([in] BSTR DatabasePath);
[id(2), helpstring("method CloseDB")] HRESULT CloseDB();
[id(3), helpstring("method ScanDir")] HRESULT ScanDir([in] BSTR dir, [in] BSTR substr, [in] BSTR suffix, [out] IEnumSAFileEntry ** Entered, [out] IEnumSAFileEntry ** Changed, [out] IEnumSAFileEntry ** Skipped);
[id(4), helpstring("method GetDatabase")] HRESULT GetDatabase([out] IEnumSAFileEntry ** Database);
[id(5), helpstring("method SearchDatabase")] HRESULT SearchDatabase([in] BSTR substr, [in] BSTR suffix, [out] IEnumSAFileEntry **Database);
[id(6), helpstring("method DeleteRecords")] HRESULT DeleteRecords([in] BSTR substr, [in] BSTR suffix, [in] BOOL bDelete, [out] IEnumSAFileEntry **Deleted);
[id(7), helpstring("method VerifyDB")] HRESULT VerifyDB([in] BOOL bDelete, [out] IEnumSAFileEntry **Deleted);
[id(8), helpstring("method DoTest")] HRESULT DoTest();
};
[
uuid(224F8579-E559-436C-9FDD-D0CC70E6E013),
version(1.0),
helpstring("SADatabase 1.0 Type Library")
]
interface ISAFileDBEvents : IDispatch
{
[helpstring("method OnTest")] HRESULT OnTest();
};
[
uuid(95B90562-7A7E-4f61-8FE1-D0BB9548294A),
version (1.0),
helpstring("SAFileDBEvents 1.0 Type Library")
]
library SADATABASELib
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
[
uuid(2CADF3A1-A5C9-4D89-A8ED-BEA59BDE6857),
helpstring("SAFileDB Class")
]
coclass SAFileDB
{
[default] interface ISAFileDB;
[default, source] interface ISAFileDBEvents;
};
[
uuid(100F3513-A370-434C-AD21-274AF9F3614E),
helpstring("SAFileEntry Class")
]
Then I added a method called DoTest to the ISAFileDB interface, and set up the connection point. I added code for a messagebox to DoTest, and left Fire_DoTest untouched.
Now on the MFC side I set up a class derived from CCmdTarget, like this:
class CConnPt : public CCmdTarget
{
DECLARE_DYNCREATE(CConnPt)
CConnPt();
public:
public:
public:
virtual void OnFinalRelease();
protected:
virtual ~CConnPt();
DECLARE_MESSAGE_MAP()
afx_msg void DoTest();
DECLARE_DISPATCH_MAP()
DECLARE_INTERFACE_MAP()
};
and in the .cpp file:
#import "..\ATL\SADatabase\SADatabase.tlb" no_namespace, named_guids
IMPLEMENT_DYNCREATE(CConnPt, CCmdTarget)
CConnPt::CConnPt()
{
EnableAutomation();
}
CConnPt::~CConnPt()
{
}
void CConnPt::OnFinalRelease()
{
CCmdTarget::OnFinalRelease();
}
BEGIN_MESSAGE_MAP(CConnPt, CCmdTarget)
END_MESSAGE_MAP()
BEGIN_DISPATCH_MAP(CConnPt, CCmdTarget)
DISP_FUNCTION(CConnPt, "Test", DoTest, VT_EMPTY, VTS_NONE)
END_DISPATCH_MAP()
static const IID IID_IConnPt =
{ 0xc3996b23, 0xcbce, 0x443f, { 0xb5, 0xd8, 0xa9, 0x8a, 0x9d, 0x1b, 0x62, 0xf1 } };
BEGIN_INTERFACE_MAP(CConnPt, CCmdTarget)
INTERFACE_PART(CConnPt, IID_ISAFileDB, Dispatch)
END_INTERFACE_MAP()
void CConnPt::DoTest()
{
AfxMessageBox("sdfsdf");
}
Now I do *this* when a button is pushed in the app
CoInitialize(NULL);
m_pConnPt = new CConnPt();
LPUNKNOWN pUnkSink = m_pConnPt->GetIDispatch(FALSE);
ISAFileDBPtr pIFind(__uuidof(SAFileDB));
IUnknown * pUnk = NULL;
pIFind->QueryInterface(IID_IUnknown, (void**)&pUnk);
AfxConnectionAdvise(pUnk, IID_ISAFileDBEvents, pUnkSink, FALSE, &m_dwCookie);
pIFind->DoTest();
AfxConnectionUnadvise(pUnk, IID_ISAFileDBEvents, pUnkSink, FALSE, m_dwCookie);
pUnk->Release();
CoUninitialize();
DoTest causes the dialog from the server to come up, but not the one in my CCmdTarget class, instead it crashes in comip.h, in the line:
void _Release() throw()
{
if (m_pInterface != NULL) {
m_pInterface->Release();
}
}
in the Release() call. The disturbing thing is if I trace it back it is the END of my function, when everything is going out of scope, indicating to me that I've got real problems, because by the time it crashes, the time for my connection point to work has well and truly passed.
Can *anyone* see what I am doing wrong and/or provide any advice ? The rest of this project came together like a dream, but the connection points have been an ongoing nightmare...
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Christian I mailing you *3* example sof connection points, all pretting darn basic, but illustrates how to implement connection points. The orthodox wat is to use dispinterface, but my examples shows you to use IUknown as well. Also there is an easier why to sink the connection end point again the examples will show you this.
I wrote a shed load of stuff (which I've lost) all about connection points. I'll have a look tonight and mail you if I can find the stuff.
Norm Almond
Chief Technical Architect
FS Walker Hughes Limited
|
|
|
|
|
Thanks a ton, Norm. I'll look forward to receiving them.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
CoInitialize(NULL);
m_pConnPt = new CConnPt();
LPUNKNOWN pUnkSink = m_pConnPt->GetIDispatch(FALSE);
ISAFileDBPtr pIFind(__uuidof(SAFileDB));
IUnknown * pUnk = NULL; pIFind->QueryInterface(IID_IUnknown, (void**)&pUnk);
AfxConnectionAdvise(pUnk, IID_ISAFileDBEvents, pUnkSink, FALSE, &m_dwCookie);
pIFind->DoTest();
AfxConnectionUnadvise(pUnk, IID_ISAFileDBEvents, pUnkSink, FALSE, m_dwCookie);pUnk->Release();
CoUninitialize();
This code has me lost. Why are you asking to be advise of a connection point event and then asking to be unadvised all in the same function? This code doesn't seem like the best way (or even correct way) to use connection points.
Can you explain what your program should do?
Michael
|
|
|
|
|
It's there solely as a test - the DoTest function should fire the connection point event and cause a message box, then I unadvise, because I'm not doing anything except trying to prove I can recieve an event.
Oh, no - it's not a thread issue, is it ? Is one thread trying to fire a CP and the main thread has shut it down ?
Removing the last three lines stops the crash, but my event is still not being called, my message box is not coming up from the MFC side, and tracing into Fire_DoTest() shows that it considers the number of active connections to be 0.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
It's been a while since I've used ConnectionPoints, tend to roll my own now but...
Does the AfxConnectionAdvise(pUnk, IID_ISAFileDBEvents, pUnkSink, FALSE, &m_dwCookie) return TRUE?
What if you change the bRefCount parameter to TRUE on the call to AfxConnectionAdvise?
Michael
|
|
|
|
|
You're absolutely right - it returns false, regardless of what I set that parameter to.
GetLastError tells me 'The Handle Is Invalid'.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
I can't see anything wrong with the code. I think you need to put some error checking on the code prior to the advise. A few try and catch and checking returning values. Something is failing somewhere (obviously), but without being able to step through the code I can't suggest anything else at the moment.
Michael
|
|
|
|
|
Hi,
I know the name of the application i need to invoke say XYZ.exe I've been using create process giving it the full path of where the exucutable is located. Can Anyone help me out in Invoking this Exe (XYZ.exe) even if it is not in the current path. ie it resides somewhere in the "System PAth" I Have to get the Path of the executable. I've been looking at FindExecutable and AssocQueryString but i'm unable to understand them fully. i'd be very grateful if you could help me out
|
|
|
|
|
PROCESS_INFORMATION pi;
STARTUPINFO si;
// If your app need addiotional parameters, pass NULL in lpAppName and
// fill the lpCommandLine with full path name, and paramateres
// Else, fill the lpAppName with the full path name, and NULL in
// lpCommandLine
// With parameters
LPCTSTR lpAppName = NULL; // name of executable module
// If long path name used, you must double quoted the string
LPTSTR lpCommandLine = "\"C:\Program Files\MyApp.exe\" -L -S";
ZeroMemory(&pi,sizeof(PROCESS_INFORMATION));
ZeroMemory(&si,sizeof(STARTUPINFO));
si.cb = sizeof(STARTUPINFO);
CreateProcess(
lpAppName, // name of executable module
lpCommandLine, // command line string
NULL, // LPSECURITY_ATTRIBUTES lpProcessAttributes,
NULL, // LPSECURITY_ATTRIBUTES lpThreadAttributes,
FALSE, // handle inheritance flag
NORMAL_PRIORITY_CLASS, // creation flags
NULL, // new environment block
NULL, // current directory name
&si, // LPSTARTUPINFO lpStartupInfo,
&pi ); // LPPROCESS_INFORMATION lpProcessInformation
|
|
|
|
|
Your Question is that you don't Know where the exe is?
If this is your case, you Have a couple of directories where look for, or the app can be in any directory?
Best Regards!!!!
Carlos Antollini.
|
|
|
|
|