|
Look in your WinMain procedure where it calls the dialog, and change the reference as required.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
I have a CTreeViewCtrl, it has 2 item, "Item1", "Item2", when I move mouse to "Item1", show tip message "this is Item1", when I move mosue to "Item2", show tip message "this is Item2", how can I realize this with WTL, thanks a lot.
|
|
|
|
|
If your tree control has TVS_INFOTIP style it will send it's parent the TVN_GETINFOTIP [^] notification.
Handle it in the parent message map with the
NOTIFY_CODE_HANDLER(TVN_GETINFOTIP, OnGetInfoTip) macro and a matching
LRESULT OnGetInfoTip(int , LPNMHDR pnmh, BOOL& )
{
LPNMTVGETINFOTIP pgit = (LPNMTVGETINFOTIP)pnmh;
cheers,
AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
I got it,thank you very much
|
|
|
|
|
shg104 wrote: I got it,thank you very much
Then please upvote the answer
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
Hi,
At my workplace we have a number of programs (sub systems) which make up our software. Some of these programs need functionality from other programs and I'm trying to find a good way to perhaps modularize each program so that common code/resources can be used "globally". The current example forcing me to find a solution is the need to launch a dialog from our Accounting package from another sub system. The big problem is that this is quite a large dialog and depends a lot on things from the Accountings MainFrame.
I was thinking that for each sub system I could create a DLL which contained common dialogs, etc that could be used by other programs. The problem I face is that a lot of the dialogs have dependencies on their parent programs MainFrame and I'm not sure how to get around it. I guess one solution might be to take everything out of the MainFrame and put it into its own class which can then be passed to the DLL.. but I don't even know if that would work as I still need to Initialise this new class the same way it would be done in the parents program, but now in the other sub system.. though in saying that the DLL should probably be responsible for setting itself up.
Your thoughts?
Cheers
|
|
|
|
|
I do not know whether or not this has anything to do with "ATL / WTL / STL", as it seems purely a question of "Design & Architecture". I would suggest posting it in the latter forum.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
First of all, you have posted your question in a wrong section.
Secondly, what I understood is, you need a compact solution.
Lets assume you have A,B,C these three Sub programs having dependency on X,Y,Z systems. Now again you said, you have a main prog., say ProgMain, which then have a total control over A,B & C. Am I right?
If this is a kind of situation, then I would rather prefer to use MFC/MDI with multi threaded arcitecture. Rather using DLL, I would suggests you to use Class files of A,B,C.
I can give you better suggestion, if you can explain the situation with a good example.
|
|
|
|
|
I'll try explain it again as I'm not sure if your suggestion is applicable.
There is a program called MainMenu which is basically the launching point for all the other sub systems like Accounting, Address Book, etc. There is now a need to be able to launch a dialog in Address Book that is in Accounting. Eg. for a person in the address book we might like to add a bank account to them so we want to the launch the "Add Account" dialog contained in the Accounting program.
I can see two ways of doing this.
1. Putting common dialogs/code from each sub program into its own DLL so it can be used in other programs
2. Sending a message to main menu which then opens Accounting if its not open already, and then opens the required dialog then messages the result back.
Option one I'm not entirely sure if it a good solution and option two would work but it would require a custom messaging system to be able to make it scalable I think.
Are there other options out there that help with this sort of Inter-Program-Communication/Modularizing problem?
|
|
|
|
|
Hi All,
I want to create a map of CList items. I tried the following.
CList<int> li;
CMap <CString, LPCTSTR, CList<int>, CList<int>> testMap;
VS2008 throws error
Error 6 error C2248: 'CObject::operator =' : cannot access private member declared in class 'CObject' c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\afxtempl.h 776 TestUG
Can anyone help me with creating a map with a list.
Thanks
kasi
|
|
|
|
|
I do not know whether or not this has anything to do with "ATL / WTL / STL", as it seems purely a question of "C / C++ / MFC". I would suggest posting it in the latter forum.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
i think this is because of lack of overloaded assignment operator in CList class. Try delcaring your map as
CMap <CString, LPCTSTR, CList<int>, CList<int>& > testMap;
|
|
|
|
|
I have a vector of strings which I want to search for a particular string.
I am using:
vector<string>::iterator it = find( vecStrings.begin(), vecStrings.end(), sMax );
sMax is a std::string
When I compile this (and it is specifically this line causing the problem) I get the following:
c:\program files\microsoft visual studio\vc98\include\algorithm(43) : error C2784: 'bool __cdecl std::operator ==(const class std::vector<_Ty,_A> &,const class std::vector<_Ty,_A> &)' : could not deduce template argument for 'const class std::vector
<_Ty,_A> &' from 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
C:\test\test.cpp(6846) : see reference to function template instantiation 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *__cdecl std::find(class std::basic_string<char,struct std::char_trai
ts<char>,class std::allocator<char> > *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *,const class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)' being compiled
c:\program files\microsoft visual studio\vc98\include\algorithm(43) : error C2784: 'bool __cdecl std::operator ==(const class std::allocator<_Ty> &,const class std::allocator<_U> &)' : could not deduce template argument for 'const class std::allocat
or<_Ty> &' from 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
C:\test\test.cpp(6846) : see reference to function template instantiation 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *__cdecl std::find(class std::basic_string<char,struct std::char_trai
ts<char>,class std::allocator<char> > *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *,const class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)' being compiled
c:\program files\microsoft visual studio\vc98\include\algorithm(43) : error C2784: 'bool __cdecl std::operator ==(const class std::istream_iterator<_U,_E,_Tr> &,const class std::istream_iterator<_U,_E,_Tr> &)' : could not deduce template argument fo
r 'const class std::istream_iterator<_U,_E,_Tr> &' from 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
C:\test\test.cpp(6846) : see reference to function template instantiation 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *__cdecl std::find(class std::basic_string<char,struct std::char_trai
ts<char>,class std::allocator<char> > *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *,const class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)' being compiled
c:\program files\microsoft visual studio\vc98\include\algorithm(43) : error C2784: 'bool __cdecl std::operator ==(const class std::reverse_bidirectional_iterator<_BI,_Ty,_Rt,_Pt,_D> &,const class std::reverse_bidirectional_iterator<_BI,_Ty,_Rt,_Pt,_
D> &)' : could not deduce template argument for 'const class std::reverse_bidirectional_iterator<_BI,_Ty,_Rt,_Pt,_D> &' from 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
C:\test\test.cpp(6846) : see reference to function template instantiation 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *__cdecl std::find(class std::basic_string<char,struct std::char_trai
ts<char>,class std::allocator<char> > *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *,const class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)' being compiled
c:\program files\microsoft visual studio\vc98\include\algorithm(43) : error C2784: 'bool __cdecl std::operator ==(const class std::istreambuf_iterator<_E,_Tr> &,const class std::istreambuf_iterator<_E,_Tr> &)' : could not deduce template argument fo
r 'const class std::istreambuf_iterator<_E,_Tr> &' from 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
C:\test\test.cpp(6846) : see reference to function template instantiation 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *__cdecl std::find(class std::basic_string<char,struct std::char_trai
ts<char>,class std::allocator<char> > *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *,const class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)' being compiled
c:\program files\microsoft visual studio\vc98\include\algorithm(43) : error C2784: 'bool __cdecl std::operator ==(const class std::reverse_iterator<_RI,_Ty,_Rt,_Pt,_D> &,const class std::reverse_iterator<_RI,_Ty,_Rt,_Pt,_D> &)' : could not deduce te
mplate argument for 'const class std::reverse_iterator<_RI,_Ty,_Rt,_Pt,_D> &' from 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
C:\test\test.cpp(6846) : see reference to function template instantiation 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *__cdecl std::find(class std::basic_string<char,struct std::char_trai
ts<char>,class std::allocator<char> > *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *,const class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)' being compiled
c:\program files\microsoft visual studio\vc98\include\algorithm(43) : error C2784: 'bool __cdecl std::operator ==(const struct std::pair<_T1,_T2> &,const struct std::pair<_T1,_T2> &)' : could not deduce template argument for 'const struct std::pair<
_T1,_T2> &' from 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
C:\test\test.cpp(6846) : see reference to function template instantiation 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *__cdecl std::find(class std::basic_string<char,struct std::char_trai
ts<char>,class std::allocator<char> > *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *,const class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)' being compiled
c:\program files\microsoft visual studio\vc98\include\algorithm(43) : error C2676: binary '==' : 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' does not define this operator or a conversion to a type accept
able to the predefined operator
C:\test\test.cpp(6846) : see reference to function template instantiation 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *__cdecl std::find(class std::basic_string<char,struct std::char_trai
ts<char>,class std::allocator<char> > *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *,const class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)' being compiled
Any ideas?
|
|
|
|
|
Hi,
Your compiler's first message is explanative:
Jonnster wrote: I get the following:
c:\program files\microsoft visual studio\vc98\include\algorithm(43) : error C2784: 'bool __cdecl std::operator ==(const class std::vector<_Ty,_A> &,const class std::vector<_Ty,_A> &)' : could not deduce template argument for 'const class std::vector
Make it happy with:
std::vector<std::string>::iterator it = std::find(vecStrings.begin(), vecStrings.end(), sMax); With C++0x (VS2010 or gcc 4.5) you can write:
auto it = std::find(vs.begin(), vs.end(), sMax); which instructs the compiler to deduce the type of it .
With previous compilers use typedef to get simpler code:
typedef std::vector<std::string> VS;
VS vs;
VS::iterator it = std::find(vs.begin(), vs.end(), sMax);
cheers,
AR
C++0x wording edited
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
modified on Friday, October 22, 2010 4:24 AM
|
|
|
|
|
Hi All,
I want to declare memory dynamically for a 2 dimensional array.
and then want to use that pointer like an array.
as i am using ANSI compiler so there is no need to typecast the return type of the memory block returned by malloc()
so if i will write the inline code line as arr=malloc (nrows*5*sizeof(int)); its working correctly but i just want to know to be at the safer side that if i will be using the old compiler how to type cast the same as arr=(int [] *)(malloc (nrows*5*sizeof(int))); this is giving error.(i am on linux)
thanks
#include<stdio.h>
#include<stdlib.h>
int main()
{
int nrows=2,i,j;
int (*arr)[5];
<code>arr=(int [] *)(malloc (nrows*5*sizeof(int)));</code>
for(i=0;i<nrows;i++)
for (j=0;j<5;j++)
arr[i][j]=17;
for(i=0;i<nrows;i++)
for (j=0;j<5;j++)
printf("\n%d",arr[i][j]);
}
|
|
|
|
|
Try this:
arr=(int (*)[5])malloc (nrows*5*sizeof(int));
Alternatively (and this is clearer overall) use a typedef:
typedef int (*ArrType)[5];
int main()
{
ArrType arr;
arr=(ArrType)malloc (nrows*5*sizeof(int));
... Rest of code ...
}
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
CodeProject MVP for 2010 - who'd'a thunk it!
|
|
|
|
|
i use in linux by make,
but it output:
Linking CppFit_tests
lib/libCppFit.a(Mutex.o): In function `Mutex::Mutex()':
Mutex.cpp text+0x18): undefined reference to `pthread_mutexattr_init'
Mutex.cpp text+0x2b): undefined reference to `pthread_mutexattr_settype'
lib/libCppFit.a(Mutex.o): In function `Mutex::Mutex()':
Mutex.cpp text+0xaa): undefined reference to `pthread_mutexattr_init'
Mutex.cpp text+0xbd): undefined reference to `pthread_mutexattr_settype'
lib/libCppFit.a(Thread.o): In function `Thread::start()':
Thread.cpp text+0x230): undefined reference to `pthread_create'
lib/libCppFit.a(Thread.o): In function `Thread::join()':
Thread.cpp text+0x268): undefined reference to `pthread_join'
collect2: ld returned 1 exit status
The program is:
struct MutexInnards
{
public:
pthread_mutex_t mutex;
int nestLevel;
};
Mutex::Mutex()
{
pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr);
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
innards = new MutexInnards();
innards->nestLevel = 0;
pthread_mutex_init(&innards->mutex, &attr);
}
Mutex::~Mutex()
{
pthread_mutex_destroy(&innards->mutex);
delete innards;
}
void Mutex::acquire()
{
pthread_mutex_lock(&innards->mutex);
// innards->nestLevel++;
}
void Mutex::release()
{
// innards->nestLevel--;
// if (innards->nestLevel <= 0)
// {
// innards->nestLevel = 0;
pthread_mutex_unlock(&innards->mutex);
// }
}
|
|
|
|
|
I don't really see much of a question here but I assume the problem is the undefined references in your link action, all of which suggest you are missing a reference to a library from your make file.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
thanks, i will look something about make file again
|
|
|
|
|
It's not so much the make file itself but your rules. In your code you have calls to pthread_mutexattr_init and others, but the linker cannot resolve those names. This suggests that the names are defined in an external library which has not been added to your list of dependencies in the build of your executable. Identify that library and you have solved the issue.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
|
You're welcome.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
hi all
I got following problem :
I want to read and variable (age ) but when its not properly entered I want to write
bad format or etc.
example
printf("enter age \n");
scanf ("%d,&age");
and I need to create a condition which is saying in case you enter string or non integer number (7,5 )
write bad format eter again
thanks
|
|
|
|
|
This is a common problem of scanf() . You can use this[^] technique to solve your problem.
NOTE: Next time when you want to post a C question please use the C\C++\MFC forum[^].
|
|
|
|
|
Use the features of the function to verify your input; see the MSDN documentation here[^]. A simple loop checking that you have a converted field and that its value is within the range you require should do the trick.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|