|
I am very convinced by your explanation here. Thank you so much!
Have a nice weekend.
|
|
|
|
|
Does VC7 offer support for WinXP-64/Itanium targets?
Thanks,
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
|
Hi,
I want to pass metafile to my ATl control ( from an MFC client), is there any easy way to do that, something pretty cool would be like:
MyAtlCtrlInstace->PassMetafile(hMyMetafile) ( VT_METAFILE)
But it seems that I have to use IOleDataObject ( but I don´t want drag and drop and that stuff just directly call it from the client!!!!), is there any easy way to do that ?, if not... which method should I override from IOleDataObjectImpl ?
Thanks in avance, Bye !
Braulio
|
|
|
|
|
Sorry to disappoint you that I don't know the answer but I can help you in another way,because it seems you are really in trouble;) (2 or 3 message about this problem in disccution board)
Anyway,Have you read Dr.Grimes books about ATL programming?(wrox publisher)There are two version ,one for Begginers and another one is for prof. I have the begginer version but there is nothing useful about this subject in it,maybe if you find prof. one it can help you.
I also have Dr.Grimes email address,one time he helped me to solve my problem in ATL ,if you want I can send it for you,I think he helps you
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Hi,
Anyway thanks for your help ( yes I feel like a dummy sorry , just posting posting..., aaaah !).
Sometimes to do something wiht ATL looks like weird or complicated but.... well... just give a metafile !!! oh my god !... I think I´m going bananas
If you can give me the address of Dr. Grimes I will send one e-mail, but I don´t know if he will answer me...
Thanks anyway, Bye !
Braulio
|
|
|
|
|
atl.dev@grimes.demon.co.uk
If you ask how should I write my project,he won't answer.Ask your question as you ask them here,"SHORT" and "COMPLETE",he answers the questions that thier answers are one or two line,just like this question
Good luck
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
I'm having some problems with inheritance and virtual functions. Supose the following classes:
class CMyClass
{
virtual void DoSomething() = 0;
}
class CMyDialog : public CDialog, public CMyClass
{
void Init()
{
m_oUsingClass.Init(this);
}
virtual void DoSomething()
{
}
CUsingClass m_oUsingClass;
}
class CUsingClass
{
void Init(CWnd *pWnd)
{
m_pWnd = pWnd;
m_pMyClass = (CMyClass *)pWnd; // error - it doesn't work
m_pMyClass->DoSomething(); // error - caused by prior error
}
CWnd *m_pWnd;
CMyClass *m_pMyClass;
}
When I assign "m_pMyClass = (CMyClass *)pWnd;" it doesn't work. So I can't call virtual function DoSomething() defined in CMyDialog class.
How can I do this?
What I need is to have a class (CMyDialog) that is derived from CDialog and CMyClass and in another class (CUsingClass) I need to access CDialog and CMyClass (passed by "this" parameter in m_oUsingClass.Init(this)). Can I do it simply passing this as CWnd * or I need to have two parameters in CUsingClass::Init(CWnd *, CMyClass *) and I have to pass "this" parameter twice in CMyDialog (m_oUsingClass.Init(this, this))?
If you have any idea about how can I do this, or if you know where can I get documentation explaining why this doesn't work, I would appreciate.
Thanks
Vanessa
|
|
|
|
|
Try this:
m_pMyClass = dynamic_cast<CMyClass *>(pWnd);
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
IMHO, the *real* problem you have here is trying to use a "CMyClass" polymorphically as a CWnd. Why? This does not make a lot of sense. A CWnd is *not* a CMyClass. Trying to cast your way out of that situation is not a good idea. Are there going to be other types of CWnd's muliply inherited from CMyClass? If so, are some of them not CDialogs? For example, do you plan on passing in a CView that also inherits from CMyClass? If that is your goal, than I would seriously suggest you reconsider your design.
If not, than I would suggest getting rid of the attempt at polymorphism based upon CWnd. If you have a set of dialogs that need this polymorphic behavior than you should base your polymorphic behavior on that class.
i.e.
Init( CMyDialog* pmydlg )
{
pmydlg->DoSomething();
}
Since a CMyDialog *is* a CMyClass this is straight forward...
I think you are going to get yourself into a lot of trouble trying to do things the way you are.
"Thank you, thank you very much" Elvis.
|
|
|
|
|
I have created an MDI application with appwizard.
In MyProgram.cpp in initinstance I register the applications
document templates. I want to open the document from a menu item.
The problem is that the document is opened everytime I execute
the program. How can I avoid this?
|
|
|
|
|
To create a new doc/view at a later time save the doc template pointer in your applications header file:
CMultiDocTemplate *m_pMyDocTemplate; Use it when the doc template is created:
m_pMyDocTemplate = new CMultiDocTemplate(
IDR_TARGETTYPE,
RUNTIME_CLASS(CMyDoc),
RUNTIME_CLASS(CChildFrame),
RUNTIME_CLASS(CMyView));
AddDocTemplate(m_pMyDocTemplate); When you are ready to create a new doc/view call this:
m_pMyDocTemplate->OpenDocumentFile(NULL, TRUE); If you call AddDocTemplate() above you do not have to delete the m_pMyDocTemplate pointer when the application ends. If you don't call AddDocTemplate() you will need to delete the m_pMyDocTemplate pointer.
To keep the default new doc/view from showing add the code below:
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
if(cmdInfo.m_nShellCommand == CCommandLineInfo::FileNew)
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
if (!ProcessShellCommand(cmdInfo))
return FALSE; Hope this helps.
Jonathan Craig
www.mcw-tech.com
|
|
|
|
|
Arrgghhh!!!! Can anyone tell me what I'm doing wrong or let me know that I'm not lossing my mind?
I have some code, does nothing fancy, compiles fine normally, but today when I compile I get the following:
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\crtdbg.h(536) : error C2833: 'operator DEBUG_NEW' is not a recognized operator or type<br />
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\crtdbg.h(536) : error C2059: syntax error : 'newline'<br />
C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afx.h(674) : error C2833: 'operator DEBUG_NEW' is not a recognized operator or type<br />
C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afx.h(674) : error C2059: syntax error : 'newline'<br />
C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afx.h(674) : error C2238: unexpected token(s) preceding ';'<br />
C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afx.h(675) : error C2833: 'operator DEBUG_NEW' is not a recognized operator or type<br />
C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afx.h(675) : error C2059: syntax error : 'newline'<br />
C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afx.h(675) : error C2238: unexpected token(s) preceding ';'<br />
C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afx.h(683) : error C2833: 'operator DEBUG_NEW' is not a recognized operator or type<br />
C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afx.h(683) : error C2059: syntax error : 'newline'<br />
C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afx.h(683) : error C2238: unexpected token(s) preceding ';'<br />
C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afx.h(1631) : error C2833: 'operator DEBUG_NEW' is not a recognized operator or type<br />
C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afx.h(1631) : error C2059: syntax error : 'newline'<br />
C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afxtls_.h(122) : error C2059: syntax error : 'string'<br />
C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afxtls_.h(123) : error C2091: function returns function<br />
C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afxtls_.h(123) : error C2802: static member 'operator new' has no formal parameters<br />
C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afxtls_.h(123) : error C2333: 'new' : error in function declaration; skipping function body<br />
C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afxtls_.h(131) : error C2059: syntax error : 'string'<br />
C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afxtls_.h(131) : error C2091: function returns function<br />
C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afxtls_.h(131) : error C2802: static member 'operator new' has no formal parameters<br />
C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afxtls_.h(135) : error C2059: syntax error : 'string'<br />
C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afxtls_.h(135) : error C2091: function returns function<br />
C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afxtls_.h(135) : error C2556: 'void *(__cdecl *__stdcall CNoTrackObject::operator new(void))(unsigned int,const char *,int)' : overloaded function differs only by return type from 'void *(__c<br />
decl *__stdcall CNoTrackObject::operator new(void))(unsigned int)'<br />
C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afxtls_.h(131) : see declaration of 'new'<br />
E:\develop\absolve\absolve\MainMenuView.cpp(29) : error C2660: 'new' : function does not take 3 parameters<br />
Error executing cl.exe.
Nothing's been changed in the code, so I can't see what the hell I've done, and I can't make it go away!
Any ideas folks?
Dylan Kenneally
London,UK
|
|
|
|
|
A guess as to the cause is that an inlcude file before crtdbg.h has ab incorrect ending or a problem in it such as a non-closed comment. I qould check your stdafx.h file to see what is included before crtdbg.h and check out those files.
On an different note. I used to get a periodic problem like this on one of my projects. I could get it to go away by doing a rebuild all.
Roger Allen
Sonork 100.10016
If I'm not breathing, I'm either dead or holding my breath.
A fool jabbers, while a wise man listens. But is he so wise to listen to the fool?
Please step to the rear of the car and make room for more victims. - John Simmons the Outlaw programmer, 1st Feb 2002, in the lounge
|
|
|
|
|
Thanks for that Roger. I've checked the #include's and the stdafx, and can't find anything wrong. I have got round it by doing a clean rebuild all - the only problem here is that it takes about 15 mins to build the four projects in the workspace, which means I'm going for fag breaks too often!
Dylan Kenneally
London,UK
|
|
|
|
|
the next time it happens try this...
comment out this block of code
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
at the beginning of whatever implementation file that you just changed. Then do a build. Then uncomment it and do it again.
Weird, huh? Isn't Microsoft grand?
Sef Tarbell
"A mind all logic is like a knife all blade, it makes the hand bleed that wields it." --Rabindranath Tagore
|
|
|
|
|
I have written a COMM object derrived from CmdTarget, which called from another application.
I would like to show an hour glass, have tried CHourglass and beginWaitCursor and endwaitcursor but nothing happens.
Can anyone offer any advice
Thanks
Rich
|
|
|
|
|
hello,
i made a class with all sorts of functions...
but i actually need to use it as an independant object (compiled) so i can give it to people and that they dont have the source. How can i easily do this?? For example make it a DLL or an Active-X component.. or perhaps something else i haven't heard of yet?? Or is there no easy way out and do i have to rewrite the entire thing so it can be compiled as a DLL??
Any help is appreciated
P.S.: yes, it probably was rather dumb to write it as a class when i needed it to be a DLL or something, lol...
Kuniva
--------------------------------------------
God gave man a penis and a brain but not enough blood to make both of 'em work at the same time.
|
|
|
|
|
Make it into a COM object. COM does exactly what you want. Buy "Developers workshop to COM and ATL 3.0", by Andrew Troelson. it's a mighty good book.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
You can also make it a static library (.lib ) file, and give it away along with the header files. Please note this will only work in VC++. Also, you would need to release several versions depending on the C run-time library linked against: multithreaded/single-threaded, debug/release, static/dynamic. Fortunately, building this bunch of versions is as simple as having different subprojects with the appropriate C run-time settings.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
With the MFC class CEdit it is possible to receive notification messages for EN_UPDATE (for when the control is about to display altered text) and EN_CHANGE (for when the control has finished the display of altered text).
Can anyone tell me how I can get notification to my dialog when the user is simply moving the cursor caret around inside the edit control and the text is not changing?
I am using a single line version of the CEdit control.
Your help would be greatly appreciated. If you need further information about what I am doing or in order to answer my question please leave a reply post here and I will answer back.
Thanks
Mike
|
|
|
|
|
You'd have to handle a variety of messages. WM_CHAR for characters; i believe this message is sent even if it's only a system key like a cursor key being pressed. Also, you'd want some mouse button messages... WM_LBUTTONDOWN or UP , for example. Because the user can reposition the cursor with a mouse click.
Jon
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Thanks Jon. Your idea gave me the encouragement to do what needed to be done. I subclassed the CEdit control with a class that has message handlers for all of the appropriate messages that potentially change the caret position in the edit box. These include WM_KEYDOWN, WM_KEYUP, the three left moouse button messages, the three right mouse button messages and the reflected CHANGE message. It turns out that WM_CHAR is not so very useful as this does not get sent except for typed characters that will be modifying the edit box text contents. One sees no response there except for the likes of the arrow keys that actually move the caret around.
Thanks again. Mike
|
|
|
|
|
Hi,
Is there any way to get the Driver name Assosiated with a DSN??What is the Function to be Used??
Pls Help
|
|
|
|
|
Help... i am trying to write a function for my program but i forgot how to change the font size for the string in the CDC function DrawText(). can anyone tell me how do i do that? i want to make my font bigger so when i use the DrawText function it will be bigger than the default font size.
oh the function parameters are for DrawText is...
int DrawText(Cstring &str, CRect rect, UINT format);
int DrawText(CString &str, int count, CRect rect, UINT format);
|
|
|
|