|
Glad to be of help. There's still an error though: when you call strlen(somestring) what you get is not the actual size required to store a 0-terminated string, you only get the number of actual characters, or length of the string stored in this variable. It does not account for the terminating 0-byte. So when using strlen() for the purpose of allocating a sufficiently long block of memory, you always have to add 1! So instead of
pjdriverdude wrote:
char* voice_template = new char [ strlen(user_voice_template_g) ] ;
you should write
char* voice_template = new char [ strlen(user_voice_template_g) + 1 ] ;
You can also see this technique in the second example I gave: there I added the two strlen results and added another 1 on top of that.
That said, the missing byte might not cause any issues: using strcpy and strcat in place of strncpy and strncat makes sure the terminating 0 will be copied even if it's past the buffer. This can cause a lot of trouble if that memory location is being used for something else, but it is entirely possible for a single byte address to remain unused.
|
|
|
|
|
Hello,
Is MFC coding different for different versions of visual studio.
Pritha
modified on Monday, September 27, 2010 5:44 PM
|
|
|
|
|
Yes and no.
They occasionally change the argument/parameter order in a method (i.e. CRegKey changed between 6.0 and 2003) but for the most part, the overall approach tends to change little. Ivor Horton has hardly changed his "Beginning Visual C++" books over the years since the basics have not changed all that much.
However, I don't think I've ever been able to compile an MFC application with a newer version of Visual Studio without needing to change a few things such as the project VC++ Directories, minor shifts in the header files, etc...
ATL has changed a bit over the years and a few things have been left out in newer versions of Visual C++ so that tends to be the most painful part if you utilize any ATL.
|
|
|
|
|
|
Greetings!
I need to get the help button at the bottom left of the older version of the CPrintDialog class to point to something other than its default location.
Is there a way to do so?
I was able to hide the Help button with code resembling the following line:
dlg.m_pd.Flags -= PD_SHOWHELP;
Thank you for your help.
Regards,
Rajneesh
|
|
|
|
|
for that, you need to get get the control ID of the 'Help' button on PrintDialog. Using Spy++, i could find it as 0x40E. Don't know whether it is #defined anywhere
Try adding an MFC class (say CMyPrintDlg), derived from CPrintDialog, override its OnInitDialog().
BOOL CMyPrintDlg::OnInitDialog()
{
CPrintDialog::OnInitDialog();
CWnd *pBtnHelp = this->GetDlgItem(0x40E);
if(pBtnHelp)
{
CRect rc;
pBtnHelp->GetWindowRect(&rc);
ScreenToClient(&rc);
pBtnHelp->SetWindowPos(0, 0, rc.top, 0, 0, SWP_NOSIZE);
}
return TRUE;
}
and invoke it..
CMyPrintDlg dlg(FALSE, PD_PAGENUMS | PD_USEDEVMODECOPIES | PD_SHOWHELP);
dlg.m_pd.nMinPage = dlg.m_pd.nFromPage =1;
dlg.m_pd.nMaxPage = dlg.m_pd.nToPage = 10;
if (dlg.DoModal() == IDOK)
{
}
|
|
|
|
|
Hello Friends
How can I use Libtiff in my project.
I want to open a existing tiff image and recreate with layers while it is opened in application.and want to exchange layers with each other also.
Any Ideas?
Thanks In Advance.
Regards
Yogesh
|
|
|
|
|
There's a looooot of documentation at LibTIFF website.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi all,
I have made a sdi application, in that application i have made a splitter control. On Left and right side of splitter control i have placed a class derived from CFormView. On Left side of Splitter control on form view i have placed a Report style list control. All things are working fine bu my List control is not displaying vertical scrollbar but instead it is displaying a horizontal scrollbar.
What can i do?
Can anybody help me in this?
Thanks in advance
|
|
|
|
|
Are you resizing the list control properly? Make sure the control is not wider than your splitter pane. Also, you need to populate the list with enough items to make the scroll bar visible.
If the list should fill the entire area, you could use a CListView instead.
|
|
|
|
|
if the points specified above are alright, another reason for only the horizonatal scrollbar to get showed is, setting the LVS_ALIGNLEFT property to list control. Try changing it to LVS_ALIGN_TOP.
m_listControl.ModifyStyle(0, LVS_ALIGNTOP, 0);
|
|
|
|
|
Any pointer to a good introduction to such matters ?
|
|
|
|
|
|
About bit-fields, you can start from here[^]
|
|
|
|
|
|
I created some edit controls on a dialog box at run time. How to set tab order for those controls?
|
|
|
|
|
|
I have 5 Edit ownerdraw controls on dialog. How to set Tab order in a go?
|
|
|
|
|
By default the tab order is set in the order of creation of the controls.
To change this you can use SetWindowPos by specifying the hWndInsertAfter parameter.
|
|
|
|
|
Hi All,
I need to create an intellisense type drop down which will show up when user presses a key combination inside a text editor. This drop down will contain english words pulled from a database. User can choose the word from the dropdown which he want to insert inside the text editor.
Please tell me how to create dropdown list dynmically on a key press.
I successfully hooked the key combination.
Thank You.
Regards,
John.
modified on Monday, September 27, 2010 5:45 PM
|
|
|
|
|
I have a MFC based window application developed in VC6.0. We have developed it in English language. Hence all the menu, windows, messages and other text of the application are displayed in English.
I want it to be displayed in other languages also.
Is there any quick way to do the conversion of the language?
What is the way to do the conversion?
Please suggest me with all the possible ways to convert the langugage.
Thanks in advance,
Mohan
|
|
|
|
|
This [^]should be a good place to start.
I am a HUMAN. I have that keyword (??? too much) in my name........
_AnsHUMAN_b>
|
|
|
|
|
|
|
Do we really require to change the project settings to UNICODE? I dont think so, we can very well support all languages (including east asian languages) in MBCS also. Please correct me if I am wrong.
Thanks,
Anand.
|
|
|
|