Link to home
Start Free TrialLog in
Avatar of dorock
dorock

asked on

Band Object Implementation Sample

Hello,
well, Let me start saying that I know nothing about MSVC++.

What I want to do is just compile a pretty cool sample that is it this URL:
http://msdn.microsoft.com/isapi/msdnlib.idc?theURL=/library/psdk/shellcc/shell/samples/bands/bandobjs_cpp.htm

All files are there, what I have to do know...
I tried to create a new project and place all files there but I received an error message:
"Compiling...
StdAfx.cpp
Compiling...
explorer.cpp
clsFact.cpp
c:\c++\hello\clsfact.cpp(196) : fatal error C1010: unexpected end of file while looking for precompiled header directive
CommBand.cpp
c:\c++\hello\commband.cpp(696) : fatal error C1010: unexpected end of file while looking for precompiled header directive
deskband.cpp
c:\c++\hello\deskband.cpp(826) : fatal error C1010: unexpected end of file while looking for precompiled header directive
explrBar.cpp
c:\c++\hello\explrbar.cpp(695) : fatal error C1010: unexpected end of file while looking for precompiled header directive
bandObjs.cpp
c:\c++\hello\bandobjs.cpp(292) : fatal error C1010: unexpected end of file while looking for precompiled header directive
Generating Code...
Error executing cl.exe.

explorer.dll - 5 error(s), 0 warning(s)
"

Can somebody help?

thanks
Avatar of jkr
jkr
Flag of Germany image

Simply add a

#include <stdafx.h>

at the beginning of every file mentioned above, and it should work.

Feel free to ask if you encounter problems!
To elaborate: VC++ builds so called 'precompiled header files', in which it stores (as the name implys) information about header files invoked in your project in order to speed up the build process. This is done through one specific header (namely 'stdafx.h') - if it is missing in your .cpp file, VC++ is insulted ;-)
Avatar of dorock
dorock

ASKER

It is much better now...
but I still have 3 errors...
he it is:

Deleting intermediate files and output files for project 'explorer - Win32 Debug'.
--------------------Configuration: explorer - Win32 Debug--------------------
Compiling...
StdAfx.cpp
Compiling...
explorer.cpp
clsFact.cpp
c:\c++\hello\commband.h(34) : error C2018: unknown character '0x60'
CommBand.cpp
c:\c++\hello\commband.h(34) : error C2018: unknown character '0x60'
deskband.cpp
explrBar.cpp
bandObjs.cpp
c:\c++\hello\commband.h(34) : error C2018: unknown character '0x60'
Generating Code...
Error executing cl.exe.

explorer.dll - 3 error(s), 0 warning(s)

"

unknown character '0x60' ,, what the heck is that? :)



thanks!!

Avatar of dorock

ASKER

Ok it was my fault...

now I have it...

"

--------------------Configuration: explorer - Win32 Debug--------------------
Compiling...
CommBand.cpp
Linking...
bandObjs.obj : error LNK2005: _DllMain@12 already defined in explorer.obj
Debug/explorer.dll : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.

explorer.dll - 2 error(s), 0 warning(s)

"

ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dorock

ASKER

There you go, sorry, It was my fault, but I still have errors,

Deleting intermediate files and output files for project 'explorer - Win32 Debug'.
--------------------Configuration: explorer - Win32 Debug--------------------
Compiling...
StdAfx.cpp
Compiling...
explorer.cpp
clsFact.cpp
CommBand.cpp
deskband.cpp
explrBar.cpp
bandObjs.cpp
Generating Code...
Linking...
bandObjs.obj : error LNK2005: _DllMain@12 already defined in explorer.obj
Debug/explorer.dll : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.

explorer.dll - 2 error(s), 0 warning(s)



The name of the dll should be "bandObjs.dll", but I changed to explorer.dll, Could it be the problem??

thanks
Hmm, did you set up a new project for this task? If not, make sure to either do so or remove the 'explorer.cpp' file from your project...
Avatar of dorock

ASKER

He jkr, can you help me?

I have all files, *.cpp and *.h and I have MSC++ 6.0

I am create a new project, click in Project tab, my project name will be bandObj, location = "c:\c++\bandObjPR

In the wizard I choose "A simple DLL project" then I click finish and after OK button ...

Now I have to add my files, right?
SO I click Project/Add to Project/Files
and add all files that I have...

Now I click in build/build bandObj.dll

and I got that message:
"--------------------Configuration: bandObj - Win32 Debug--------------------
Compiling...
StdAfx.cpp
Compiling...
bandObj.cpp
clsFact.cpp
CommBand.cpp
deskband.cpp
explrBar.cpp
bandObjs.cpp
Generating Code...
Linking...
bandObjs.obj : error LNK2005: _DllMain@12 already defined in bandObj.obj
Debug/bandObj.dll : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.

bandObj.dll - 2 error(s), 0 warning(s)
"

What am I doing wrong?


Avatar of dorock

ASKER

Ok I found the error...
thanks!!!

Avatar of dorock

ASKER

Hey, did you ever try to create a new explorer bar, like search bar, in IE5?
it's pretty cool!!
Sorry for the delay, have been 'offline' for a moment ;-)

No, I haven't ... but perhaps I'll give it a try when my time allows it :-(
Avatar of dorock

ASKER

I have to learn alot of c++ to do it...
:(
Should have a way to do it using VB :)

have a good night..

see ya
Avatar of dorock

ASKER

I had a problem when I compiled it and tryed to register the component I received that error
"bandobj.dll was loaded, but the DllRegisterServer entry point was not found.
DllRegisterServer may not be exported, or a corrupt version of bandobj.dll may be in memory. Consider using PView to detect and remove it"

Do you know how to solve it?

thanks...

Hmm, I assume you didn't use a .def file...

It has to be something like

;mydll.def : Declares the module parameters for the DLL.

LIBRARY      MYDLL
DESCRIPTION  'blah'

EXPORTS
    DllCanUnloadNow             @2 PRIVATE          ;DLL unloading
    DllGetClassObject           @3 PRIVATE          ;Component object model
    DllRegisterServer           @4 PRIVATE          ;Component object model
    DllUnregisterServer         @5 PRIVATE          ;Component object model

Just adding it to your project should be sufficiant...
Avatar of dorock

ASKER

YESSSSSSSSS!!!
It worked!!!

thanks alot man!!!

I just needed to took of the last line
"LIBRARY      bandObj.dll
DESCRIPTION  'blah'

EXPORTS
    DllCanUnloadNow             @2 PRIVATE          ;DLL unloading
    DllGetClassObject           @3 PRIVATE          ;Component object model
    DllRegisterServer           @4 PRIVATE          ;Component object model
   "

thank you!!!


have a good day!