|
Thanks for your answer, but the ONLY reason why I used "cin" was because of the characters it delivered from the "istream" buffer, I could use in test like, "isspace", "isalpha", "ispunct" (etc.) as they were coming in.
Nonetheless, your suggestion does have merit to it. Thanks.
William
Fortes in fide et opere!
|
|
|
|
|
Using gets() is about as unsafe as you can do it. What if the user types more than 80 characters? Buffer overflow. That it what causes crashes. At least use fgets() where you can actually specify the size of the buffer.
There is nothing wrong with using the STL streams. I would choose it every time over gets() .
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Ryan Binns wrote:
types more than 80 characters? Buffer overflow. That it what causes crashes. At least use fgets()
I think that's pretty obvious, you can use fgets() too, although normally for file i/o, but it doesn't really matter as long as you know what your doing.
|
|
|
|
|
|
sure, but if you're writing a quick application that requires inputs like names, it's pretty safe to assume 80 or 100 chars will be ok.
I don't get paranoid about that stuff. You can however use fgets() with stdin as the file handle as you said.
|
|
|
|
|
I don't know who I'm quoting at the moment, but I need to let you know:
"Programming nowdays is a contest of making the best idiot proof program, against the universe making bigger idiots!"
(2 thums up to the one who thought of that sentence )
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
I managed to put together a very cool looking
.chm file using the program FAR. How can I
execute the .chm from my program? I used the
code:
CreateProcess(NULL, "help.chm, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
But it didn't work, even though it works for all the
other .exe files that I have. Is there something
special I need to do to run a .chm file?
Please, please, any response any one can give me
will be greatly appreciated.
Sincerely,
Danielle (an overworked graduate student)
|
|
|
|
|
ShellExecute(NULL, _T("Open"), _T("help.chm"), NULL, NULL, 0);
|
|
|
|
|
you also had a non-matching parenthesis in your code.
|
|
|
|
|
It worked.
Thank you very much. ;)
|
|
|
|
|
ShellExecute will work, but you need to use the HtmlHelp Api.
This will also help you launch directly a specific topic inside the chm help file.
HtmlHelp(m_hWnd, AfxGetApp()->m_pszHelpFilePath, HH_HELP_CONTEXT,
<topid_id>);
Also, you need to do this to replace the '.hlp' extension to .chm. in your initinstance.
CString strHelpFile = _pszHelpFilePath;
strHelpFile.Replace(_T(".HLP"), _T(".chm"));
free((void*)m_pszHelpFilePath);
m_pszHelpFilePath = tcsdup(strHelpFile);
You can download htmlhelp lib and header files from microsoft's site, if you don't have it already.
Hari Krishnan
|
|
|
|
|
pranavamhari wrote:
HtmlHelp(m_hWnd, AfxGetApp()->m_pszHelpFilePath, HH_HELP_CONTEXT,
);
You have missed 4th parameter of HtmlHelp. Can you tell me what to give here when using HH_HELP_CONTEXT command. I am giving mapid but getting this message
"HH_HELP_CONTEXT called without a [MAP] Section."
Any remedy to this?
Hashim Saleem
|
|
|
|
|
Now instead of using HH_HELP_CONTEXT, I am doing this
<br />
::HtmlHelp(NULL, <br />
"C:\\MyHelpFile.chm::/Welcome.htm>MyWindow",<br />
HH_DISPLAY_TOC,<br />
NULL) ;<br />
I am achieving my purpose. But tell me is it the right way instead of
HH_HELP_CONTEXT.
Hashim Saleem
|
|
|
|
|
I've tried to put background image into CListCtrl, but i completely ran out of ideas how to do this!!!
I cannot use owner drawn control because I need big icons.
I cannot use CListCtrl::SetBkImage() because it cannot stretch bitmap;
Maybe this is done somehow by using custom draw, but I failed. Can somebody give me link to working sample with background image?
Give me any suggestions!
|
|
|
|
|
when you OnSize, dynamically resize the bitmap to the client area rect, then CListCtrl::SetBkImage(), there are good chapters on bitmap manipulation in Charles Petzold's programming windows 95 and Programming windows with MFC by j. procise
|
|
|
|
|
|
Im currently working on an addin for visual studio 6.0 and I need to retrieve the selected item in the classview, the item could be the name of a class, method or attribute.
Any suggestions? Im totally stucked
|
|
|
|
|
There's a special UI tool in O'reilly's "Win32 API Programming with Visual Basic" on the compliment CD, that lets you grab any child window's handle by clicking on it.
You could get that book, then use the tool on the CD to get that class tree control's window handle, and view it's messages. It no doubt sends notify messages to its parent.
|
|
|
|
|
I'm relatively new at SDI programs (and I haven't touched MDI yet), but I have worked with MFC dialogs a lot. It would be convenient to be able to create a dialog resource (probably one without a frame) and then be able to use that as my view. Is this possible to do? If so, how would I go about doing this?
If this is not possible to do, where would I create windows such as CButtons and CEditBoxes? I tried doing this in the OnPaint function, but I just get flicker. Thanks for any help you can give me!
Douglas A. Wright
dawrigh3@kent.edu
|
|
|
|
|
If you want want to use a dialog as your main view either use AppWizard to create a dialog based application or, if you really want an SDI app, in the final stage of AppWizard change the base class of your view class to CFormView.
OnPaint is called every time the window needs redrawn, so is not the place to create controls. You could overload the Create method for the view and create them there.
You probably should get hold of a book on MFC programming - I found an earlier edition of this one very useful when I was learning the basics (I still refer to it a lot).
Niall.
|
|
|
|
|
Why not create the controls through the recource editor and hard code them in your class or use the appwizard for creating controls!
I prefer hardcoding all controls.
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
Hi,
I have many dialog boxes in my application, and I need to transfer the data to another dialog box, in other words how do I access the data stored in a variable in a dialog from another one.
Hope my question is quite clear,
Thanks
Deepak Samuel
|
|
|
|
|
One solution is messages. Send a message to the parent window and have it dispatch does the data transfer.
Kuphryn
|
|
|
|
|
when you want to access a public member variable of dialog A from dialog B just do that:
((CDialogA*)GetParent())->m_member_variable = ...
in case of CDialogA being the parent of dialog B
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Where we have to write this code "((CDialogA*)GetParent())->m_member_variable = ...";
please help me....
Thanks a heap...
|
|
|
|