|
good morning
i'm using VC++ in visual studio 2010
in my code i made a dialog with edit controls and an associated ON_EN_CHANGE function
i noticed this function (the OnChangeXXX associated with ON_EN_CHANGE handler) is called before dialog is visualized and the following error "Debug Assertion Failed!" appares
i can avoid it using only using a flag cleared at initialization and setted at the end of OnInitDialog, checked at the begin of my OnChangeXXX funcions, like this
if (!m_xIsUsable) return;
to ignore the function if dialog is not yet displayed
is this the only way to avoid the problem?
thanks in advance and regards
|
|
|
|
|
Does any of your edit fields have a spin button with UDS_AUTOBUDDY/UDS_SETBUDDYINT style attached to it? I ran into a similar problem a few days ago and -at least i think- the edit change is triggered by the spin control when it attaches itself to the edit and sets its content and since this happens at creation time you get the message before your DoDataExchange has ran. I avoided this by simply checking the m_hWnd member of the CEdit to see if it has been attached to the dialog's control or not. Could this be your problem also?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
hi Code-o-mat
you are right. i use a spin button associated
so i understand why not all my edit controls suffer about this problem. it could be nice to understand why there is not a latch in message dispatcher to block these kind of messages before window displaying is not complete
thank you very much for your suggestion
|
|
|
|
|
I supose they either didn't think of this case OR since it is relatively easy to overcome, they didn't bother... anyways, yourwelcome.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
Hi
I have an application Exe that call a COM dll.
I have to Load an other Win32 dll(named "Win32_dll" from this COM dll.
LoadLibrary(Win32_dll) fail always.
HINSTANCE hLib = ::LoadLibrary(_T(_DLL_NAME_));
always hLib = NULL;
- I put this dll in the same directory of COM dll BUT always fail.
- I put it in the directory of EXE and it success.
So problem is how to Load the Win32 dll from the COM dll attached to an other Exe application ?
|
|
|
|
|
If the library is not in one of the standard places that Windows checks, then your LoadLibrary() call needs to provide the full path.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
What does the GetLastError tell you? My guess would be something in the line of: file not found.
Easy test would be to place the win32_dll.dll in your debug dir. That way it should be able to find it.
Even a better way is to provide the full path to the dll and if you want to avoid any possible isse with that; make sure the path does not contain spaces.
Cheers, AT
Cogito ergo sum
|
|
|
|
|
hi all,
i am having a std:: map iterator like this
std::map<CString, std::map<DWORD, CString> > m_mpIter;
here i want to find a CString value can anybody help me to do this.
thanks.
|
|
|
|
|
The iterator must be defines as - std::map<CString, std::map<DWORD, CString> >::iterator m_mpIter;
You can then access the key using m_mpIter->first .
To access the value you do m_mpIter->Second .
Since the value is another map, you will need to iterate through that map too.
Here is a nested loop that can iterate through the entire collection -
for (auto i = map1.begin(); i != map1.end(); ++i)
{
i->first;
for (auto j = i->second.begin(); j != i->second.end(); ++j)
{
j->first;
j->second;
}
} I have assumed the map to be named as map1 .
Also, since I'm using the auto keyword, this will compile only in VS2010 or later versions.
If you're using older versions of Visual Studio you will need to replace the auto keyword with the following -
std::map<CString, std::map<DWORD, CString> >::iterator i;
std::map<DWORD, CString>::iterator j;
|
|
|
|
|
i am already use the for loop to chek all value of iteration.
is there no any method to find dirctly the value in iterator without using for loop to chk all value,
thanks.
|
|
|
|
|
Sure.
You can do something like (i + 2)->first; or (i + 2)->second; .
|
|
|
|
|
i dont understand can u please more specific.
or please provide me any example.
|
|
|
|
|
Not sure what you're asking here; if you know the 'real' key (CString- DWORD) you could use a find on the outer map and another on the second of the returned iterator...
Hoe this helps, AT
Cogito ergo sum
|
|
|
|
|
I have a problem with convertion between string and double as following:
double dValue = 1000;
std::ostrstream oStrStream;
oStrStream << dValue << std::ends;
std::string strValue = oStrStream.str();
//here strValue is "1,000", a comma is added!
//when I use following code to convert, error occurred.
double dValue = strtod( strValue .c_str(), NULL );
//here dValue is "1", it seems "," can't be recognized!
How to avoid this? Is there any way to avoid adding comma when convert double to string?
|
|
|
|
|
ostrstream is not supported anymore.
Try using ostringstream ;
|
|
|
|
|
I got the same result. The problem was not solved yet.
|
|
|
|
|
The problem is due to ',' in '1,000'. Remove ',' and it would work.
|
|
|
|
|
You need to parse the string to remove non-numeric characters before trying to convert it. The string is only allowed to follow a specific pattern, as described here[^].
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
I could be wrong here, didn't verify yet, but using the setlocale to LC_NUMERIC for US English shoul make it recognize the thousand seperator as well.
Always consider that there are languages (mine included) that use a different decimal seperator.
Cheers, AT
Cogito ergo sum
|
|
|
|
|
If you look at the link I provided you can see which characters may be accepted.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Hi All,
I have to retreive the full path of the COM Dll (named "MyDllCom") from an other Exe.
How do this ?
|
|
|
|
|
If you know the CLSID of the component, you can get the DLL path from the value of the registry key HKEY_CLASSES_ROOT\CLSID\<CLSID of COM>\InprocServer32\(Default) .
|
|
|
|
|
Back on form I see!
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
|