|
This[^] article should give you idea, how you need to use COM interface.
|
|
|
|
|
Hi Prasad,
I had read ur article.It's really usefull for me...
I followed correctly through ur sending article and successfully loading my dll,
but when i clicked the OK button,
1) MessageBox within "s" message and
2) MessageBox within "Failed" message showned and
3) assertion failed would be throwned.
my source code look like this...
void Ctest2_vcDlg::OnBnClickedOk()
{
// TODO: Add your control notification handler code here
CString s1,s2,s3;
s1=_T("c:\\p1.pdf");
s2=_T("c:\\pppp.jpg");
s3=_T("jpeg");
BSTR b1,b2,b3;
b1=s1.AllocSysString();
b2=s2.AllocSysString();
b3=s3.AllocSysString();
typedef HRESULT (WINAPI *pMakeFile) (BSTR,BSTR,BSTR);
pMakeFile MakeFile;
HMODULE hDll=LoadLibrary(_T("comgs.dll"));
if(hDll)
{
AfxMessageBox(_T("S"));
MakeFile = (pMakeFile)GetProcAddress(hDll,"MakeFile");
if(!MakeFile)
{
AfxMessageBox(_T("Failed"));
}
ATLASSERT(MakeFile);
MakeFile(b1,b2,b3);
FreeLibrary(hDll);
}
else
{
AfxMessageBox(_T("DLL Err"));
ATLASSERT(0);
}
OnOk()
}
And comgs library .tlh file look like this....
// Created by Microsoft (R) C/C++ Compiler Version 14.00.50727.42 (931fd62f).
//
// e:\sureshshanmugam\psudocodes\test2_vc\debug\comgs.tlh
//
// C++ source equivalent of Win32 type library comgs.dll
// compiler-generated file created 12/29/06 at 11:26:07 - DO NOT EDIT!
#pragma once
#pragma pack(push, 8)
#include <comdef.h>
namespace COMGSLib {
//
// Forward references and typedefs
//
struct __declspec(uuid("7a474480-a013-11d3-9c8b-00e098055175"))
/* LIBID */ __COMGSLib;
struct /* coclass */ gscript;
struct __declspec(uuid("7a47448c-a013-11d3-9c8b-00e098055175"))
/* dual interface */ Igscript;
//
// Smart pointer typedef declarations
//
_COM_SMARTPTR_TYPEDEF(Igscript, __uuidof(Igscript));
//
// Type library items
//
struct __declspec(uuid("7a47448d-a013-11d3-9c8b-00e098055175"))
gscript;
// [ default ] interface Igscript
struct __declspec(uuid("7a47448c-a013-11d3-9c8b-00e098055175"))
Igscript : IDispatch
{
//
// Wrapper methods for error-handling
//
HRESULT MakeFile (
_bstr_t inputfile,
_bstr_t outputfile,
_bstr_t devicename );
//
// Raw methods provided by interface
//
virtual HRESULT __stdcall raw_MakeFile (
/*[in]*/ BSTR inputfile,
/*[in]*/ BSTR outputfile,
/*[in]*/ BSTR devicename ) = 0;
};
//
// Wrapper method implementations
//
#include "e:\sureshshanmugam\psudocodes\test2_vc\debug\comgs.tli"
} // namespace COMGSLib
#pragma pack(pop)
|
|
|
|
|
surezu wrote: I followed correctly through ur sending article
No , you haven't.
You are mixing simple dll with COM dll.
In case of COM dll, there would interface(s) present. Which you need to use. This interface in your case is Igscript .
You haven't noticed how interface need to be used from C++ client. Look in to CMfcclientDlg::OnOk .
You need to use CoCreateInstance for this purpose.
Refer CMfcclientDlg::OnOk . from article and post back, if got any issue.
|
|
|
|
|
Hi Prasad,
I got result and i knew some basic concepts about COM based DLL.
Thank you very much.
-- modified at 7:30 Tuesday 2nd January, 2007
|
|
|
|
|
hi there,
To be using COM in my final year proj. Can anybody point me out very good reference - Online/literature. it'd of immense help as i need to learn it as a crash course .
plz help
Shouvik
|
|
|
|
|
Refer COM[^] section on this site.
|
|
|
|
|
Thanks Prasad,
Till now all my posts are replied by u first
thanks a lot
Shouvik
|
|
|
|
|
Most welcome !
Hope , it helps you in some way.
Majority of CP'ians are on vacation, otherwise, you will get lots of replies.
|
|
|
|
|
I also need to get some hands on Text parsing like Natural Language processing. Can u help me out.
I know this is out of thread ques. Plz bear with me.
please if u can...
Shouvik
|
|
|
|
|
shouvik.d wrote: Natural Language processing
Frankly, I'vent seen much of it, too. Better you ask this to larger audience, may be somebody has good knowledge of it.
Try General discussions/ lounge on this site, for this question.
|
|
|
|
|
I have a webapp which uses a COM dll by way of a wrapper.
the last time i made changes to this object i was able to recreate the wrapper and it worked successfully.
now i am again modifying the the code of the object (nothing special, just added an order clause to a sql statement) however this time when i generate the wrapper, the webapp fails with the follwing runtime error
Could not load type StmtGeneratorNET.StatementGeneratorClass from assembly StmtGeneratorNet
any ideas what the problem is here ?
|
|
|
|
|
Here is some additional information
when running TlbImp.exe i get the following warning, the wrapper dll is generated as is VBA.dll
TlbImp warning: Type library importer has encountered an interface not derived from IUnknown: _HiddenInterface.
however the webapp still cannot access the type required.
|
|
|
|
|
Hi All,
I was done OCR using MODI in c#.NET.But how can do that one in Vc++.
Now i am using VS.2005.
If you know any articles or have any sample code, let me know please!...
Thankx in Advance
|
|
|
|
|
hi all...
I'm facing a problem with the Microsoft Managemant Console Snap-In for Component Services. I am not able to expand the node named "COM+ Applications" under "My Computer". I am getting the Error as Follows:
--------------------------------------------------------------------
An error occured while processing the last operation.
Error code 80080005 - Server execution failed
The Event Log may contain additional troubleshooting information.
--------------------------------------------------------------------
When i tried to view the Application Event Log, it also gave an error,
--------------------------------------------------------------------
Unable to Complete the operation on "Application"
Access Denied.
--------------------------------------------------------------------
Please give your inputs regarding this error. I would be extremely thankful to you guys......
VIGITH
|
|
|
|
|
can u please help me out in automation visual source safe 6.0 in c# using com
please tell me how to checkin and check out a file from vss project
explore the world of imagination and be known as creative
|
|
|
|
|
Hi all
I have a web application which was developed in ASP + VB + Scripting Language
The problem is when replacing the existing dll with newly created one
the IIS needs a restart...Is there any other way to replace the dll with out IIS restart...
|
|
|
|
|
hi,
im using an com application in server,so whenever i log into the server through the remote desktop connection im getting an error like "COM SURROGATED".any help will be highly appreciated.thanks in advance.
with regards,
susa
|
|
|
|
|
Dear All,
I have a MFC application and also i am having a COM interface with that application. Both are running at the same address space.
Now that MFC application is up, when I call that COM interface from different program, everything goes correct. well.
After the COM fn execution is done, the MFC application goes out of memory (application stoped).
What is the reason for this?
I need to have MFC application to be in memory still even COM fn is done.
To do this, what should i do ? How can i do this ?
Kindly help me.
Thanks.
|
|
|
|
|
Perhaps an extra IYourInterface::Release() happens caused by returning the interface pointer to the client via GetIDispatch(FALSE). Must be GetIDispatch(TRUE) to increase internal reference count.
hallelujah
|
|
|
|
|
Want to call a dll which is created in vb 6 in vb.net. How i can do that. I am using dllImport but when running the .net aplication there is one error that Entry Point not define. Please provide solution that will highly appreciated.
|
|
|
|
|
Is it a COM dll? You can check this with OLEView or look to see if it exports the normal COM functions. If so you need to generate a RCW[^] (Runtime Callable Wrapper) for the DLL. I'm not a dotNET programmer so I can't help you with the specifics.
Steve
|
|
|
|
|
hi all
how to create and terminate a process using WMI
Can i have c++ code for it
Thanks
abhi
|
|
|
|
|
Hello everybody,
I have a COM client application which connects to COM server on the same machine. Everything works fine. But when I start the client from an asp script, the call to CoCreateInstance fails for some reasons. I`m not very experienced in COM programming. Do I have to use CoCreateInstanceEx because the client runs in the context of the webserver when it is started from the script? Or whatelse could be the reason? Does anybody have an idea?
MS
|
|
|
|
|
Hi All
whats the best way if a treeview node is associated with 3 values more easily i say that when click on the node 3 values are displayed in Listview for that node how to bind the values with that particular node
SAS
|
|
|
|
|
wrong forum. I think your question is not related to COM. Try VC++ forum to get correct and fast answer.
S o h a i l K a d i w a l a
To Err Is Human; to Debug, Divine
modified 21-Apr-21 21:01pm.
|
|
|
|