|
can you tell me what is the purpose of this operation ?
maybe wecan find a way around it...
why do you need to get the color of an in-active window ?
|
|
|
|
|
I created a program using vc to display the Records in the
console.Now I wanted to display the records in windows.
I am using only Win32Api,not MFC's CRecordset...
Will anyone say how to include the flexgrid control in my
Program by using only Win32 API(plz write 1 or 2 lines
of sample code)
|
|
|
|
|
Hi,
I've banged my forehead against this problem for several hours now and I cant' for the life of me figure out why this doesn't work.
All I'm trying to do is use a std::map as a dictionary, like: map<string,string>
Here's the very simple code that just won't work:
#include <map>
using namespace std;
int main(int argc, char* argv[]) {
map<string, string> m;
m["a"] = "b";
return 0;
}
I'm getting these error messages:
c:\Program\Microsoft Visual Studio .NET\Vc7\include\functional(139): error C2784: 'bool std::operator <(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'const std::string'
c:\Program\Microsoft Visual Studio .NET\Vc7\include\functional(139): error C2676: binary '<' : 'const std::string' does not define this operator or a conversion to a type acceptable to the predefined operator
c:\Program\Microsoft Visual Studio .NET\Vc7\include\functional(139): error C2784: 'bool std::operator <(const std::_Ptrit<_Ty,_Diff,_Pointer2,_Reference2,_Pointer2,_Reference2> &,const std::_Ptrit<_Ty,_Diff,_Pointer,_Reference,_Pointer2,_Reference2> &)' : could not deduce template argument for 'const std::_Ptrit<_Ty,_Diff,_Pointer2,_Reference2,_Pointer2,_Reference2> &' from 'const std::string'
c:\Program\Microsoft Visual Studio .NET\Vc7\include\functional(139): error C2784: 'bool std::operator <(const std::_Ptrit<_Ty,_Diff,_Pointer2,_Reference2,_Pointer2,_Reference2> &,const std::_Ptrit<_Ty,_Diff,_Pointer,_Reference,_Pointer2,_Reference2> &)' : could not deduce template argument for 'const std::_Ptrit<_Ty,_Diff,_Pointer2,_Reference2,_Pointer2,_Reference2> &' from 'const std::string'
c:\Program\Microsoft Visual Studio .NET\Vc7\include\functional(139): error C2784: 'bool std::operator <(const std::_Ptrit<_Ty,_Diff,_Pointer2,_Reference2,_Pointer2,_Reference2> &,const std::_Ptrit<_Ty,_Diff,_Pointer,_Reference,_Pointer2,_Reference2> &)' : could not deduce template argument for 'const std::_Ptrit<_Ty,_Diff,_Pointer2,_Reference2,_Pointer2,_Reference2> &' from 'const std::string'
c:\Program\Microsoft Visual Studio .NET\Vc7\include\functional(139): error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)' : could not deduce template argument for 'const std::_Tree<_Traits> &' from 'const std::string'
c:\Program\Microsoft Visual Studio .NET\Vc7\include\functional(139): error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)' : could not deduce template argument for 'const std::_Tree<_Traits> &' from 'const std::string'
c:\Program\Microsoft Visual Studio .NET\Vc7\include\functional(139): error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)' : could not deduce template argument for 'const std::_Tree<_Traits> &' from 'const std::string'
c:\Program\Microsoft Visual Studio .NET\Vc7\include\functional(139): error C2784: 'bool std::operator <(const std::pair<_Ty1,_Ty2> &,const std::pair<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std::pair<_Ty1,_Ty2> &' from 'const std::string'
c:\Program\Microsoft Visual Studio .NET\Vc7\include\functional(139): error C2784: 'bool std::operator <(const std::pair<_Ty1,_Ty2> &,const std::pair<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std::pair<_Ty1,_Ty2> &' from 'const std::string'
c:\Program\Microsoft Visual Studio .NET\Vc7\include\functional(139): error C2784: 'bool std::operator <(const std::pair<_Ty1,_Ty2> &,const std::pair<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std::pair<_Ty1,_Ty2> &' from 'const std::string'
c:\Program\Microsoft Visual Studio .NET\Vc7\include\functional(139): error C2784: 'bool std::operator <(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'const std::string'
c:\Program\Microsoft Visual Studio .NET\Vc7\include\functional(139): error C2784: 'bool std::operator <(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'const std::string'
If I change the key to int, like this:
map<int,string> m;
there's no problem doing this:
m[6] = "ashahshd";
But the map<string,string> just won't work.
Please help me, I'm getting desperate!
thanks
Ludde
|
|
|
|
|
luddet wrote:
c:\Program\Microsoft Visual Studio .NET\Vc7\include\functional(139): error C2676: binary '<' : 'const std::string' does not define this operator or a conversion to a type acceptable to the predefined operator
This is the key part. There's no operator< defined for std::string . You can either define an operator for it yourself, or (better for strings) use a hash_map instead of a map (in this case you may have to define a hash function for std::string ).
- Mike
|
|
|
|
|
Hi,
Are you absolutely sure that there is no operator
|
|
|
|
|
Oops, yeah, I missed that. No more trying to answer questions when I'm dead tired
- Mike
|
|
|
|
|
And I missed to include <string>. No more trying to program when I'm dead tired
/Ludde
|
|
|
|
|
I'm not near a compiler at the moment (sigh, Its Saturday here in Aus and Im in the computer-room), but I think you have to declare the map elements ...
try :-
// Declare A Map Of string->string
map<string, const string> m;
(The 'const' may/may not be required).... I've never had much luck doing an insert like you've tried - I always use 'make_pair' (usually becuase I have an object pointer on the right hand side) as in :-
m.insert ( make_pair ( "Tom", "Jerry" ) );
'G'
|
|
|
|
|
Hmmm...
I've tried the make_pair too, and it doesn't work either
thanks
Ludde
|
|
|
|
|
If you make the mapped_type const, then the map is rather unusable. Nor should you make the key_type const either, since std::map will make the key const where appropriate.
--
If there was a problem, Yo, I'll solve it!
Check out the hook while my DJ revolves it.
|
|
|
|
|
yeah, I was having a brain-fart at the time I wrote that ... it was so bloody cold in the computer room I was surprised I could type at all !!
Jörgen Sigvardsson wrote:
Nor should you make the key_type const either, since std::map will make the key const where appropriate.
hmmm - but wouldnt you keep it const ?? - I thought it would be appropriate all the time ... I always thought of the key being const
map<string, string> m;
m["Fred"] = "Nurk";
I can understand changing "Nurk" to "Scumbag".. Im not sure on the implications of changing the "Fred" Key ..
I must still be in "mode=dense"
'G'
|
|
|
|
|
Garth J Lancaster wrote:
hmmm - but wouldnt you keep it const ?? - I thought it would be appropriate all the time ... I always thought of the key being const
Yes, but std::map does that for you. If you look at all interface points of the map container, it'll make sure no keys are mutated. Check out map::value_type and you'll see.
--
I am perpetual, I keep the country clean.
|
|
|
|
|
You need to #include <string> for the compiler to know the contents of the string class.
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | 1ClickPicGrabber New v2.0! | RightClick-Encrypt
There is a saying in statistics that a million monkeys pounding on typewriters would eventually create a work of Shakespeare. Thanks to the Internet, we now know that this is not true.
|
|
|
|
|
nice one Mike - I missed the bleeding obvious !
sigh .. wish this server would hurry up so I can get outta here - it s f_ing freezing !!
'G'
|
|
|
|
|
hmmm...
this is most humiliating...
so simple
I could have sworn I had included it!
dang!
*bangs his head against the wall*
Thank you very much!!
regards
/Ludde
|
|
|
|
|
Hi,
I saw a long list of answers to this query and one from micheal dunn, when i read the question i knew and was obvious that you have missed to include the string, and for some reason before reading all the answers i knew the rite one will come from Mike, and so it was
I Touched Osama Bin Ladens Bushy Beard
|
|
|
|
|
But how could he create a std::map<int, std::string> ..?
--
If there was a problem, Yo, I'll solve it!
Check out the hook while my DJ revolves it.
|
|
|
|
|
i have packaged an VC++ created EXE and created a shortcut for it using InstallShield . Now when i launch the shortcut from the start menu , the application comes up but gives a message saying it cannot find an INI file which is located in the same folder as the EXE .
Now if i run the EXE directly from the folder it works fine .
In my code the reference to the INI file is a "./MyInIFile.ini !
How do i resolve this ?
|
|
|
|
|
Set the "Start in" property of the shortcut.
Or:
Save a INSTALLDIR key to the registry and load the ini relative to that instead of current dir.
(I would prefer method 2, it's not as sensitive to "users" as method 1)
And if the paths that I have followed/have tread against the flow/there is no need for sorrow
I am coming home
Return, Crüxshadows
|
|
|
|
|
I try to register a categoty using ATL/COM
After registering the registry looks pretty OK.
OleView diaplays the categoty
In Left Tree Pane: Grouped by Ccategory (child tree list)
I cannot se muy category, but in detailed right pane list-view
I can see my category beeing there.
The bad thing is when I enumerate the category info
I cannot find it.
All COM calls returrn S_OK;
// here Is the registration code
--------------------------------------------------
USES_CONVERSION;
CComPtr<icatregister> catInfo;
HRESULT hr = catInfo.CoCreateInstance(CLSID_StdComponentCategoriesMgr);
if(FAILED(hr))return hr;
// ensure the category registration
CATEGORYINFO catinfo;
catinfo.catid = MY_CATID;
catinfo.lcid = 0x0409 ;
::wcscpy(catinfo.szDescription, T2W (catDescription));
catInfo->RegisterCategories(1, &catinfo);
CComPtr<icatregister> catInfo;
HRESULT hr = catInfo.CoCreateInstance(CLSID_StdComponentCategoriesMgr);
if(FAILED(hr))return hr;
CATID catid = catidIn;
catInfo->RegisterClassImplCategories(CLSID_MyDLL,1,&catid);
// here is the enumaration code
--------------------------------------------------
CComPtr<icatinformation> ci;
HRESULT hr = ci.CoCreateInstance(CLSID_StdComponentCategoriesMgr);
if(FAILED(hr)) return;
CComPtr<ienumcategoryinfo> spEci;
if(SUCCEEDED(ci->EnumCategories(GetUserDefaultLCID(), &spEci)))
{
ULONG nRet = 0;
CATEGORYINFO cif;
while(SUCCEEDED(spEci->Next(1,&cif,&nRet)) && nRet==1)
{
if (cif.catid == NY_CATID)
{
TRACE("found \r\n");
}
}
}
|
|
|
|
|
I think in if comparision you have used NY_CATID. Previously it is MY_CATID. So verify it once.
|
|
|
|
|
Hi guys,
I want to use the function lies in a DLL created using VB having a signature
EncodeThis(ByVal sIn As String,ByVal sKey As String,ByRef sOut As String,ByRef oLen as Long)
in a VC++ i m trying to call the DLL using LoadLibrary() Function and try to use the function as
// Variable Declaration........
LPCSTR data;
LPCSTR key;
LPCSTR result;
LONG len;
.............
Loading DLL
.............
Get pointer to function "EncodeThis" say ptr
................
ptr(data,key,&result,&len);
Then,........i will be getting an Error as "The value of ESP was not ptoperly saved which is the result of calling a function declared with one calling convention with function pointer declared with a different calling convention".
I know there will be some mistake in Function signature, but doesn't figure it out, so.........if anybody plz help me then i will be very thankful to him.
chirag
chirag.
|
|
|
|
|
Last time I checked, VB was using the PASCAL calling convention.
You just need to tell VC about it
And if the paths that I have followed/have tread against the flow/there is no need for sorrow
I am coming home
Return, Crüxshadows
|
|
|
|
|
Thanks for the reply.
But as i m new to VC++, so just let me know how to tell the VC about thet VB using PASCAL convention.
and plz...review the problem again, and i think that there will be signature problem.
Anyway..i m just frustrated with this problem and want to solve this problem as early as possible, so if possible reply with VC++ code snippet.
Again thnks.
|
|
|
|
|
Hi All,
I am getting this weird problem for the past 4 days. Anyone seen this before?
I am trying to monitor mouse events on a specific application (Windows XP calculator calc.exe). I have set a hook on the Hwnd pointer of calc using
hook = SetWindowsHookEx(WH_GETMESSAGE,
(HOOKPROC)msghook,
hInst,
GetWindowThreadProcessId(hWnd, NULL));
and then I use the following to detect messages
static LRESULT CALLBACK msghook(UINT nCode, WPARAM wParam, LPARAM lParam)
{
char text[10];
if(nCode < 0)
{ /* pass it on */
CallNextHookEx(hook, nCode, wParam, lParam);
return 0;
} /* pass it on */
LPMSG msg = (LPMSG)lParam;
switch(msg->message)
{
case WM_LBUTTONDOWN:
case WM_NCLBUTTONDOWN:
PostMessage(hWndServer, UWM_LBUTTONDOWN, WM_LBUTTONDOWN, msg->lParam);
break;
case WM_LBUTTONUP:
case WM_NCLBUTTONUP:
PostMessage(hWndServer, UWM_LBUTTONUP, WM_LBUTTONUP, msg->lParam);
break;
case WM_MOUSEMOVE:
case WM_NCMOUSEMOVE:
PostMessage(hWndServer, UWM_MOUSEMOVE, WM_MOUSEMOVE, msg->lParam);
break;
}
return CallNextHookEx(hook, nCode, wParam, lParam);
}
What happens is that WM_LBUTTONDOWN comes in fine but the WM_LBUTTONUP never comes in, instead a mousemove message shows up (EVEN WHEN THE MOUSE IS NOT MOVING). Its very erratic. Sometimes the WM_LBUTTONUP case does execute but very rarely. Am I doing something wrong?
If I use WH_MOUSE or WH_CBT instead of WH_GETMESSAGE, none of the cases gets called. Has anyone had this kind of problem before.
By the way my mouse is not faulty. I tried this code on a number of PCs with the same result.
Thanks in advance.
Regards,
Zahid
|
|
|
|
|