|
When the file gets to certain size I will run another application
|
|
|
|
|
|
Is it possible to grab a certain pixel's color using WM messages?
If so, which WM should I send and what kind of wParam and lParam would I need to send?
Thanks,
~Mike
|
|
|
|
|
you can use GetPixel
COLORREF GetPixel(<br />
HDC hdc,
int nXPos,
int nYPos
);
why do you need SendMessage ?
|
|
|
|
|
Because I need to retrieve pixel colors from an inactive window..
Is it possible?
Thanks
~Mike
|
|
|
|
|
__Cerb wrote:
Is it possible?
not sure...
an inactive window isn't drawn!! .. needs to get the wm_paint to be redrawn..
|
|
|
|
|
What about ::GetDC(HWND hwnd) and ::ScreenToClient(HWND hwnd, LPPOINT lpPoint)
???
is there a way I could use those to get a pixel color?
|
|
|
|
|
Do I need to use ::GetDC, ::GetWindowDC, ::ScreenToClient, ::BitBlt, I really need to figure out how can I retrieve a pixel color from an inactive window.
Thanks a lot, any help greatly appreciated
~Cerb
|
|
|
|
|
if you have the window handle then use GetWindowDC to get the HDC (device context)
then use GetPixel directly...
but the problem is when the window needs repaint.. in this case it amy give you another color,,,
try this first and let us know the results
|
|
|
|
|
Damn, it still won't work.
CString szWndName,szWndClass;<br />
<br />
szWndName = "My window";<br />
szWndClass = "My window's class";<br />
<br />
HWND hwnd = ::FindWindow(szWndName,szWndClass);<br />
<br />
::PostMessage(hwnd,WM_PAINT,0,0);<br />
HDC hDC = ::GetWindowDC(hwnd);<br />
<br />
CString str;<br />
int iPixel;<br />
<br />
iPixel = ::GetPixel(hDC,50,75);<br />
<br />
str.Format("%d",iPixel);<br />
AfxMessageBox(str);
It keeps returning -1, and it should return 263172
Any ideas?
|
|
|
|
|
|
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'
|
|
|
|
|