|
Found it!
That code does work. I didn' have endl. For some reason the system("cls") doesnt get executed without the endl.
#include <stdlib.h>
cout << "Before\n" << endl;
system("cls");
cout << "After\n";
_______________________________________
Web: www.jcroucher.com
Sonork: 100.472
ICQ: 25902350
MSN: jcroucher@yahoo.com
Yahoo: jcroucher@yahoo.com
----------KnOwLeDgE iS pOwEr-----------
|
|
|
|
|
endl is equal to:
putc('\n');
flush();
prolly the flush is the responsible here.
Concussus surgo.
When struck I rise.
|
|
|
|
|
Hello,
I have a View that's derived from a CListView--with an implicit CHeaderCtrl:
class CGoalsListView : public CListView
However, when I use the class wizard to create handlers Header notifications (e.g., HDN_ENDDRAG), the handlers are never called. The Class wizard put in ON_NOTIFY_REFLECT macros for these controls. I'm wondering if I'm in messaging hell because of my heterodox behavior of getting my main view from CListView instead of CView? Does anyone have any suggestions on how I can find the notifications from my CHeaderCtrl?
Oh---also, how can I change my Header Control's style?--the MSDN alludes to it but doesn't give the exact function (suggests "further reading").
thanks!
JennyP
|
|
|
|
|
I found all I needed on this site! (Should have checked here first.)
http://www.codeproject.com/listctrl/headerctrl.asp
Thanks!
JennyP
|
|
|
|
|
I do that all the time...
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hi all,
Does anyone know of a way to specify the position in which a popup message box will appear on screen? I am currently using AfxMessageBox for all my popups, but cannot see any way to force this to pop in a particular location, rather than always displaying in the center of the screen.
Any help would be greatly appreciated...
Thanks,
Steve.
|
|
|
|
|
|
I have custom html text in CString and I should show it to user. Please help me. I think I should use IWEBBrowser2, but it work with url or file.
|
|
|
|
|
i was trying to do this too, a few months ago. i gave up and just write the HTML to a temp file.
-c
Conservative:
One who admires radicals centuries after they're dead.
-- Leo C. Rosten
|
|
|
|
|
I know how to do this once you have the IHTMLDocument2* . My awareness of IWebBrowser2 is minimal. But if you can get the IHTMLDocument2* then here is some code :-
HRESULT hr;
SAFEARRAY* psa = SafeArrayCreateVector(VT_VARIANT, 0, 1);
VARIANT *param;
BSTR bsData = m_html.AllocSysString();
hr = SafeArrayAccessData(psa, (LPVOID*)¶m);
param->vt = VT_BSTR;
param->bstrVal = bsData;
hr = pDoc->write(psa);
hr = pDoc->close();
SysFreeString(bsData);
SafeArrayDestroy(psa);
By the way try this to get the IHTMLDocument2*
Use the IWebBrowser2::Document property to get an IDispatch interface pointer. Call QueryInterface on this to get the IHTMLDocument2* . I am not good at COM, so my method might be wrong, but try it anyway
Regards,
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
Say I have the name of a file that is being used by another program (it is a log file) and I want to switch the file so that it is sent to a socket instead of dumped into a file is there any way of doing this?
Right now I am just watching the file reading and sending updates, than deleting the file when it is done. These log files can get really big though so I was hoping there was another way.
Thanks
|
|
|
|
|
Can u delete the old file after u are thru with it?
|
|
|
|
|
The problem is that I think the files can grow forever, untill the system runs out of disk space.
|
|
|
|
|
2 suggestions:
1. use the rotary log file wotsit here on cp (dont have link sorry)
2. as you write to the file check its length ... if it goes past a certain size rename it to log01.log (or something) and start another log00.log ... you may run as many as you please before deleting old logs ... i used the date for our log files so they would end up with one per day and they could delete them manually or we could delete them after say 7 days automatically
users like to have lots of log rubbish to read so its cool to leave them around
"... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away" sonork: 100.18128 8028finder.com
|
|
|
|
|
I wrote:
IShellLink* psl;
CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
IID_IShellLink, &psl);
CoCreateInstance failed. returned val is not REGDB_E_CLASSNOTREG or CLASS_E_NOAGGREGATION . Why should it fail???
Plz resolve this one, and even better, direct me to some article/source code about creating shortcuts (*.lnk)
10x
--BlackSmith--
"With the help of all mighty", 2001, Me.
|
|
|
|
|
|
CShellLink::Initialize() calls CoCreateInstance() . Yet, it fails!
Maybe there's something wrong with my Win2000???
--BlackSmith--
"With the help of all mighty", 2001, Me.
|
|
|
|
|
you have put:
if (!AfxOleInit()){
AfxMessageBox(_T("OLE Init Failed ... aborting!"));
return FALSE;
}
in ur InitInstance() right?
"... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away" sonork: 100.18128 8028finder.com
|
|
|
|
|
I can get a cmnd* to my toolbar but I need a cwnd* for a button on the toolbar. How can i do this? Do the buttons not have a cwnd*?
Thanks
|
|
|
|
|
No, the individual buttons on a toolbar are not windows. You can verify this with Spy++
--Mike--
Just released - RightClick-Encrypt v1.3 - Adds fast & easy file encryption to Explorer
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
I have a modal dlg spawned by an MDI view class. THere is a data variable array called m_Fld[10] in my doc class. I want to transmit this info to the dlg launched from the view class. After I get user input in the dlg corresponding to processing this array, I want to store it in another doc variable.
Here is my thought. If theres something simpler I'd like to know. This sounds a bit complicated.
First I make a class CMOdalDlg which has a member array m_DlgFld[10], a MyDoc* m_pDlgDoc, and MyDoc.h include. It also has a function called
CModalDlg::SetDocPointer( MyDoc* pdoc)
{
m_pDlgDoc =pDoc;
}
Then after I do (in the view)
CModalDlg myModalDlg;
for (int i = 0, i < 10; i++)
{
myModalDlg.m_DlgFld[i] = pDoc->m_Fld[i];
}
myModalDlg.SetDocPointer(pDoc);
myModalDlg.DoModal();
Then in the OnInitDialog of myModalDlg I can process this array (it populates a listcontrol in the dialog), get user input from the form, store it in m_pDlgDoc->m_somemember, and say OK to return from the DoModal().
I hope this isnt too confusing. Is this the way to go about it or is there a simpler mechanism I'm unaware of?
Thanks,
ns
A pre-translate message problem -I prevent the dismissal of the dlg due to Enter key with a pretranslate event. But this makes the dlg unresponsive to all Enter presses. So after the user enters data into a CEdit object called m_edit, what action should I take to put this entered info into my doc variable? Do they have to press an 'Done' button which will do the data copy? If I want an Enter to copy the user input info into the doc var, how is this accomplished (assuming I can respond to Enter?) There is no function that runs like the BN_clicked of 'Done' button when you press enter, right?
Anyways I cant respond to enter anyways so I'll have to have a'Done' button, though an 'Enter' would be cooler.
Any thoughts on this?
Hope my issues are clear...
Thanks for any ideas,
ns
|
|
|
|
|
If you're passing a pointer to the doc to the dialog, you don't need to populate the dialog's m_DlgFld member. In fact, you don't even need this member. In the dialog's OnInitDialog() , simply access the doc's member and load the list control.
In general it's a good idea to not duplicate data. It makes verifying program correctness difficult.
|
|
|
|
|
nss wrote:
I prevent the dismissal of the dlg due to Enter key
I suggest not using pre-translation because (as in your case) it can be overkill. Instead simply override the dialog's OnOK() handler to return without calling CDialog::OnOK() . Then, replace the IDOK button with a button of a different id, eg: ID_EXIT . In it's handler, call CDialog::OnOK().
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Okay. If I do what you say and can have Enter recognised, how do I transfer the contents of my CEdit into the doc var when the user enters the input and presses enter? Theres no CEdit function that runs when you press Enter while in it, correct? So a BN_CLICK of a "Done" button is what I'm thinking. Yet we know that apps exist where you can put data into CEdit, press Enter and information gets transmitted. What is the function that runs when you are done entering data in the CEdit and press Enter?
Questions, questions! Thanks for reading through my design dilemma, and indeed I was duplicating data as I now see. Good thing I havent started yet!! Thanks so much for your clarity!
Theres an _ASSERTE that I'm going to check out. tells you what went wrong it seems (or maybe ASSERT does that anyways)
|
|
|
|
|
nss wrote:
how do I transfer the contents of my CEdit into the doc var when the user enters the input and presses enter
Just add this to your OnDone() handler:
ASSERT (m_pDoc != NULL);
GetDlgItemText (IDC_MyEdit, m_pDoc->m_someString);
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|