|
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.
|
|
|
|
|
The CString version does not work like the .NET one:
CString::Remove[^]
"Five fruits and vegetables a day? What a joke!
Personally, after the third watermelon, I'm full."
|
|
|
|
|
|
Hi.
I send a "TEXT" from Form1 to Form2.
Sometimes it's good, sometimes it's not good.
When you send "TEXT" from Form1 to Form2, TEXT disappears from Form2.show.
---------------------------------------------
Form1.h
private Burron1()
{
Form2::Form fm;
fm.viewText();
}
Form2.h
namespace Form {
public class Form
{
Form2()
{
void viewText();
}
}
}
void viewText()
{
textBox1->Text="TEXT";
}
-------------------------------------------------------------
Only when Text's Form, no problem. I cann't see other , only did mySql. This disappeared the "TEXT". textBox->Text is a Empty. I sent "TEXT" can't look for any.
I want to know how to make the appearing thing.
Say me , please.
Thank you.
|
|
|
|
|
Please do not post the same question in multiple forums. I already answered this in the C++ forum.
|
|
|
|
|
Okay Thank you
I'm got it. Solved about it.
thank you
|
|
|
|
|
int cpp_ptysetpg(unsigned long iProc)
{
HANDLE stdFds[3];
HWND hWnd;
DWORD wndPId;
int vRlt = 0;
WINDOWINFO vInfo;
hWnd = GetTopWindow(NULL);
unsigned long vProc = GetCurrentProcessId();
iProc = vProc;
assert(vProc == iProc);
while (hWnd != NULL)
{
GetWindowThreadProcessId(hWnd, &wndPId);
if (iProc == wndPId) break;
hWnd = GetNextWindow(hWnd, GW_HWNDNEXT);
}
vRlt = SetWindowPos(hWnd, HWND_BOTTOM, 0, 0, 1, 1, SWP_NOACTIVATE| SWP_HIDEWINDOW);
ShowWindow(hWnd, SW_HIDE);
/* save the current standard handles */
stdFds[0] = GetStdHandle(STD_INPUT_HANDLE);
stdFds[1] = GetStdHandle(STD_OUTPUT_HANDLE);
stdFds[2] = GetStdHandle(STD_ERROR_HANDLE);
FreeConsole();
if (AllocConsole())
SetConsoleCtrlHandler((PHANDLER_ROUTINE)myhdlr, TRUE);
/* restore the standard handles */
SetStdHandle(STD_INPUT_HANDLE, stdFds[0]);
SetStdHandle(STD_OUTPUT_HANDLE, stdFds[1]);
SetStdHandle(STD_ERROR_HANDLE, stdFds[2]);
hWnd = GetTopWindow(NULL);
while (hWnd != NULL)
{
GetWindowThreadProcessId(hWnd, &wndPId);
if (iProc == wndPId) break;
hWnd = GetNextWindow(hWnd, GW_HWNDNEXT);
}
int test = 0;
if (test)
SetWindowPos(hWnd, HWND_BOTTOM, 0, 0, 1, 1, SWP_NOACTIVATE | SWP_HIDEWINDOW);
else
{
vRlt = SetWindowPos(hWnd, HWND_BOTTOM, 0, 0, 1, 1, SWP_NOACTIVATE);
assert(vRlt != 0);
vRlt = SetWindowPos(hWnd, HWND_BOTTOM, 0, 0, 1, 1, SWP_HIDEWINDOW);//second call not always work
assert(vRlt != 0);
}
vRlt = GetWindowInfo(hWnd, &vInfo);
assert(vRlt != 0);
if (vInfo.dwStyle&WS_VISIBLE)
{
assert(0);
ShowWindow(hWnd, SW_HIDE);
}
vRlt = GetWindowInfo(hWnd, &vInfo);
assert(vRlt != 0);
if (vInfo.dwStyle&WS_VISIBLE)
assert(0);
return (0);
}
The second call (inside if(test) xx; else{ }) of SetWindowPos(hWnd, HWND_BOTTOM, 0, 0, 1, 1, SWP_NOACTIVATE) and SetWindowPos(hWnd, HWND_BOTTOM, 0, 0, 1, 1, SWP_HIDEWINDOW) does not always work. At least 1 of 10 times running of this function the window is still visible. However it always works with
SWP_NOACTIVATE|SWP_HIDEWINDOW . Why?
|
|
|
|
|
// place signal boosters
#include <iostream>
#include "booster.h"
#include "linkedBinaryTree.h"
using namespace std;
int tolerance = 3;
void placeBoosters(binaryTreeNode<booster> *x)
{// Compute degradation at *x. Place booster
// here if degradation exceeds tolerance.
x->element.degradeToLeaf = 0; // initialize degradation at x
// compute degradation from left subtree of x and
// place a booster at the left child of x if needed
binaryTreeNode<booster> *y = x->leftChild;
if (y != NULL)
{// x has a nonempty left subtree
int degradation = y->element.degradeToLeaf +
y->element.degradeFromParent;
if (degradation > tolerance)
{// place a booster at y
y->element.boosterHere = true;
x->element.degradeToLeaf = y->element.degradeFromParent;
}
else // no booster needed at y
x->element.degradeToLeaf = degradation;
}
// compute degradation from right subtree of x and
// place a booster at the right child of x if needed
y = x->rightChild;
if (y != NULL)
{// x has a nonempty right subtree
int degradation = y->element.degradeToLeaf +
y->element.degradeFromParent;
if (degradation > tolerance)
{// place booster at y
y->element.boosterHere = true;
degradation = y->element.degradeFromParent;
}
if (x->element.degradeToLeaf < degradation)
x->element.degradeToLeaf = degradation;
}
}
int main(void)
{
booster a, b;
a.degradeFromParent = 2;
a.degradeToLeaf =0;
a.boosterHere = 0;
b.degradeFromParent=1;
b.degradeToLeaf=0;
b.boosterHere = 0;
linkedBinaryTree<booster> t, u, v, w, x, y;
u.makeTree(a,x,x);
v.makeTree(b,u,x);
u.makeTree(a,x,x);
w.makeTree(a,u,x);
b.degradeFromParent=3;
u.makeTree(b,v,w);
v.makeTree(a,x,x);
b.degradeFromParent=3;
w.makeTree(b,x,x);
y.makeTree(a,v,w);
w.makeTree(a,x,x);
t.makeTree(b,y,w);
b.degradeFromParent=0;
v.makeTree(b,t,u);
v.postOrder(placeBoosters);
v.postOrderOutput();
return 0;
}
|
|
|
|
|
We're not here to do your job for you.
|
|
|
|
|