|
Hi there, I am having the big problem with getting the area of hwind with
routine GetWindowRect. Even Spy++ or his implementation returns rectangle, that is smaller than real
area. Its a some special kind of application, I am looking for some alternative to GetWindowRect,
or how can I get all the window area programmatically correct.
|
|
|
|
|
The GetWindowRect function returns the correct size of any window. If your code is not working then you need to provide more details.
|
|
|
|
|
Its casino application, I am using GetWindowRect standard way.
|
|
|
|
|
Sorry, but that tells us nothing.
|
|
|
|
|
Could you show your code?
|
|
|
|
|
HWND hwnd = FindWindow("HwndWrapper[PokerClient.exe;;518cf654-e6cb-47c5-9916-be16cbf1e961]", NULL);
GetWindowRect(hwnd, &wr);
AdjustWindowRect(&wr, WS_BORDER, true);
As I said its weird behaviour of GetWindowRect
Edited code, it was from the last operation when I was trying
get also parent window.
modified 30-Mar-20 7:59am.
|
|
|
|
|
lacir wrote:
HWND hwnd = FindWindow("HwndWrapper[PokerClient.exe;;518cf654-e6cb-47c5-9916-be16cbf1e961]", NULL);
GetWindowRect(parrent, &wr);
AdjustWindowRect(&wr, WS_BORDER, true);
You call FindWindow but then ignore the value it returns.
Then you are using some other value parrent as a windows handle to obtain the window rectangle for.
Is it what you want?
|
|
|
|
|
This line:
GetWindowRect(parrent, &wr);
Should (probably!) either be:
GetWindowRect(hwnd, &wr);
Or:
GetWindowRect(GetParent(hwnd), &wr);
|
|
|
|
|
I don't know...
The OP seems to disappear...
|
|
|
|
|
You are calling AdjustWindowRect with the Window's dimensions. But the first parameter to AdjustWindowRect is supposed to be the dimensions of the client area of the Window.
|
|
|
|
|
i have the Following vb.net 2008 routine i am trying to get c++ to have the same functionality having alot of issues with c++ conversion, any help with this would be great...
Public Sub New()
Try
If ORIHoles Is Nothing Then
ReDim ORIHoles(49)
Dim ff As Integer = FreeFile()
Dim tempstr As String
Dim atempstr() As String
FileOpen(ff, "postable.csv", OpenMode.Input, OpenAccess.Read, OpenShare.Shared)
Do While Not EOF(ff)
tempstr = LineInput(ff)
atempstr = tempstr.Split(",")
If atempstr.GetUpperBound(0) = 2 Then
ORIHoles(CInt(atempstr(0))).Angle = CDbl(atempstr(1))
ORIHoles(CInt(atempstr(0))).Hypot = CDbl(atempstr(2))
End If
Loop
FileClose(ff)
End If
Catch ex As Exception
GeneralErrorHandler(ex.ToString)
End Try
End Sub
|
|
|
|
|
ccodebase wrote: having alot of issues with c++ conversion Unless you tell us what thos issues are we cannot help you correct them. And please post your questions once only.
|
|
|
|
|
ok well, the issue is i need exact functionality in C++ with a class or function that performs as the vb.net code does, i do have this that i am hard coding all the Values into,
CSV Structure is
01,-0.12343,1.34532
02,-0.62343,1.74532
03,-0.22343,1.34532
04,-0.62343,1.74532
using namespace std;
int main()
{
map<int, int> mp;
mp.insert({ -0.12343, 1.34532});
mp.insert({ 0.22343, 1.74532});
mp.insert({ -0.12343, 1.34532});
mp.insert({ -0.12343, 1.34532});
auto it = mp.upper_bound(11);
cout << "The upper bound of key 11 is ";
cout << (*it).first << " " << (*it).second << endl;
it = mp.upper_bound(13);
cout << "The upper bound of key 13 is ";
cout << (*it).first << " " << (*it).second << endl;
it = mp.upper_bound(17);
cout << "The upper bound of key 17 is ";
cout << (*it).first << " " << (*it).second;
return 0;
}
9:23
The upper bound of key 11 is 12 30
The upper bound of key 13 is 14 40
The upper bound of key 17 is 4 0
|
|
|
|
|
Sorry I don't understand. You declare a map<int, int> and then try to store double values into it. And what are 11, 13 and 17 supposed to relate to?
|
|
|
|
|
so would it be
map<double, double>
|
|
|
|
|
If you want to save double values then obviously yes.
|
|
|
|
|
Try this:
map<int, int> mp;
mp.insert({5,7}); mp.insert({7,33});
mp.insert({11,1});
mp.insert({16,5});
auto it = mp.upper_bound(11);
cout << "The upper bound of key 11 is ";
cout << it->first << " " << it->second << endl;
|
|
|
|
|
this is a vision cart reader as the carts are read it has a certain pattern in the grid
so what the initial goal was to provide an equivalent Class or function to the vb.net snippet earlier in the post it reads a CSV file that has 48 Values pertaining to locations on a 7 x 7 Grid 7^2
Org CSV Structure is
01,-0.12343,1.34532
02,-0.62343,1.74532
03,-0.22343,1.34532
04,-0.62343,1.74532
..
through 48
when the camera system see's the holes through the Cart by light it knows what number it is
|
|
|
|
|
Reader: Base 7 o = HOLE
0 1 2 3 4 5 6
* * * * * o *
o * * * * * *
* o * * * * *
* * * * * * 0
* * * * o * *
* * * o * * *
* * o * * * *
5 x 1 =
0 x 7 =
1 x 49 =
6 x 343 =
4 x 2401 =
3 x 16807 =
2 x 117649 =
----------------------------
SUM : (CART-ID)
|
|
|
|
|
i have the Following Code from vb.net 2008 , can anyone assist me in getting this same functionality to c++ any help would be appreciated
Public Sub New()
Try
If ORIHoles Is Nothing Then
ReDim ORIHoles(49)
Dim ff As Integer = FreeFile()
Dim tempstr As String
Dim atempstr() As String
FileOpen(ff, "postable.csv", OpenMode.Input, OpenAccess.Read, OpenShare.Shared)
Do While Not EOF(ff)
tempstr = LineInput(ff)
atempstr = tempstr.Split(",")
If atempstr.GetUpperBound(0) = 2 Then
ORIHoles(CInt(atempstr(0))).Angle = CDbl(atempstr(1))
ORIHoles(CInt(atempstr(0))).Hypot = CDbl(atempstr(2))
End If
Loop
FileClose(ff)
End If
Catch ex As Exception
GeneralErrorHandler(ex.ToString)
End Try
End Sub
|
|
|
|
|
I find that some of the data I bring in has a
character that looks like a space but is not a space.
After much research, I identified the character as
& then #160;
If I put it together, it looks like a space in this message.
How can I remove characters like this?
I tried
CString GetRidOf(CString str)
{
str.Remove(' ');
return str;
}
but the remove function is not correct.
|
|
|
|
|
You could try
str.Remove('\xA0'); A0 is the hexadecimal representation of the decimal value 160. It should represent a non-breaking-space.
"Five fruits and vegetables a day? What a joke!
Personally, after the third watermelon, I'm full."
|
|
|
|
|
That worked. Thank you very much.
|
|
|
|
|
You are welcome.
"Five fruits and vegetables a day? What a joke!
Personally, after the third watermelon, I'm full."
|
|
|
|
|
This method does not modify the value of the current instance. Instead, it returns a new string in which all characters from position startIndex to the end of the original string have been removed.
So, assign the result of the function to a new string and return that, or return the result of the function.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|