|
Hello All,
In my .idl I have the following declarations.
typedef struct AXCS_DYNAXRPARA_T_tag
{
sh_dyna_xrpar_t1 data1;
sh_dyna_xrpar_t2 data2[NO_DYNA_PULSES_MAX];
}AXCS_DYNAXRPARA_T;
sh_dyna_xrpar_t1 and sh_dyna_xrpar_t2 are defined in another .idl file.
Now
when I import the generated .tlb into another file I get compilation
errors
since the .tlh file is getting generated the following way.
struct sh_dyna_xrpar_t1_tag
{
struct acs_obj_header_t_tag header;
unsigned short xrparn;
unsigned short index;
short obj_count;
short no_mask_img;
unsigned char version_shdynaxrpar;
unsigned char dummy1;
short no_dyna_pulses;
};
struct AXCS_DYNAXRPARA_T_tag
{
struct sh_dyna_xrpar_t1_tag data1;
struct sh_dyna_xrpar_t2_tag data2[40];
};
struct sh_dyna_xrpar_t2_tag
{
long xrv;
long xrua;
long xrpt;
};
As you can see, sh_dyna_xrpar_t2_tag is getting declared after struct
AXCS_DYNAXRPARA_T_tag declaration. Why so?? The compilation error I am
getting is
error C2079: 'data2' uses undefined struct 'sh_dyna_xrpar_t2_tag'
Why is the compiler getting confused. How can I correct the above.
Using .h and _i.c is working for me. I want to make the above work with
#import .tlb file.
Regards
Rajdeep
|
|
|
|
|
Hello All,
In my .idl I have the following declarations.
typedef struct AXCS_DYNAXRPARA_T_tag
{
sh_dyna_xrpar_t1 data1;
sh_dyna_xrpar_t2 data2[NO_DYNA_PULSES_MAX];
}AXCS_DYNAXRPARA_T;
sh_dyna_xrpar_t1 and sh_dyna_xrpar_t2 are defined in another .idl file. Now when I import the generated .tlb into another file I get compilation errors since the .tlh file is getting generated the following way.
struct sh_dyna_xrpar_t1_tag
{
struct acs_obj_header_t_tag header;
unsigned short xrparn;
unsigned short index;
short obj_count;
short no_mask_img;
unsigned char version_shdynaxrpar;
unsigned char dummy1;
short no_dyna_pulses;
};
struct AXCS_DYNAXRPARA_T_tag
{
struct sh_dyna_xrpar_t1_tag data1;
struct sh_dyna_xrpar_t2_tag data2[40];
};
struct sh_dyna_xrpar_t2_tag
{
long xrv;
long xrua;
long xrpt;
};
As you can see, sh_dyna_xrpar_t2_tag is getting declared after struct AXCS_DYNAXRPARA_T_tag declaration. Why so?? The compilation error I am getting is
error C2079: 'data2' uses undefined struct 'sh_dyna_xrpar_t2_tag'
Why is the compiler getting confused. How can I correct the above.
Using .h and _i.c is working for me. I want to make the above work with
#import .tlb file.
Regards
Rajdeep
|
|
|
|
|
I am developing a simple local COM server, after I finished building this server(compiled, ran), then I used the OLE/COM object viewer to check it (I am using VC6.00, and this OLE/COM object viewer is a tool provided in the IDE of VC6.0), I opened up the "All Objects", I can see the one that is inside my newly created local COM server, but when I clicked the "+" sign to open it more up, it says the following:
GetObject() failed,
The system cannot find the path speicifed, $80070003
Anyone knows what is this and what is reason??
thanks!
|
|
|
|
|
Did you remove the DLL file after it was registered? Take a look at the registry key HKEY_CLASSES_ROOT\CLSID\{your class' GUID}\InprocServer32 (assuming it's a DLL server). The default value of that key should be the path to your DLL. If it isn't, bingo, there's your problem. If the value is correct, then I can't really tell.
--
Weiter, weiter, ins verderben.
Wir müssen leben bis wir sterben.
|
|
|
|
|
Thanks! In fact, I am using a EXE (local COM server) server, and the registry key looks like following:
HKEY_CLASSES_ROOT\CLSID\{myClassGUID}\LocalServer32 = somePath
so this part should be fine...
I appreciate your input very much though.
liyang
|
|
|
|
|
Could it be that your COM server depends on a DLL (probably home made) which OLE/COM Viewer can't find? I can't remember if that fault produces the "file not found" error or "device not ready". In any case, the error code given is not intuitive.
--
Weiter, weiter, ins verderben.
Wir müssen leben bis wir sterben.
|
|
|
|
|
not really. this is a very simple example, in fact it is a small lab example from this "Developer's Workshop to COM/ATL 3.0" book, and the author's own lab code also produces this problem. sigh..., and I cannot find his contact info.
|
|
|
|
|
Hi all,
how can I create a COM in VC++.NET, which project template should I choose ?
Thanks
Patrick
|
|
|
|
|
Hello,
I develop a COM Object wint IConnectionPoint. I have a method "Advise" with the line:
HRESULT hr = CoMarshalInterThreadInterfaceInStream(IID__IInterface_OutilsEvents, p, &m_StreamArray[m_nStreamIndex] );
It's ok with windows 2000 but when I try it with Windows XP, I have an error in this line:
"Interface not registered"
Why?
Thanks
Sanouk
|
|
|
|
|
And is it registered? You can investigate by using OLE/COM object viewer if the interface is registered or not.
|
|
|
|
|
I am writing a very simple local COM server (exe), which has a Car class, a CarClassFactory , also a simple idl , everything goes well until the WinMain() file which provides the housing for the coclass and class factory, vC6.00 keeps saying the following:
Deleting intermediate files and output files for project 'CarCOMExe - Win32 Debug'.
--------------------Configuration: CarCOMExe - Win32 Debug--------------------
Creating Type Library...
Processing F:\COM\CarCOMExe\CarCOMExeTypeInfo.idl
CarCOMExeTypeInfo.idl
Processing F:\Microsoft Visual Development\Microsoft Visual Studio\VC98\INCLUDE\oaidl.idl
oaidl.idl
Processing F:\Microsoft Visual Development\Microsoft Visual Studio\VC98\INCLUDE\objidl.idl
objidl.idl
Processing F:\Microsoft Visual Development\Microsoft Visual Studio\VC98\INCLUDE\unknwn.idl
unknwn.idl
Processing F:\Microsoft Visual Development\Microsoft Visual Studio\VC98\INCLUDE\wtypes.idl
wtypes.idl
Compiling...
StdAfx.cpp
Compiling...
Car.cpp
CarClassFactory.cpp
CarCOMExe.cpp
f:\com\carcomexe\carclassfactory.h(13) : error C2504: 'IClassFactory' : base class undefined
f:\com\carcomexe\carclassfactory.h(19) : error C2061: syntax error : identifier 'REFIID'
f:\com\carcomexe\carclassfactory.h(25) : error C2061: syntax error : identifier 'LPUNKNOWN'
F:\COM\CarCOMExe\CarCOMExe.cpp(32) : error C2065: 'CoInitialize' : undeclared identifier
F:\COM\CarCOMExe\CarCOMExe.cpp(36) : error C2065: 'ITypeLib' : undeclared identifier
F:\COM\CarCOMExe\CarCOMExe.cpp(36) : error C2065: 'pTLib' : undeclared identifier
F:\COM\CarCOMExe\CarCOMExe.cpp(36) : error C2106: '=' : left operand must be l-value
F:\COM\CarCOMExe\CarCOMExe.cpp(37) : error C2065: 'LoadTypeLibEx' : undeclared identifier
F:\COM\CarCOMExe\CarCOMExe.cpp(37) : error C2065: 'REGKIND_REGISTER' : undeclared identifier
F:\COM\CarCOMExe\CarCOMExe.cpp(38) : error C2227: left of '->Release' must point to class/struct/union
F:\COM\CarCOMExe\CarCOMExe.cpp(48) : error C2065: 'CoRegisterClassObject' : undeclared identifier
F:\COM\CarCOMExe\CarCOMExe.cpp(48) : error C2065: 'IClassFactory' : undeclared identifier
F:\COM\CarCOMExe\CarCOMExe.cpp(48) : error C2059: syntax error : ')'
F:\COM\CarCOMExe\CarCOMExe.cpp(61) : error C2065: 'CoRevokeClassObject' : undeclared identifier
F:\COM\CarCOMExe\CarCOMExe.cpp(65) : error C2065: 'CoUninitialize' : undeclared identifier
locks.cpp
Generating Code...
Error executing cl.exe.
Creating browse info file...
CoCarEXE.exe - 15 error(s), 0 warning(s)
as you can sees, it keeps saying that IClassFactory is undefined, but the CarClassFactory.cpp compiles well. CarClassFactory.h is very simple:
#define CarClassFactory_H
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <windows.h>
class CarClassFactory : public IClassFactory
{
public:
CarClassFactory();
virtual ~CarClassFactory();
STDMETHODIMP QueryInterface(REFIID riid,void** pIFace);
STDMETHODIMP_(ULONG)AddRef();
STDMETHODIMP_(ULONG)Release();
STDMETHODIMP LockServer(BOOL fLock);
STDMETHODIMP CreateInstance(LPUNKNOWN pUnkOuter,REFIID riid,void** ppv);
private:
ULONG m_refCount;
};
#endif
and CarCOMExe.cpp is as follows:
#include "stdafx.h"
#include "CarCOMExeTypeInfo_i.c"
#include "CarClassFactory.h"
#include <string.h>
DWORD g_allLocks;
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
CoInitialize(NULL);
ITypeLib* pTLib = NULL;
LoadTypeLibEx(L"CarCOMExeTypeInfo.tlb", REGKIND_REGISTER, &pTLib);
pTLib->Release();
if(strstr(lpCmdLine, "/Embedding") || strstr(lpCmdLine, "-Embedding"))
{
CarClassFactory carClassFactory;
DWORD regID = 0;
CoRegisterClassObject(CLSID_Car, (IClassFactory*)&carClassFactory,
CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE, ®ID);
MSG ms;
while(GetMessage(&ms, 0, 0, 0))
{
TranslateMessage(&ms);
DispatchMessage(&ms);
}
CoRevokeClassObject(regID);
}
CoUninitialize();
MessageBox(NULL, "Server is dying", "EXE Message!", MB_OK | MB_SETFOREGROUND);
return 0;
}
Really frustrated, can some one give me some help?
Thanks!!
|
|
|
|
|
Have you #included the following file into your program?
#include <windows.h>
-John
|
|
|
|
|
|
Yes,I did. In fact, I did the following:
#include "stdafx.h"
which includes windows.h .
|
|
|
|
|
It took me a day to figure this out:
I am using VC 6.00, and my
stdafx.h looks like this:<br />
<br />
<pre>
#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_)
#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_)
</pre><br />
<br />
you need to get rid of <pre>#define WIN32_LEAN_AND_MEAN</pre> to make a simple local COM server work!!<br />
<br />
Thanks!
|
|
|
|
|
Are u using ATL???
-------------------------
Have a great day ahead!
Regards,
Sohail Kadiwala
(My COM Blog - http://lovecom.blogspot.com)
modified 21-Apr-21 21:01pm.
|
|
|
|
|
|
As You are using IClassFactory interafce , give it's declartion too
include unknwn.h
|
|
|
|
|
Hi all,
Apologies if this is a little off-topic for this board, but does anyone know where I can find out the maximum number of rows and columns allowed in an Excel spreadsheet. For once, Goggle isn't being particularly helpful.
TIA,
Pete
|
|
|
|
|
Well, to answer my own question:
http://support.businessobjects.com/library/kbase/articles/c2000454.asp
however, I'd like to get an 'official' description from Microsoft, to satisfy my boss if nothing else...
|
|
|
|
|
Unless they changed in the latest version here are the Maximums.
Rows: 65536
Columns: 256
You can have many sheets, but each sheet cannot contain more than this.
This is annoying when one wants to import a 100,000 lines of invoices coming from an external prog for analysis reasons.
Unfortunately i dont have an official link for you.
Hope this helps.
|
|
|
|
|
if(pMsg) {<br />
LPSPropValue rgMsgprops = NULL;<br />
ULONG cMsgValues = 0;<br />
SizedSPropTagArray(2, rgMsgTags) = {2,{PR_SENDER_NAME,<br />
PR_SUBJECT}};<br />
<br />
hr = pMsg->GetProps((LPSPropTagArray)&rgMsgTags,<br />
MAPI_UNICODE, &cMsgValues, &rgMsgprops);<br />
<br />
IStream *pStream = NULL;<br />
TCHAR tchBody[255] = TEXT("\0");<br />
<br />
hr = pMsg->OpenProperty(PR_BODY, NULL, 0, 0,<br />
(IUnknown **)&pStream);<br />
if(FAILED(hr)) {<br />
pMsg->Release();<br />
pIInboxTable->Release();<br />
pPOPInboxFolder->Release();<br />
return FALSE;<br />
}<br />
<br />
hr = pStream->Read(tchBody, 254, NULL);<br />
pStream->Release();<br />
<br />
TCHAR tchMsg[1024] = TEXT("\0");<br />
wsprintf(tchMsg, TEXT("From: %s\r\nSubject: %s\r\nMsg: %s"), rgMsgprops[0].Value.lpszW,rgMsgprops[1].Value.lpszW, tchBody); <br />
<br />
MAPIFreeBuffer(rgMsgprops);<br />
pMsg->Release();
with this code
after stream the body , hr is S_OK. However, the tchBody is still null string. can anyone help?
thanks
|
|
|
|
|
Hi~
I use IMessage::GetRecipientTable() to get the recipient from the inbox.
However, it return MAPI_E_NO_RECIPIENTS.
Why this happen?
However do a mail of inbox have no recipients?
Thanks
|
|
|
|
|
Hello,
I built a program that reads data from an Excel Workbook and spits out Xml to be read by another program. It is written in C#, and I use Microsoft Visual Studio 2002 for development.
My question is this: where can I find information regarding the use of Microsoft's DLLs. When I compile my program, the following DLL's are placed in my program folder:
Interop.Excel.dll
Interop.Microsoft.Office.Core.dll
Interop.VBIDE.dll
I need to know if I am allowed to include these in my program, because this program is going to be sold and or licenced to people, but I obviously did not write the dll's, and I don't want Microsoft to sue me.
I also need to know what happens if someone has an older or newer version of Excel installed... will these dll's still work?
If someone could at least point me towards the answers to these questions, that would be great. Thanks!
Jeremy O
PM Logic
www.jeremyo.com
|
|
|
|
|
Hi,
I have a windows form(c#) and I am using the mapi dll to read email from a specific account.
my project runs from - C:\Documents and Settings\GJeffrey.LAWACTIVE\My Documents\Visual Studio Projects
but when i try to ininitialize the mapi session i.e. oSession = new MAPI.Session();
in a class named Email and not on my main form it bombs out with this error.
It seems to me that it cannot run this object because this object is in the following directory - C:\Program Files\Common Files\System\Mapi.
If i declare my mapi session as the first thing in my class constructor(or onload of the form) it seems to run fine but then it runs from the second directory.
Any ideas or thought as to how i can solve this or why it is happening??
|
|
|
|
|