|
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??
|
|
|
|
|
Hello,
need to set underline font in word document
<br />
_ApplicationPtr word(L"Word.Application");<br />
word->Visible = true;<br />
word->Activate();<br />
then
<br />
RangePtr myRange = word1->Selection->Font->Underline = WdUnderline.wdUnderlineSingle;<br />
but getting error
error C2228: left of '.wdUnderlineSingle' must have class/struct/union type
Need help
|
|
|
|
|
hi all,
I have a a shell extension dll,in which i have inserted my menu items for a .xyz file( when you right click in explorer),which works fine on Windows 2000, and the context menu is showing my entries.but when the same is installed on Win98 machine, my menu item items are not displayed. or in simple words, my shell extension dll is not loaded in win98.
I had check the registry entries on both machine which appears to be same
and now i am totally clueless about this . Can any expert help me? any starting point to debug this?. I am not using ATL.
Regards
Abhishake
|
|
|
|
|
Hai,
I dont know whether I'm in right place..I'm new to vc++ win32...i am trying to read and write to serial port COM1.
I know we can do this by createfile and read and writefile fns..but i am not sure about the flags and how to set buffer values..and what other funcs i need to do..suppose i want to write say "hello" to com1 and get the acknowledge "hi" from it...can any one help me with the code exactly how to do it..
thanks a lot.
|
|
|
|
|
Hi !
First, you are in the wrong forum. In fact this is not a forum about COM ports but about Component Object Modeling . Try better the C++ forum, you'll have more chance to get a response there.
For your question: the code to use to open the port:
hCom = CreateFile(pszPortName,<br />
GENERIC_READ | GENERIC_WRITE,<br />
0, <br />
NULL, <br />
OPEN_EXISTING, <br />
0, <br />
NULL <br />
);<br />
pszPortName is the name of your port ("COM1","COM2",...)
You can then set some parameters of your port (baudrate, partiy,...):
DCB dcb;<br />
BOOL fSuccess;<br />
DWORD dwError;<br />
<br />
fSuccess = GetCommState(hCom, &dcb);<br />
<br />
if (!fSuccess) <br />
{<br />
dwError=GetLastError();<br />
return dwError;<br />
}<br />
<br />
dcb.BaudRate=9600;<br />
dcb.StopBits=1;<br />
dcb.fParity=1;<br />
dcb.fDtrControl=DTR_CONTROL_DISABLE;<br />
dcb.fRtsControl=RTS_CONTROL_DISABLE;<br />
<br />
fSuccess = SetCommState(hCom, &dcb);
Then use the ReadFile and WriteFile functions...
Hope this helps
|
|
|
|
|
Hi,
I have been writing a C# app with a three tier (Database, business and user level) approach. I would like to do some testing across a network but have no idea on how to expose the business layer on the sever machine so other computers can then use this component across the network.
Can anyone point to an article that will direct me on how to do this?
The machines are XP/2000 machines.
Thanks in advance.
Stephen
|
|
|
|
|
Hi there
I have written an application (nothing to do with the net or html) and want
to add scripting to it. I've done this and it seems to work but only once.
Each time we load a document, an associated vbscript file is also loaded
using ParseScriptText. After ParseScriptText is called I call a script
function from the application to determine if we should infact load a
different data file - indirection based on the script. This
works fine.
Later in processing the data file I call another script function from the
app and it throws an exception with E_UNEXPECTED when calling
GetScriptDispatch. I have checked the script state and it is still connected.
Any ideas what might be wrong?
Thanks
Dave
|
|
|
|
|
Hi All,
I have a Visual Foxpro 6.0 application installed on Windows 2000 server and am trying to run it through Terminal Services Client. It runs ok if I log on to the Terminal Services Server as admin and run the application. The problem comes when I tried to log on as a normal user and run the application. An error message came up as below:
OLE error code 0x80040154: Class not registerd.
I am pretty sure it has something to do with security on the server.
Could somebody please help me to overcome this problem.
Thanks a million
MR.
|
|
|
|
|
I think it's problem with access rights.Check access right of normal user. COM server if not having proper access right, I saw sometimes it thr this kins of error.
|
|
|
|
|
Hi there,
Is there any way to create a simple client/server program in a 16 bit (dos)
project?
I can only use this kind of mode (dos 16 bit) because the microchip i am trying to control remotely connected to the server only supports borland 5.02 DOS 16 BIT projects.
thank you for helping and any suggestions are heart-warmingly welcome!
porac69
|
|
|
|
|