|
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.
|
|
|
|
|
I am trying to bundle a coherent set of classes (one class per .h/.cpp pair) into a module to be distributed to my clients. So far when I link the classes to my test application using Visual Studio 2015, no problem. But when I configure project with the classes as input to generate a NET module, I get a warning about the manifest file not properly included in the generated module (warning starting with the keyword METAGEN), and when I want to link it to my test application, the linker cannot find the class methods. Sofar I checked the obvious settings such as OptimizeReferences, which would leave my module virtually empty (as I observe it).
It seems to me that working demo solution with two project would get met going, where the first project packages the clases, let's say three classes with only one method and the obvious constructor, get combined in a module, and a second project that uses the module to get access to classes and their methods.
Thanks in advance.
|
|
|
|
|
Good afternoon,
I want to make a simple VC++ software with
MFC Visual Studio 2017 classes permitting
to draw one or several lines in a Single Document
interface. How can I process?
Thank you very much for your help.
All my best regards,
|
|
|
|
|
|
Hi Richard,
Thank you for your help which is welcome.
Best regards,
|
|
|
|
|
Hello Richard,
The link you submit me to follow is very interesting
but a little hard to understand.
Otherwise, thank you very much for your help.
Best regards,
|
|
|
|
|
Member 14494772 wrote: a little hard to understand. Yes, I am afraid that is a common complaint with MFC.
|
|
|
|
|
i have been trying to create setup file through setup and deployment template in vs2010. so now i have successfully added all files,folders,shortcuts and dlls etc.. but i have strucked at adding prerequisites to my setup application.i researched and found many articles but those all are telling to add prerequisites from the same computer,yes i followed and done it successfully, but when i try to install that setup in another computer(which is not installed vs2010 and .Net framework in it) its tending for .Net framework and redistribute components. the client computer installed with win7 32 or 64 bit OS (which will have no internet and not installed vs2010 as well). i just want to distribite my setup file which included prerequisites and redistributable components so that client simply install it and run the application.by the way i am using vs2010 ultimate to build the setup in win7. so is it possible to do that? i have been trying to do it from past three days but i couldn't, so finally i came here. please help me to solve this issue.thanks in advance.
|
|
|
|
|
|
thanks for the reply but i think its not an issue about version of the .Net framework. my project using .Net 4.0 and i selected the same in the prerequisite dialog box, (FYU) i selected the third option like "download prerequisite from the following location" but after giving successful path and built the setup. when i install the setup in another computer its searching for .net framework from the web.this is what i can't understand. please suggest any link with detailed procedure (i am trying with MFC application).thank you
|
|
|
|
|
If they don't have access to the internet, then you have to provide the whole .NET framework as part of your installation: it is large and not normally included as it is downloaded as needed when the installer finds the right version isn't installed. Win 7 ships with .NET Framework 3.5.1 so any fresh(ish) installation that you try to add your .NET 4.0 app to will need to install a more recent framework before it gets anywhere else.
No internet? You need to supply it.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
thanks for spending your time for me.
we couldn't able to provide the internet there at workplace. now adding the prerequisites is raising this issue ain't i giving the exact path?
C:\Program Files\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages\DotNetFX40
C:\Program Files\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages\vcredist_x86
C:\Program Files\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages\WindowsInstaller3_1
these are the paths i have tried till now from where to add the prerequisites to my setup,but i think those are not good choice and i tried to install my setup in winXP machine till now, may it cause this?
|
|
|
|
|
You can't just install the DLL's for .NET V4.0, you have to install the whole framework properly. That means following the link I gave you, and including that as a part of your installation. That's because you don't have the internet, which MS usually use to ensure the right version of .NET is installed prior to the main installer starting.
Gawd knows if the V40 framework will work on XP at all: I don't! A quick check with MS says it will, if XP is at SP3 - which if it's not on the internet, it very probably isn't ...
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|