|
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
|
|
|
|
|
|
|
Hello,
I've started moving a MFC MDI application from VS2005 to VS2010 (used the samples Visual C++ 2008 Feature Pack as source) and got some problems with the menu now using CMFCMenuBar.
Normally all the menu items are customizable by the user, but I want to protect the main menu items File, Edit, View, Help, ... from user customizing and only allow the user to add his own main menu(s) to the menu bar.
I thought using CMFCToolBarButton::SetProtectedCommands but that doesn't help for the main items, for the sub menu items this works.
I found also out that I could add the 0 with the call lstProtectedCmds.AddTail( (UINT)0 ); to the protected commends but this prevents the menu bar completely from customizing and the user isn't able to add his own menu to the bar any more.
Any help or ideas are welcome.
Thanks,
Andreas.
|
|
|
|
|
Hi All,
How to reyurn char* in c++? My code is
extern "C" char* callFunction()
{
std::string stroutput = pObject->ProcessNumber("hi","hi");
char* strout = new char [stroutput.size()+1];
strcpy (strout, stroutput.c_str());
return strout;
delete[] strout;
}
Thanks in advance...
G.Paulraj
|
|
|
|
|
What you've done is almost correct.
2 things are not right.
First, you cannot use extern "C" if you're using std::string because string is an object of the basic_string class.
class is not understood by C.
Second, you cannot delete the memory inside the function.
Deletion has to be done by the caller.
Also there is no point in having any statements after the return statement.
|
|
|
|
|
«_Superman_» wrote: First, you cannot use extern "C" if you're using std::string
The extern "C" merely prevents name decoration of exported function or variable names, it has nothing to do with the underlying C++ code, which may use any classes internally.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
You're right. My mistake.
|
|
|
|