|
I want to right to a .txt file. I have a formated CString and I want each time it writes to do it on a new line. Can anyone help me?
- Matt Newman
- Matt Newman
-Sonork ID: 100.11179:BestSnowman
|
|
|
|
|
Assuming fOut is a legal output FILE*, and sFoo is your string:
fprintf(fOut, "%s\n", (LPCSTR)sFoo);
Just one of the gazillion ways to do it.
/Mike
|
|
|
|
|
Perhaps the ::fputs(...) function?
This assumes you are using the C RTL, of course...
-=- James.
|
|
|
|
|
If you are using MFC (and it seems that you are ) the best way to go is to use CStdioFile::WriteString
I vote pro drink
|
|
|
|
|
I haven't tried it yet but I think this is what I am looking for.
- Matt Newman
- Matt Newman
-Sonork ID: 100.11179:BestSnowman
|
|
|
|
|
Hi,
I'm trying to work out how to set a connection timeout for winsocks without using MFC.
(With MFC you just set m_nTimeOut to the required timeout in ms before you call Connect()).
I know you can use setsockopt to set the send and receive timeouts, but is there any way to set the connection timeout?
Many thanks,
Peter Pearson
|
|
|
|
|
I know you can use setsockopt to set the send and receive timeouts, but is there any way to set the connection timeout?
This isn't really a winsock question but more a common sockets question, isn't it?
If setsockopt works, why do you want to find another way to do it? Maybe there is some obscure WSA* function to do it, but why bother?
/Mike
|
|
|
|
|
when will the function execute?
i have set a breakpoint in the first line, but program doest step into.
in fact, i want to Draw something in OnIntialUpdate() function, but MSDN said
it won't be useful, becoz when the function finished, it will send a WM_PAINT
cause the Client to be invalidated, all the drawings will disappear.
how can i finish it?
one is the other who absorbs the thoughts of others
|
|
|
|
|
just a thought
are you trying to draw in a control view? (ie, clistview, ctreeview, etc) 'cos if you are it never gets called ... use the OnUpdate() function instead
might be off the mark but its a thought
---
"every year we invent better idiot proof systems and every year they invent better idiots ... and the linux zealots still aren't being sterilized"
|
|
|
|
|
no, such as pDC->TextOut(xpos,ypos,text);
it wont display on the view's screen
one is the other who absorbs the thoughts of others
|
|
|
|
|
Do you have an OnPaint as well ? Have you tried drawing in OnDraw and see if it appears or not ?
Have you tried Spy++ to see what messages the window is recieving ??
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
it seems no need to write OnPaint
First, the program won' t step into the OnDraw Function, why?
one is the other who absorbs the thoughts of others
|
|
|
|
|
ooze wrote:
First, the program won' t step into the OnDraw Function, why?
Well, looking through the code you posted, it seems to me - no, wait....
ooze wrote:
it seems no need to write OnPaint
I have a vague recollection that overriding OnPaint stops OnDraw from being called - that was why I asked.
I just created a vanilla SDI app and my OnDraw is getting called. Did you try Spy ++ ? If you still can't see it, you should probably post some code, but if OnPaint and OnDraw are both not getting called, I don't see how your window can *be* at all. BTW you want OnPrepareDC instead of OnDraw anyhow, if you want to avoid flicker.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
i comments the code in OnPaint, the OnDraw won't work
but if i comment all the function of OnPaint, OnDraw works, why?
thanks lots
one is the other who absorbs the thoughts of others
|
|
|
|
|
So it appears I was right ? Anyhow, I don't know *why* it works this way, but it makes sense, given that both functions basically do the same thing.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
i comments the code in OnPaint, the OnDraw won't work
but if i comment all the function of OnPaint, OnDraw works, why?
as the MSDN said,
Called by the framework to render an image of the document. The framework calls this function to perform screen display, printing, and print preview, and it passes a different device context in each case. There is no default implementation.
i want to know when will this function be exectued?
thanks lots
one is the other who absorbs the thoughts of others
|
|
|
|
|
This is the code for CView::OnPaint()
void CView::OnPaint()
{
CPaintDC dc(this);
OnPrepareDC(&dc);
OnDraw(&dc);
}
And this is the code for CView::OnPrint()
void CView::OnPrint(CDC* pDC, CPrintInfo*)
{
ASSERT_VALID(pDC);
OnDraw(pDC);
}
If you override either one of these two functions, you have to call OnDraw() yourself.
---
It may be that your sole purpose in life is simply to serve as a warning to others.
|
|
|
|
|
no, if u override OnPaint() and the OnPaint DOes NOT call OnDraw, then
the OnDraw won't be executed
i have not test OnPrint maybe either won't work
one is the other who absorbs the thoughts of others
|
|
|
|
|
Of course not, OnDraw is only called my OnPaint and OnPrint.
The only reason OnDraw exists is to provide a single rendering routine for both WM_PAINT messages and printing. Thus, the default implementation is good enough.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
why do you said the default implementation is good enough?
virtual void OnDraw( CDC* pDC ) = 0;
so we must override this member?
why MFC provide this method? in SDK?
Called by the framework to render an image of the document. The framework calls this function to perform screen display, printing, and print preview, and it passes a different device context in each case. There is no default implementation.
according to MSDN we should add this method into OnPaint, OnPrint, OnPrintPreview ?and Override OnDraw method?
but if i have both OnPaint and OnDraw in my source code, but OnPaint doest call the OnDraw method, the OnDraw Method won't run in anytime.
one is the other who absorbs the thoughts of others
|
|
|
|
|
thanks, ic at last
one is the other who absorbs the thoughts of others
|
|
|
|
|
Hello guys
I know that this is the wrong forum, but I didnt find an ASP forum
See the ASP code below
Set s = server.CreateObject("WScript.Shell")
s.Run "d:\jjj.bat"
Works fine for me.
But when I replace jjj.bat with c:\winnt\notpade.exe what happens is that notepad gets spawned [I can see it in the task manager] but it never gets shown
so I replaced the line with this line :-
s.Run "c:\winnt\notepad.exe",3,false
3 stands for maximized and false means return immediately
Now what happens is the same.
Notepad gets spawned but the window doesnot pop up visibly on the server running IIS 5.0 and what's even worse is that despite giving false s.Run never returns with the result that we get a hanging ASP !!!
What do I do to resolve this?
Of course I am not at all interested in notepad.
But for some reason I need to use ASP to start a GUI program on the IIS machine.
I tried the above code on a win98 machine running PWS and successfully had notepad upon the screen
But win2K and IIS is not allowing me to do that.
So the question is this -
How do we spawn a GUI program using ASP and return, allowing the GUIprogram to finish on its own.
Regards and apologies for using the wrong forum,
Nish [ASP-program-spawning newbie]
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Ahhhhh! What are you doing spawning GUI apps from IIS process? (that is a rhetorical questions).
I've never tried nor I will ever attempt to try to do what you are describing, but here are the few things to try/consider:
On properties of your web site in IIS under Home Directory tab there is a setting for Application Protection. Default setting is "Medium (Pooled)" you can try switching to "Low (IIS Process)".
Also everything you launch from IIS process is running under IUSR_MACHINENAME account. Does this account have sufficient permissions to run Notepad.exe or your GUIApp?
I believe that by default IIS does not let you launch "out-of-process" (I know we are not talking COM here but could not find a better term) processes. I know how to overcome this with COM, but I am not sure in your case. So if nothing else works you might want to turn your GUIApp into an out-of-process COM exe and then you will be able to Server.CreateObject it from ASP and make it do whatever you need. If your GUIApp is not something you wrote then you might want to create a separate out-of-process app that will in turn launch your GUIApp...
Boy, what a mess... I strongly recommend to find some other way of doing what you are doing. I have been supporting out-of-process COM component that is called from ASP for a while and it is a nightmare you do not want to have in your life - trust me.
I am sorry, if I am not much help...
|
|
|
|
|
Hi Konstantin
Thanks. I think the fact that all apps spawned will be running as IUSR_MACHINENAME has something to do with this state of affairs. But what was puzzling was that when I tried to terminate these spawned instances using task-manager I got an access-denied message despite running as administrator which is amazing. I finally right-clicked on the process in the task-list,clicked debug, then VS debugger jumped up,clicked stop and exited VS and then checked task-manager again to find that the app had gotten killed. Amazing sequence of events.
Thanks once again,
Nish [running as IUSR_MACHINENAME ]
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Hi,
Is there any way to resize the animation control in such a way that the animation is not clipped but resized?
Thanks Krishnan
|
|
|
|