|
Incrementing the pNext pointer, merely moves it along the array, by a number of characters (pNext += nlen ) or a single character (pNext++ ). After incrementing it will appear to point to either an empty cell or some garbage. This is fine as long as the next statement fills that cell, by adding a new string or termination character. In my sample I was adding a NULL (L'\0' ) character after each string to create a REG_MULTISZ array. What you have done above is to add a semi-colon before each NULL which is superfluous. If you want a string that is tokenisable then put the semi-colon instead of the NULL, but make sure you still put the NULL at the very end.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
jkirkerx wrote: ...But I'm unsure if I did the right thing.
Anytime you are needing to deal with the '\0' character, functions like strcpy() , strcat() , strlen() and the like are off limits.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
This code removes the caption from the frame, however, it also removes all the title data from the Window – New view, only the number of the new window is there, but the document string (title) does not change.
strTitle = pDocument->GetTitle();
DWORD style = pFrame->GetStyle();
pFrame->ModifyStyle(style,WS_CHILD | WS_THICKFRAME ); // remove all , and no caption
strTitle = pDocument->GetTitle();
How do I access the standard Windows menu to put the title back in ?
As always, your help is appreciated.
Thanks Vaclav
I have modified
pFrame->ModifyStyle(WS_CAPTION,NULL);
It keeps the menu document title, but Window tiling does not work wihtout the caption. No surprise here.
I do not need tiling anyway.
I am still looking for ways to replace the New view "serial number " with
title preferably from menu.
-- modified 13-Nov-11 7:35am.
|
|
|
|
|
I do not think that removing all styles from your frame window and replacing by WS_CHILD | WS_THICKFRAME is what you want to do here.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Yes I do want to do that, but it may be the wrong place to do this.
I need to have a multiview of a single document and do not want to have title bar in these secondary views.
I may use it only to initialy let the user reposition these views, than I do not need / want the title bar to clutter the destop.
I think the answer must be somewhere in CDocument "title" string.
But I have not found how to change the string at run time.
As far as clearing all the styles - it would be nice to find out what exactly are the default / framework generated styles.
|
|
|
|
|
But it seems to me that you are changing the style of your FrameWnd window rather than the MDIChild . If you want to remove the title from a child window then you need to modify each one's properties individually.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
I'm trying to do programming C++ for my project.
I got into trouble when I tried to do program for communicating with COM port(reading information in ComboBox).
The error " overloaded member function 'class CString(class CComboBox &a) not found in 'CXeedlg'. Could someone help me to overcome ?
overloaded member function not found in 'class'
The following is my code:
"
CString getCurStrInComboBox(const CComboBox &a)
{ CString str;
a.getLBText(a.GetCurSel(),str);
return str;
}
"
And the 2nd one is I dont know the reason why the complier informed that InsertString, AddString, GetCursel() arent members of ComboBox.
The deadline for my project is coming soon so I will really appreciate all your helps.
Thank you very much
|
|
|
|
|
Don't you need a class name in front of that function? As in, CXeedlg::getCurStrInComboBox
|
|
|
|
|
That was my bad in typing. I also have that part.
I also wanna ask you guys more questions.
"void CXbeefixedDlg::InitComboBox()
{
// ComboBox ComPort
m_cboComport.ResetContent();
m_cboComport.AddString("COM1");
m_cboComport.AddString("COM2");
m_cboComport.AddString("COM3");
m_cboComport.AddString("COM4");
m_cboComport.SetCurSel(2);
// ComboBox BitRate
m_cboBitrate.ResetContent();
m_cboBitrate.InsertString(0,"1200");
m_cboBitrate.InsertString(1,"2400");
m_cboBitrate.InsertString(2,"4800");
m_cboBitrate.InsertString(3,"9600");
m_cboBitrate.InsertString(4,"19200");
m_cboBitrate.InsertString(5,"38400");
m_cboBitrate.InsertString(6,"57600");
m_cboBitrate.InsertString(7,"115200");
m_cboBitrate.InsertString(8,"230400");
m_cboBitrate.SetCursel(3);
// Combobox Databit
m_cboDatabits.ResetContent();
m_cboDatabits.AddString("4");
m_cboDatabits.AddString("5");
m_cboDatabits.AddString("6");
m_cboDatabits.AddString("7");
m_cboDatabits.AddString("8");
m_cboDatabits.SetCurSel(0);
//Combox Stopbit
m_cboStopbits.ResetContent();
m_cboStopbits.AddString("1");
m_cboStopbits.AddString("1.5");
m_cboStopbits.AddString("2");
m_cboStopbits.SetCurSel(0);
//Combox Paritybit
m_cboParitybit.ResetContent();
m_cboParitybit.InsertSring(0,"None");
m_cboParitybit.InsertString(1,"Odd");
m_cboParitybit.InsertString(2,"Even");
m_cboParitybit.InsertString(3,"Mark");
m_cboParitybit.InsertString(4,"Space");
m_cboParitybit.SetCursel(0);
}
void CXbeefixedDlg::Settings()
{
// Check whether port was openned, Close port to setup parameter
if (m_mscomm.SetPortOpen())
m_mscomm.SetPortOpen(false);
// Initialize Port name
m_mscomm.SetCommPort(m_cboComport.GetCursel()+1);
// Initialize parameters, databits, stopbits, parity bits, flowcontrol
CString strBitrate = getCurStrInCombobox(m_cboBitrate);
CString strParitybit = getCurStrInCombobox(m_cboParitybit);
CString strStopbits = getCurStrInCombobox(m_cboStopbits);
CString strDatabits = getCurStrInCombobox(m_cboDatabits);
//Cstring strflowcontrol = getCurStrInCombobox(m_FlowControl);
CString strSetting;
strSetting.Format("%s,%c.%s,%s",strBitrate,strParitybit[1],strStopbits,strDatabits);
m_mscomm.SetSettings(strSetting);
// Other initializations
m_mscomm.SetRThreshold(1);
m_mscomm.SetInputlen(2); // Read 2 characters per once time
m_mscomm.SetInputBufferSize(1024);
m_mscomm.SetInputMode(0); // 0 - Text mode, 1 - Binary Mode
m_mscomm.SetPortOpen(true); // Open COM port
}
CString CXbeefixedDlg::getCurStrInCombobox(const CComBoBox &a)
{ CString str;
a.GetLBText(a.GetCurSel(),str);
return str;
}
"
The above is my code but I dont know the reason why my VC++ informed that GetCurSel is not a member of ComboBox class. And in the getCurStrInCombobox, it informed that missing "," before "&". Could you help me to solve this problem ?
The deadline for my project is coming so now I'm really rushed.
Thank you very much.
|
|
|
|
|
is this in your code or is this more "typo" during entry:
Quote: CComBoBox
you have too many capital "B"s in your CComboBox 
|
|
|
|
|
Most likely, this is your problem:
CString CXbeefixedDlg::getCurStrInCombobox(const CComBoBox &a) Instead of CComBoBox, it should be CComboBox
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
First:
The member function listed in the compiler message looks like a conversion constructor for the class CString, taking a parameter of type CComboBox. Apparently the compiler found a function call somewhere in your code that requires a parameter of type CString, but you passed it a parameter of type CComboBox. Therefore it tried to find a conversion function from CComboBox to CString, and because it didn't find one, it issued this error message.
Solution: locate the position in your code that the error message points to and replace the CComboBox argument with one of type String, or convertible to CString.
(P.S.: the error message looks like there's something missing - it might just be what Chuck said)
Second:
This might be a followup error, but I cannot fathom how. You might have forgotten to include the right header, but I doubt that - it would cause quite a lot more errors, and the compiler wouldn't even recognize the symbol CComboBox to be a class. Maybe you mistyped the type CComboBox for ComboBox, like you did in your posting? It might be helpful to see a piece of code that these error messages point to.
|
|
|
|
|
Hi,
The following code in VS2008
CString str;
char Singature[16];
strcpy (str.GetBuffer() , Singature);
str = "_________________Header_________________";
reports me the following message :
"Windows has triggered a breakpoint in xxxxx
This may be due a corruption of the heap, which indicates a bug in xxxx or any of the DLLs it has loaded."
When I delete the strcpy code, then it works fine. What seems to be the problem here ? The mentioned code it worked just fine in VS6.
sdancer75
|
|
|
|
|
The strcpy function keeps copying until it reaches a terminating null.
Since you did not initialize Signature, there is probably no null character contained in it.
Thus, strcpy is writing to memory that it should not. That is the cause of the error.
Try using the following code instead:
char Singature[16] = { 0 };
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
That's not true. The example is just a copy/paste from a bigger application and I forgot the mentioned initialization..
Please take a look in the uploaded example at https://rapidshare.com/files/2185607429/test.zip[^]
The problem is occured at line 104 in the testDlg.cpp file.
sdancer75
|
|
|
|
|
Well how do you expect to get help if you don't post the exact example of code?
No one is going to download a zip file to look at your code. You need to post a snippet here.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Thank you for you reply.
Sorry for the attached zip, it was an empty MFC project with just 4 lines of the offended code.
I get my answer below. Thank you again for your time !!!!
Best Regards,
sdancer75
|
|
|
|
|
is Signature longer than the current contents of str ? if so, you have a probable buffer overrun.
you also need to call ReleaseBuffer.
|
|
|
|
|
The Signature is a char array with 16 elements. The str is just a CString. The CString its a dynamic structure and dont need to make reservations in size before.
Take a look sample at https://rapidshare.com/files/2185607429/test.zip[^]
The problem is occured at line 104 inside testDlg.cpp
thanks
sdancer75
|
|
|
|
|
sdancer75 wrote: The CString its a dynamic structure and dont need to make reservations in size before.
how could a CString possibly know how many bytes you are going to copy into it?
|
|
|
|
|
You are right !!! My stupidity !!!
Thank you for your time !!
sdancer75
|
|
|
|
|
Oh, this statement is so wrong, especially since you are getting a pointer to the CString's buffer and manipulating it yourself, directly and wrongly. You've removed all dynamicicity (is that a word) from CString this way.
|
|
|
|
|
Obviously the example is meaningless so hopefully it is just that.
However the signature for strcpy is strcpy(dst, src).
And strcpy requires a null terminated array for src. Your example does not have that because your src is not initialized.
|
|
|
|
|
The example is just a copy/paste from a bigger application. The src is initialized but i forgot to copy it in my example, sorry.
Please take a care at the sample code i upload at https://rapidshare.com/files/2185607429/test.zip[^] and take a look at line 104 inside the testDlg.cpp. Its almost the same situation.
Regards
George
sdancer75
|
|
|
|
|
Stop reposting this link, nobody is going to download this. Show the code that is causing the problem, including the initialisation pieces, so people can actually understand what your program is trying to do.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|