CAxWindow without linking to atl?

Possible? If yes, how
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

There is no such thing "Linking to ATL". As any template library, ATL is set of h-files. Adding the ATL include files doesn't require lib files and doesn't add external depencencies to the project.

Daij-DjanAuthor Commented:
There is an atl box in called 'use of atl'
'not using atl'
'Static link to atl'
'Dynamic link to atl'

but.. whatever. im kinda new so........ what do I have to do to use atl classes?
Just include required h-files.

#include <atlwin.h>       // for CAxWindow

VC++ has menu item Insert - New ATL Object. It adds ATL support to existing project.
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Daij-DjanAuthor Commented:
nope... not enough...

> nope... not enough...

Try this:
     #include <atlbase.h>
     #include <atlwin.h>

To get it to compile, you'll sometimes have to change "Not Using ATL" to either of the other two (your choice, depending on whether you want your EXE being larger, or you want to distribute another DLL).  Some features of ATL are not templates, some are part of an actual library that needs to be linked in.  If you use these, then you'll have to link to ATL one way or another.  Try it and see.

Hope that helps,

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Daij-DjanAuthor Commented:
I am not linking to it but I now have _Module in my main cpp file. That worked.
Thanks for trying though

I researched your question, posted an answer, you tried it, and it worked.  Yes, to use some of the features of ATL, you will need to have to declare a _Module variable.  What is your issue with that?  It's just a small struct that holds things like a handle to the DLL/EXE module (which you need for loading resources, for example).  The effect of it being there is negligible, especially when weighed against the benefits you get from using CAxWindow.

Unless you can tell me why it is impossible for you to have a _Module variable in your program, I'm going to have to object to your refund request.  I almost feel like we're in this situation:

     Q:  My car used to go, but it suddenly stopped moving, and now it won't start.  What's wrong?
     A:  You're out of gas.  Go buy some more.
     Q:  Well, I don't to spend any money.  Sorry, I want my points back.

I'll work with you to help you get the best answer that works for you, but to get it working, and then request a refund because you didn't like some of the inevitable consequences of the answer makes me feel ripped off.

Daij-DjanAuthor Commented:
1 most (if not all) atl headers automaticly include "atlbase.h"
2 I simply didnt know about the module. It compiled fine and the docs didnt say this
-> You didnt help me enough but I will accept you comment and be done with it.
Look, I don't want you to accept my answer to "be done with it" anymore than I want you to request a refund.  I want(ed) to work with you until you got an answer that you were 100% happy with.  Especially if you're just going to give me a vindictive C grade...  I mean, read what says about giving Experts a chance to clarify if you have problems with implementing their answer.

But, FYI, here are few things you should know:

1) In "AtlWin.h", you'll find this:
      #ifndef __ATLBASE_H__
            #error atlwin.h requires atlbase.h to be included first
      So, no, it is not included automatically by AtlWin.h

2) When I created a sample project to re-create the problem, I didn't do anything that required _Module to be included, so mine compiled fine without it.  Without any extra information, I would have had no way of knowing that you would need it.  If you had posted the error you got regarding _Module, I would've helped you to work it out...   I mean, I'm glad you were able to figure it out, but I'm not sure why you hold that against me.

3) In the future, I think you'll find that you get more satisfactory answers to your questions if you provide more details.  The extent of the details for your question was "Possible? If yes, how".  When AlexFM tried to help you, the response he got was "nope... not enough... "  It is very difficult to help you if you don't meet us half-way.

I'm seriously considering protesting the grade, but I thought I'd give you a chance to explain your reasoning first.

Daij-DjanAuthor Commented:
>I'm seriously considering protesting the grade
Do so if you like
Daij-Djan:  I guess the real question is...  Did you get it working on your own before I posted anything?  Reading back over it, I can see that maybe you did get it and just forgot to close the question until after I posted.

Daij-DjanAuthor Commented:
I already had the includes in my file, tryed linking to atl before you posted.
The reason why didnt more info is because I didnt have it. I didnt know what was wrong.
No error msg, nothing

CAxWinddow::Create just silently failed.

Oh and. I became so barsh because AlexFM treated me like a retard. There is an option to link to atl and he just said 'no'
Okay, knowing that CAxWindow::Create failed is helpful.  All that time, I thought you were just trying to get it to compile...  :)

I know you got it working, but if you want to debug that issue in the future, you have to do this:
     1) Check the HWND return value of Create.
     2) If it is NULL, then call ::GetLastError() to get the error code.

Or step into the Create() function and see where the failure occurs...

BTW, In Visual Studio 6, there is no option to link to ATL, just like AlexFM said.  However, in Visual Studio .NET, there is most definitely an option, like you said.  Which compiler you are using might be useful information to include in a future question.
Daij-DjanAuthor Commented: ships with an ms compiler - nothing changed.
You are right and your grade _WAS_ incorrect and I acted purely emiotionally. Sorry
Apology accepted.  I'm not going to protest the grade, but if you wanted to change it, I'd appreciate it.

Have a good weekend.

Daij-DjanAuthor Commented:
I would change it. can I? .... is it really worth the trouble? Is a Grade important?
Daij-DjanAuthor Commented:
Thank you...  Is a grade important?  To some it doesn't really matter, to others, it's a reflection of the quality of their work ...  Which some people take very personally.  But, in the grand scheme of things, all that really matters is that your question got answered, and your problem is solved.  :)

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.