473,790 Members | 2,421 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem with add old string to new string in edit box (MFC)

Tio

my code:
if (new data )
{

CString* pStr = (CString*)wPara m; //data come with some
com port (PostMessage)
CString p2Str; //old string in edit box
m_dataa.GetWind owText(p2Str);

*pStr= p2Str+*pStr; // add old string to new string

m_dataa.SetWind owText(*pStr); // send new string to edit box
delete pStr;

}

in first step I have in edit box "12345"
then come new data "6789"
so it should be after adding two string "12345 6789" in edit box but
is "12345 89"
why I lost two signs?

Jun 14 '06 #1
2 2814
Tio wrote:
my code:
if (new data )
{

CString* pStr = (CString*)wPara m; //data come with some
com port (PostMessage)
CString p2Str; //old string in edit box
m_dataa.GetWind owText(p2Str);

*pStr= p2Str+*pStr; // add old string to new string

m_dataa.SetWind owText(*pStr); // send new string to edit box
delete pStr;

}

in first step I have in edit box "12345"
then come new data "6789"
so it should be after adding two string "12345 6789" in edit box but
is "12345 89"
why I lost two signs?


First of all, nothing in your code suggests you're adding a space between
your strings. Perhaps the operator+ for 'CString' does that, I don't know
since CString is not a standard class. Perhaps you're not telling us all
like it is in reality (like 'p2Str' actually contains a space after "5" or
that new data has a space in front of it).

Second, whatever you do that causes this malfunction, is most likely not
in this code, but rather outside, in the code you didn't post.

Third, your program's functionality depends on MFC (apparently), and this
is not the right place to discuss MFC issues. Try
'microsoft.publ ic.vc.mfc'.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jun 14 '06 #2
Off topic (MFC specific CString class) and multi-posted.
Jun 14 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
2463
by: Susanne | last post by:
Hello! In have embedded python into my MFC application. It works fine using the PyRun_SimpleString method, giving it a string with some simple commands. When i am using PyRun_SimpleFile instead, my application crashes. I have also created a console application. There i also call PyRun_SimpleFile. The console application executes the given script.
7
20941
by: ree | last post by:
I need to use a function from a wininet library, it requires the use of const TCHAR. The problem is the value needs to be calculated, so at the end I have this string but I am having troubles converting it into a const TCHAR so I can use it in the function. TIA
2
12725
by: RP2001 | last post by:
I've serialized in various variables of various types (mainly CString, int, double) into an instantiated MFC CArchive class and saved it as a binary file. I am able to open the binary file and read out the individual variables fine with an MFC application. However I cannot read the binary file correctly with a C#.NET application, where I'm using the BinaryReader Class. Doing some debugging I noticed that the problem occured at this C#...
4
2182
by: | last post by:
I am stuck in a situation and I do believe that this should work, but it doesn't. I have a unmanaged dll, that uses MFC. This works great. Now I recompile the unmanaged dll so it contains mixed mode managed/unmanaged code, but only use unmanaged code, but this gives a error the moment I want to display a MFC dialog box: Something like unreferenced object,... during runtime.
2
4554
by: Aled Hughes | last post by:
Hi, I have an MFC application that has a CDialog based dialog box that contains a .net UserControl (via DDX_ManagedControl) as well as a native edit control which has the ES_NUMBER style set. Now a very strange thing happens: If I press a non-numeric key in the native edit control, up pops a little balloon tip saying "Unacceptable Character", however when I press the key again, the tooltip disappears, reappears and in the process blanks...
1
2372
by: rag84dec | last post by:
Hi, I am trying to write an MFC code which has the Dialog which has a menu option Edit which has an option "Copy File content"... Now i want to get the text entered in the Edit box.What function can be used? CEdit *edit1=(CEdit*)GetDlgItem(IDC_EDIT2); CString str=edit1->GetLine(); PLease help
1
2529
by: IdleBrain | last post by:
Hi, I need a way to update an Edit control control in MFC from a timer callback function. How can that be done as we cannot reference dialog box controls from callbacks? Even the following code gives me problems: VOID CALLBACK TimerProc ( HWND hParent, UINT uMsg, UINT uEventID, DWORD dwTimer )
0
1976
by: Filemaxor | last post by:
I have gotten my code to be able to allow people to add new text to a .txt document and able to call up files so the user can see whats in it. The problem i'm having is getting the for loop to work correctly so that i can allow certain indexes to be removed without completely deleting everything else. This is what i have so far. Code is below It's in the e part of the code and I have //remed the location of the for loop containg the...
6
2269
by: Tony Johansson | last post by:
Hello! We have a C#.ASP.NET application that runs on a IIS 6. The application contains actually several asp pages but there is no GUI. The application receive an xml file that is processed. There is also an MFC dll that is called from this asp application to make a syntax check on quite many commands. You don't have to know what a command is. The problem that we get is the following when the asp pages calls the MFC
0
9512
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10413
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9021
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7530
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4094
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3707
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.