|
I just tried, it works like a charm, big help!
|
|
|
|
|
\n is normally only for consoles in win32.
The win32 user interface is working with \r\n.
Don't try it, just do it!
|
|
|
|
|
Following should work.
MessageBox("First line\nSecond line");
We Believe in Excellence
|
|
|
|
|
Aqueel wrote: MessageBox("First line\nSecond line");
some time not
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
I have a project coded in Visual Studio 6, now I just installed Studio 2005 and when I compile it, it gives me the following error, although I did not modify the source code at all.
Error 2 fatal error LNK1181: cannot open input file '.\Debug\APPMODUL.obj'
I also get a warning:
Warning 1 warning LNK4076: invalid incremental status file '.\Debug/pmt.ilk'; linking nonincrementaly
and I don't know why this appears either. Maybe someone can help me pls?
|
|
|
|
|
When you open your project in Studio 2005, just delete 'debug' folder from project folder. and then rebuild your project and solution.
-Malli...!
|
|
|
|
|
Hi all,
does anybody knows if it is possible to have different behaviour of a function in template classes ?
I need to control the flow in differen cases.
I need something like this example (where I used a pseudo code format)
template <typename MYTYPE>class CMyClass{<br />
MYTYPE var;<br />
...<br />
void fun(){<br />
CString str;<br />
if(MYTYPE == int) str.Format("%d",var);:|<br />
if(MYTYPE == float) str.Format("%f",var);:|<br />
if(MYTYPE ???) str="Unable format conversion";:|<br />
}<br />
...<br />
}
Have a nice code day
|
|
|
|
|
Hello _Russell_,
What you need is known as "explicit template specialization". Define each specialized version of "void fun()" as follows :
void CMyClass<int>::fun()
{
str.Format("%d", var);
}
void CMyClass<float>::fun()
{
str.Format("%f", var);
}
Best Regards,
Bio.
-- modified at 7:08 Tuesday 21st February, 2006
|
|
|
|
|
|
Thanks friends,
It works.
But let me know if are possible other solutions, expecially if exist a way similar to the way that I used in the first message (if it exist then in some cases it can be a very fast way to write code!)
Have a nice code day
|
|
|
|
|
Yes, you can use a policy-based design as one way to solve this:
template <class T> struct format_string
{
LPCTSTR get_string() { assert(false); }
};
template<> struct format_string<int>
{
LPCTSTR get_string() { return _T("%d"); }
};
template<> struct format_string<float>
{
LPCTSTR get_string() { return _T("%f"); }
};
template<class T, class policy=format_string<T> > class foo
{
public: void fun() { CString s = policy::get_string(); }
};
--Mike--
Visual C++ MVP
LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
Hello
I create a CSocket object then I post it to a thread but when I post it to thread, posted object(pointer) is not valid in thread
how can I create a socket out of thread and send it to thread?
thanks
Mehrdad
|
|
|
|
|
Your question does not seem to be very clear.
How do you create the CSocket object? If it is like:
CSocket sock;<br />
...Initialize it etc.<br />
CreateThread(... , (void*)&sock...);
Then it is not going to work, because the object is being created on the stack and will be destroyed when the calling function exits.
Create it on the heap etc:
CSocket* pSock;<br />
pSock = new CSocket;<br />
...Initialize it etc.
Then send it to the thread.
Hope that helps.
this is this.
|
|
|
|
|
Many types of MFC objects can't be passed between threads becaues MFC keeps per-thread data structures. Pass the SOCKET handle to the thread then call CSocket::FromHandle()
--Mike--
Visual C++ MVP
LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
By using Winsock, 2 network cards in a single PC connected through cross over cable, is it possible to do file transfering using these 2 network cards? I would like to force the file transfering from network card #1 to network card #2.
Thanks.
|
|
|
|
|
I have not tried it, but I think you could assign different IP addresses for use with each of the cards? My guess would be to run one application and bind it to one IP address and run another application and bind it to the other IP address, and then there should be no problem.
this is this.
|
|
|
|
|
Hi friends
i have a windows service which is updating time data in a file (like 01:20). When I change system time in Windows Date and Time Property , the timing changes are reflected in the file by my service. But I change the time zone tab, the modified time it is not reflected in the file by my service. Windows Time is changed in SysTray icon. Why is not changed in my service ? i use localtime()
by shadrach
-- modified at 6:04 Tuesday 21st February, 2006
|
|
|
|
|
I think it is because the service is independent of the current logged-in user. You know that services cannot even read registry values in the HKEY_CURRENT_USER hive.
So my guess is that it (the service) does not care whether you change the regional settings or not. Because it does not even know you (the current user)
this is this.
|
|
|
|
|
khan++ wrote: You know that services cannot even read registry values in the HKEY_CURRENT_USER hive.
Little Exception you can read it from HKEY_USER hives
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Yes. You are definitely right.
Thanks.
this is this.
|
|
|
|
|
How can I save the owndraw content in the CListView as a html file or a .txt file?
the owndraw content include the arrows and some lines, how can I do with it? If you give me a help, I will appreciate it.thank you very much!
|
|
|
|
|
runningfeng wrote: owndraw content in the CListView
which content ? which ClistView ?
~RaGE();
|
|
|
|
|
I am getting the following error. Can anyone help in resolving this:
I found this error when i converted the VC++ 6.0 project to VC++ 7.0(VC++.net)
error C2663: 'ATL::CSimpleStringT<basetype,t_bmfcdll>::GetBuffer' : 2 overloads have no legal conversion for 'this' pointer
with
[
BaseType=char,
t_bMFCDLL=true
]
Cheers
"Peace of mind through Technology"
|
|
|
|
|
Can you post your code. pls.
~RaGE();
|
|
|
|
|
HI
I have found the solution for the same.
Anyways thanx for replyng.
Cheers
"Peace of mind through Technology"
|
|
|
|