|
Nobody is going to write the whole code for you. You should start yourself and if you'll have problems, then ask here.
And please read How-to-get-an-answer-to-your-question[^] before posting next time.
|
|
|
|
|
This question has been asked a number of times already.
Please read How to get an answer to your question specifically the part about not expecting other people to do the work for you. Having read your biography from the link on your home page I suspect you may not have sufficient experience to consider embarking on such an ambitious project.
|
|
|
|
|
Is there an app for checking an include headers function support ie printf scanf etc
|
|
|
|
|
Please clarify your question
Величие не Бога может быть недооценена.
|
|
|
|
|
What do you need excatly?
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Hello,
I'm writing/maintaining an MFC app that makes extensive use of a database API that uses std::min and std::max, which is used in most of the application's translation units. Therefore, it makes sense to include the APIs convenience header (which in turn includes everything) in stdafx.h. The API requires that I #define NOMINMAX, so that the C++ std library's min and max function templates are used, rather than MS's legacy min and max macros. I have #define'd NOMINMAX in stdaxf.h . This worked fine for a long time. However, I recently installed the MFC 2008 feature pack. I must now #include afxcontrolbars.h. However, this header has inline functions that are dependent on the min and max macros which are now missing. I tried to "#include algorithm; using std::min; using std::max;" immediately before I include afxcontrolbars.h, so that std::min and std::max would be used as drop in replacements for the macros (this has worked in other areas in the past) but stdafx.cpp still doesn't build:
1>Compiling...
1>stdafx.cpp
1>c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\afxtoolbar.h(166) : error C2782: 'const _Ty &std::max(const _Ty &,const _Ty &)' : template parameter '_Ty' is ambiguous
1> c:\program files\microsoft visual studio 9.0\vc\include\xutility(3356) : see declaration of 'std::max'
1> could be 'LONG'
1> or 'int'
1>c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\afxtoolbar.h(166) : error C2780: 'const _Ty &std::max(const _Ty &,const _Ty &,_Pr)' : expects 3 arguments - 2 provided
1> c:\program files\microsoft visual studio 9.0\vc\include\xutility(3364) : see declaration of 'std::max'
1>c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\afxmenubar.h(161) : error C2782: 'const _Ty &std::max(const _Ty &,const _Ty &)' : template parameter '_Ty' is ambiguous
1> c:\program files\microsoft visual studio 9.0\vc\include\xutility(3356) : see declaration of 'std::max'
1> could be 'LONG'
1> or 'int'
1>c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\afxmenubar.h(161) : error C2780: 'const _Ty &std::max(const _Ty &,const _Ty &,_Pr)' : expects 3 arguments - 2 provided
1> c:\program files\microsoft visual studio 9.0\vc\include\xutility(3364) : see declaration of 'std::max'
1>c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\afxdesktopalertwnd.h(81) : error C2782: 'const _Ty &std::max(const _Ty &,const _Ty &)' : template parameter '_Ty' is ambiguous
1> c:\program files\microsoft visual studio 9.0\vc\include\xutility(3356) : see declaration of 'std::max'
1> could be 'UINT'
1> or 'int'
1>c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\afxdesktopalertwnd.h(81) : error C2780: 'const _Ty &std::max(const _Ty &,const _Ty &,_Pr)' : expects 3 arguments - 2 provided
1> c:\program files\microsoft visual studio 9.0\vc\include\xutility(3364) : see declaration of 'std::max'
1>Build log was saved at "file://c:\Documents and Settings\User\My Documents\Visual Studio 2005\Projects\Lustre\Lustre\Debug\BuildLog.htm"
1>Lustre - 6 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
What should I do?
Regards,
Sternocera
|
|
|
|
|
Can you do something like this:
#undef NOMINMAX
#include "afxcontrolbars.h"
#define NOMINMAX
|
|
|
|
|
Richard,
Thanks for that. I should have mentioned that that was the first thing that I tried. The result was exactly the same compiler errors as when I don't #undef:
1>------ Build started: Project: Lustre, Configuration: Debug Win32 ------
1>Compiling...
1>stdafx.cpp
1>c:\program files\microsoft sdks\windows\v6.1\include\gdiplustypes.h(471) : error C3861: 'min': identifier not found
1>c:\program files\microsoft sdks\windows\v6.1\include\gdiplustypes.h(472) : error C3861: 'min': identifier not found
1>c:\program files\microsoft sdks\windows\v6.1\include\gdiplustypes.h(473) : error C3861: 'max': identifier not found
1>c:\program files\microsoft sdks\windows\v6.1\include\gdiplustypes.h(474) : error C3861: 'max': identifier not found
1>c:\program files\microsoft sdks\windows\v6.1\include\gdiplustypes.h(495) : error C3861: 'max': identifier not found
1>c:\program files\microsoft sdks\windows\v6.1\include\gdiplustypes.h(496) : error C3861: 'max': identifier not found
1>c:\program files\microsoft sdks\windows\v6.1\include\gdiplustypes.h(497) : error C3861: 'min': identifier not found
I guess that exactly the same error message appears because stdafx.h is included in some header that is included somewhere, directly or indirectly, in gdiplustypes.h et al, which are included in afxcontrolbars.h.
Regards,
Sternocera
|
|
|
|
|
I've come up with this unfortunate hack:
#define NOMINMAX
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
#include <afxcontrolbars.h>
#undef max
#undef min
When I undefined NOMINMAX, min and max were already defined, so it didn't matter. So, I've simply defined min and max just as they are defined from within WinDef.h .
Regards,
Sternocera
|
|
|
|
|
Brilliant! Not sure I would have thought of that...... 
|
|
|
|
|
While your hack (mentioned in another post) doesn't seem too egregious to me, another possible solution could be to add more template function overloads - I'm just showing max here:
namespace std {
template<class A>
bool max(int const& a, A const& b) { return a>b?a:b; }
template<class A>
bool max(A const& a, int const& b) { return a>b?a:b; }
}
These should take care of the cases in your header that aren't compiling with the STL min function, as (if you read the error messages) one of the types involved is always int.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi just include
#include <iostream>
#include <algorithm>
to your source file and this should be easily solved
|
|
|
|
|
No. Notice I suggested defining partially specialised templates, not the ones in <algorithm> - this is because the OPs problem was because of a template parameter deduction failure due to a mix of LONG and int parameters being passed to min/max.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
int DrawShadowText(HDC hdc,
LPCWSTR pszText,
UINT cch,
const RECT *pRect,
DWORD dwFlags,
COLORREF crText,
COLORREF crShadow,
int ixOffset,
int iyOffset
);
1. What 's "DWORD dwFlags" use for?? In MSDN document, They just tell "A DWORD that specifies how the text is to be drawn."
2. How can i align text when i use this function????
|
|
|
|
|
Maybe try the possible values for nFormat descibed here[^] (like DT_LEFT, DT_TOP, ...).
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
You can see on Adv. Win32 group [^]
(they have source code (C) for all Win32 apis...)
|
|
|
|
|
I want to draw a disabled icon. I try this:
CPoint point(10,20);
CSize size(16,16);
CBrush brush(RGB(255,0,0));
pDC->DrawState(point,size,hIcon,DST_ICON | DSS_DISABLED,&brush);
The "size" isn't correct. I want to draw 16x16, but it's alway larger. Why?? Please help me!!
If can't, help me to draw disabled icon (size 16x16)!!!
modified on Sunday, August 30, 2009 2:33 PM
|
|
|
|
|
How did you get hIcon ?
Try and use LoadImage with 16 as the cxDesired and cyDesired parameters.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
hi ... can anyone advice me how to make a graphical text editor in c++ without using microsoft foundation classes....please help
|
|
|
|
|
|
hey dude...thanks for the reply...but i dont want to use win32 api either....if u can just tell me how..to go about creating a graphical text editor in c++ without using mfc or win32 api...that would be more than sufficient....thanks in advance!! 
|
|
|
|
|
It sounds as if either:
1. Your question is a joke, or
2. You don't know what you're talking about
If you don't want to use the Win32 API, then what are you imagining you would use?
|
|
|
|
|
What exactly are you going to use, then, magic fairy dust?
|
|
|
|
|
is it possible to use it ...aneyways was planning to make it using graphics.h...but i think using win32/mfc would be a better option..it might be tough in the starting...but in the long run its going to be a better thing to work on..thanks a lot guys....for ur valuable suggestions 
|
|
|
|
|
Hello,
I want to place the caret position at the end of the text in a CRichEditCtrl. But when it naturally moves to the CRichEditCtrl box the caret is placed at the beginning.
I tried the message EM_POSFROMCHAR but it takes one character and gives its position and I cant give that last one character as it can repeat in between somewhere.
How should I place the caret at the end?
I hope my question was clear.
Thanks for the codeproject forum.
Pritha 
|
|
|
|