|
Tomasz' solution sounds fine to me, but if you don't like it then i'd suggest subclassing the tree control & installing your own WM_RBUTTONDOWN handler; you'll probably find all sorts of other uses for subclassing the control anyway.
Shog9
|
|
|
|
|
Shog9 wrote:
if you don't like it then i'd suggest subclassing the tree control & installing your own WM_RBUTTONDOWN handler
This should work, however, if you use TVN_BEGINRDRAG you'd have to write non-trivial code.
Tomasz Sowinski -- http://www.shooltz.com
** Putt knot yore thrust inn spel chequers. **
|
|
|
|
|
I've created an MFC-dll.
InitInstance() gets called when the dll is called, and ExitInstance() is called when it's released. Normal behaviour so far.
Normaly, Run() should be called too (automaticaly), after InitInstance() , isn't it? In my dll, Run() never gets called. Is there a good reason for that?
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
CWinApp::Run contains the message loop. If you have DLL, there's no need for one - .exe provides its own.
Tomasz Sowinski -- http://www.shooltz.com
** Putt knot yore thrust inn spel chequers. **
|
|
|
|
|
Consider declaration,
std::string name = " ABCD"
As can be seen above the string consist of many "space bar"
characters in the beginning. I want to skip them and get the resultat string value. Please tell me how ????
|
|
|
|
|
name.substr(name.find_first_not_of(' '));
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
This would be easiest:
std::string name = "ABCD";
Now seriously: you should use string::find_first_not_of:
int pos = name.find_first_not_of(' ');
if (pos != std::string::npos)
{
name.erase(0, pos);
}
If you want to remove all spaces (not only at beginning), use this:
name.erase(std::remove(name.begin(), name.end(), ' '), name.end());
Tomasz Sowinski -- http://www.shooltz.com
** Putt knot yore thrust inn spel chequers. **
|
|
|
|
|
Should you use CString you have the following methods: TrimLeft , TrimRight .
Best regards,
Alexandru Savescu
|
|
|
|
|
(with tremulous voice) Don't lead the guy apart from the one and true std::string ! Now seriously, these functions, though not directly available, can be easily written:
#ifndef TRIMTEMPLATES_H
#define TRIMTEMPLATES_H
#define VERSION_TRIMTEMPLATES 0x00010000
template<class String,class Ch>
inline String& trim_left(String& str,Ch ws)
{
typename String::size_type first_nonblank;
if ((first_nonblank=str.find_first_not_of(ws))!=String::npos)
return str.erase(0, first_nonblank);
else
return str;
}
template<class String>
inline String& trim_left(String& str)
{
return trim_left(str, ' ');
}
template<class String,class Ch>
inline String& trim_right(String& str,Ch ws)
{
typename String::size_type last_nonblank;
if((last_nonblank=str.find_last_not_of(ws))!= String::npos)
return str.erase(last_nonblank+1);
else
return str;
}
template<class String>
inline String& trim_right(String& str)
{
return trim_right(str, ' ');
}
template<class String,class Ch>
inline String& trim(String& str,Ch ws)
{
return trim_left(trim_right(str, ws),ws);
}
template<class String>
inline String& trim(String& str)
{
return trim_left(trim_right(str));
}
#elif VERSION_TRIMTEMPLATES!=0x00010000
#error You have included two LISTPORTS.H with different version numbers
#endif
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaquín M López Muñoz wrote:
Don't lead the guy apart from the one and true std::string!
I never meant that! I like STL just as much as you do. I was just showing some MFC code
Best regards,
Alexandru Savescu
|
|
|
|
|
SHAME! SHAME! You should know better than to show MFC examples. People will get the mistaken impression its easier to use than the beloved STL.
|
|
|
|
|
Take it easy man!
I was not giving any MFC example, I was giving a CString example. CString is a very good class it can be argued that it is better than std::string (it uses reference counting remember!)
Best regards,
Alexandru Savescu
|
|
|
|
|
Alexpro wrote:
it is better than std::string
SACRILEDGE!!
Alexpro wrote:
CString is a very good class
BLASPHEMY!!
Oh NO! STr o k e...
BTW CString is part of MFC. (Microsoft Foul Code). Everyone knows was developed as part of a feindish plot to undermine portablilty with Unix/Linux.
|
|
|
|
|
Hi everybody:
I want to display two modal dialogs, one first and the other when user clicks ok button on first dialog.
I try this:
CDialog1 dlg1;
m_pMainWnd = &dlg1;
int nResponse = dlg1.DoModal();
if (nResponse == IDOK)
{
CDialog2 dlg2;
m_pMainWnd = &dlg2;
nResponse = dlg2.DoModal();
...
}
in InitInstance function of my app but doesn't work (first dialog is ok but other dialog is showed and killed inmediately without user interaction)
Anybody can help me?
|
|
|
|
|
Remove lines assigning pointers to m_pMainWnd.
Tomasz Sowinski -- http://www.shooltz.com
** Putt knot yore thrust inn spel chequers. **
|
|
|
|
|
Is it that? What's the reason of this behavior?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
See my reply to your reply to OP
Tomasz Sowinski -- http://www.shooltz.com
** Putt knot yore thrust inn spel chequers. **
|
|
|
|
|
Thanxs a lot. It is running well now.
|
|
|
|
|
The code seems OK. Try switching the order of appearance of the dialogs (just for the purpose of debugging), maybe the CDialog2 one is not showing for reasons not having to do with your question.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thank you Tomasz.
Gracias Joaquin.
|
|
|
|
|
The secret lies in CWnd::OnNcDestroy. The method compares this with m_pMainWnd and posts quit message if so.
Tomasz Sowinski -- http://www.shooltz.com
** Putt knot yore thrust inn spel chequers. **
|
|
|
|
|
Man, that's funny! Thanx a lot for the piece of info.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I am using MIME to send an HTML file and associated JPG file to a clients who are using Outlook Express. I am using an associated ID to refer to the image inside the HTML file. I'm also using
http-equiv=3DContent-Type.
I am experiencing two problems. One client, running Windows 98, can see the image, but no table-related text, the other clients running 2000 can see both text and image. Neither, however, can print the image directly from Outlook. Only the much hated square with the IMG alt tag and red cross.
Has any one else experienced this problem? And more importantly does anyone have any idea how to fix it?
|
|
|
|
|
hello,
how do i check if i am connected to the internet ? so far i've found 2
ways to do that.
- InternetAttemptConnection
but this works only for modem conncections
- InternetCheckConnection
works for nearly all types of connections, but not always
is there any 100% version (proxy, firewall .... )
Thanks
here is my solution:
// worker thread
BOOL WINAPI IsConnected()
{
do {
#ifdef ADSL
g_IsConnected=InternetCheckConnection ("http://www.google.com",
FLAG_ICC_FORCE_CONNECTION ,0);
#elseif
if(InternetAttemptConnect(0) == ERROR_SUCCESS) g_IsConnected = true;
else g_IsConnected = false;
#endif
Sleep(2500);
} while(1);
}
|
|
|
|
|
when does InternetCheckConnection not work?
I'm interested because I'm using it now and I havn't found any problems... but then again I haven't released my software yet.
Asim Hussain
e: asim@jawache.net
w: www.jawache.net
|
|
|
|