|
Cedric Moonen wrote: use your debugger, it will save you hours of hassle.
Because with the following definition of CClipSaver the posted code works just fine
class CClipSaver
{
public:
void Save(){ cout << "Clip.Save" << endl;}
};
led mike
|
|
|
|
|
In fact I use this code inside an MFC dll.
When I put F9 on the line and press F5 to load the file that uses the dll, it disables the breakpoint expressing that the breakpoint is disabled because it is at the beginning of the program!!
I now used it in an MFC exe, surprisingly, NO ERROR occurs!!
|
|
|
|
|
OH I finally figured out!!!
The dll had to be called from a vb6 application (the hell with that!)
In declarations, there was a missing ByVal statement, which caused address value of i to be sent instead of its value.
Thanks all you folks for your attention which helped me figure this out, by checking other possibilities!
|
|
|
|
|
Hello, I have inherited a project that was originally written in VC++ 6.0 and am trying to compile it in vs 2005 but get several static_cast errors in my MESSAGE_MAPS. One example message map is
BEGIN_MESSAGE_MAP(CSlave, CWnd)
//{{AFX_MSG_MAP(CSlave)
ON_WM_CREATE()
ON_WM_NCHITTEST() <===Getting Error Here
ON_WM_NCMOUSEMOVE()
ON_WM_LBUTTONDOWN()
ON_WM_RBUTTONDOWN()
ON_WM_LBUTTONUP()
ON_WM_MOUSEMOVE()
ON_WM_WINDOWPOSCHANGING()
ON_WM_PAINT()
//}}AFX_MSG_MAP
ON_MESSAGE(WM_TIFF,OnImage)
END_MESSAGE_MAP()
The exact error is:
cannot convert from 'UINT (__thiscall CSlave::* )(CPoint)' to 'LRESULT (__thiscall CWnd::* )(CPoint)'
The CSlave Class is derived from the CWnd class in an included .h file So I am not certain why this error is occuring. This is happening in several files of the project and any help from the community would be greatly appreciated. Thank you.
Also I will answer any questions as quickly as possible.
|
|
|
|
|
Look carefully at the error message. Some return values changed in message handler methods.
You may need to change your OnNcHitTest() method declaration to return the proper type.
Mark
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
Thank you Mark for the reply. After looking over each one I see that the return types are always different. I'm going to see why they are changed because I know that the project compiles and runs properly in VS 6.0. I'm wondering if it may have happened when the project was converted to 2005.
After examining further I've noticed that the base methods for CWnd always return LRESULT but the methods used in the code i've been given return some data type, void, UINT, BOOL, etc. I will look into this.
|
|
|
|
|
It changed in MFC.
Most are changed for 64-bit support I believe. LRESULT, WPARAM, LPARAM are now all large enough
to hold a pointer on 32 or 64 bit builds (or 65-bit for those that go one higher ).
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
Thank you very much for the help. I've noticed that the code is riddled with int to double and double to long conversions so it seems i'm going to have to go through and clean everything up making it more in line with what the original coder wanted to do.
Blake M. Ward
|
|
|
|
|
bward84 wrote: I've noticed that the code is riddled with int to double and double to long conversions
Bummer. Those would (should!) be unrelated to MFC message handler changes.
Have fun with that
Mark
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
I seemed to be able to remove the errors mentioned by redefining the functions being called by ON_MESSAGE. It seems that when this code was written ON_MESSAGE would return nothing (void) and you could define function handlers which would accept no arguments. I had to redefine them to return LRESULT and to accept WPARAM and LPARAM. However, now I am getting a problem when buttons are clicked. I get a Debug Assertion Failed box saying that the error occured on line 143 of filecore.cpp. I'm not sure if my above actions have caused this or if this is due to something else.
|
|
|
|
|
bward84 wrote: I get a Debug Assertion Failed box saying that the error occured on line 143 of filecore.cpp
What's on that line? In the version I have, it's
ASSERT(shareCompat == 0);
where shareCompat is an enumeration value == 0.
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
Hi. To get answer on your question, look here -> http://forums.microsoft.com/msdn/showpost.aspx?postid=8663&siteid=1
|
|
|
|
|
I am having trouble viewing that page, it is not loading. I will try again after some necessary meetings. Thank you for the help.
|
|
|
|
|
I have got an MFC dialog with a CEdit control. I wish to toggle the "passwordish" behaviour of the control but:
m_oNetworkKeyEdit.ModifyStyle( 0, ES_PASSWORD );
or
m_oNetworkKeyEdit.ModifyStyle( ES_PASSWORD, 0 );
do not do anything. Is there a way, or do I actually have to use CreateWindow() to create a new window each time?
Thanks A Million
Adam
_____________________________________
Action without thought is not action
Action without emotion is not life
|
|
|
|
|
Adam, see the 3rd last post on this[^] page.
/ravi
|
|
|
|
|
The ES_PASSWORD style can't be removed.
Try m_oNetworkKeyEdit.SetPasswordChar(0);
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
Create two controls; one with and the other without. Call ShowWindow() accordingly.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I haven't got this file! I've got Visual Studio 6 on my system with, I presume, MFC 6. Do I have to upgrade to a newer MFC to get this?
|
|
|
|
|
I'm pretty certain you have to upgrade.
|
|
|
|
|
It sounds like it's part of a 3rd party library. I don't have that file in any version of VC or PSDK on my machine right now.
|
|
|
|
|
Michael, You are my hero! I was interested in this header file because I wanted to make text entries in a list control appear in different colours. I have just looked at your 'Neat Stuff to do in List Controls Using Custom Draw' and used the method you describe and it has worked like a dream.
|
|
|
|
|
I'm currently workin on a project and was wondering if anyone knew of a way to open up a web page using C++ code, and then set the size of the screen that opens, or does anyone know of anywhere to get some more help
|
|
|
|
|
I use the class in this[^] article to open a web page from my app.
/ravi
|
|
|
|
|
Tully2003 wrote:
I'm currently workin on a project and was wondering if anyone knew of a way to open up a web page using C++ code...
ShellExecute() will do just that.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I have used ReadDirectoryChangesW with recursive for sub-folders and watched changes in "c:\". It gave me output for a while and suddenly Microsoft thrown dialog something like "Not responding"....
Is their anyway to "Get the information of the file which is get added/modified/deleted anywhere on computer"
Thanks In advance.....
AmolM
|
|
|
|