|
I'm writing a app. that connects to a ftp server and downloads /uploads some files. I also need smb support and the app must also be able to mount a network share and do similar ftp stuff. My first instinct was to use communication pipes. howeevr I need the app to be Win9x compatible too. My next guess is using Winsock.
how do I mount a network share in WinNT?
Any comments/advise?
TIA.
I'm an alien, I'm an alien
it's a beautiful life....
Bush
|
|
|
|
|
Hi,
I want to show the vertical scroll bar always in the view (derived from CRichEditView) of my MDI application. The problem is, by default the scroll bar is shown only when it is required. But I want to show the scroll bar always, even if there is nothing to scroll in the view. How do I do that. I tried ShowScrollBar, ModifyStyle ...but no result. ( this is in Win 95 machine)
Shrinivas
|
|
|
|
|
Hi,
I create a thread that run's for quite a long time. I want a "nice" way of terminating the thread from outside it. The only way I know at the moment is by TerminateThread, but this is not recommended. Are there any better ways?
Thanks
Neil
|
|
|
|
|
The only 'clean' way to terminate the thread is from the thread itself. It should periodically check for a signal from main thread to end itself - you can implement this strategy using a volatile bool variable. The variable should be initially set to false; when other thread should exit, the variable is set to true.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
There is no nice way of terminating a thread outside of it without some collaboration inside the thread (by the way TerminateThread shoud be used only as a last resort when nothing else worked). It is the thread that has to return upon indication.
There are several methods to signal a thread to die:- Setting some variable that the thread polls periodically,
- if the thread is usually hanged on a
WaitForMultipleObjects() (which is a very usual configuration for dispatching of asynchronous events), have an additional event handle for signalling time to die,
- if the thread pumps messages with a
GetMessage loop, post a termination message with PostThreadMessage(idThread,WM_QUIT,0,0) , or signal its dependent window to die and have this windows do PostQuitMessage() on WM_DESTROY .
Once you've signaled the thread to die, you can sit down and wait fot it to pass away with WaitForSingleObject(hThread,INFINITE) . If however you're not 100% sure your thread is going to behave, you can add a little panic handler just in case:
if(WaitForSingleObject(hThread,10000)!=WAIT_OBJECT_0){
ASSERT(FALSE);
TerminateThread(hThread);
}
CloseHandle(hThread);
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi,
I am embedding MSWord In my application, using OLE automation.
But when I goto save i get the saveas method is not available as the
document is been editted in another application.
Code As Follows, from the CanCloseFrame(), i did something similar to insert word into the doc/view architecture
CEmbedWordCntrItem* ViewObj;
ViewObj = ((CEmbedWordView*)pFrame->GetActiveView())
- >m_pSelection;
LPDISPATCH lpDispatch = (ViewObj->GetIDispatch());
_Document doc;
doc.AttachDispatch(lpDispatch);
COleVariant covFalse((short)FALSE);
COleVariant vtOptional((long)DISP_E_PARAMNOTFOUND,VT_ERROR);
doc.SaveAs(COleVariant("C:\\DataDoc.doc",VT_BSTR), vtOptional.........)
Cheers
Richard
![Eek! | :eek:](https://codeproject.freetls.fastly.net/script/Forums/Images/smiley_eek.gif)
|
|
|
|
|
I'm using a function to set a file for saving data. The function requires an LPSTR typr
for the filename parameter. The filename will be retrieved from an edit box in the application
dialog and it is presently type CString. When I build the project I get an error in the setDisk
function that says. "cannot convert parameter 2 from 'class CString' to 'char *'".
How do I fix this?
|
|
|
|
|
if your CString variable is str, do something like this:
yourFunction (firstParametar, (const char*) str);
I vote pro drink ![Beer | [beer]](https://codeproject.freetls.fastly.net/script/Forums/Images/beer.gif)
|
|
|
|
|
You have to cast:
void func(LPSTR s);
CString strx;
func((char *)(const char *)strx);
... or ...
func(const_cast<char *>(static_cast<const char *>(strx)));
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Help!
I've got a list box that that wont stop updating itself.
It displays correctly initially, but if it is refreshed(ON_UPDATE)
then it just goes beserk, repeatedly refreshing itself and keeping the rest of the dialog from refreshing.
Anybody had this happen before?
Know how to fix it?
Thanks
Josh
josh@that-guy.net
|
|
|
|
|
Are you handling any of the notifications from the list box? if you are make sure that they arent firing themselfs... like if you handle LBN_SELCHANGE, dont set the selection withing that handler.
It kind of sounds like something similar is happening to you, thought I'm not sure what ON_UPDATE referes to.
Ben Burnett
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic" ![Wink | ;)](https://codeproject.freetls.fastly.net/script/Forums/Images/smiley_wink.gif)
|
|
|
|
|
|
Hi,
I am embedding MSWord In my application, using OLE automation.
But when I goto save i get the saveas method is not available as the document is been editted in another application.
Code As Follows, from the CanCloseFrame()
CEmbedWordCntrItem* ViewObj;
ViewObj = ((CEmbedWordView*)pFrame->GetActiveView())
- >m_pSelection;
LPDISPATCH lpDispatch = (ViewObj->GetIDispatch());
_Document doc;
doc.AttachDispatch(lpDispatch);
COleVariant covFalse((short)FALSE);
COleVariant vtOptional((long)DISP_E_PARAMNOTFOUND,VT_ERROR);
doc.SaveAs(COleVariant("C:\\DataDoc.doc",VT_BSTR), vtOptional.........)
Cheers
Richard
|
|
|
|
|
Hi,
My objective is to simply copy a buffer to a file. However,
my program crashes when I attempt to do any CFile operations
(open/read/write/etc...) when I'm inside my ThreadFunction.
My calls work fine when I move it to the main application
thread, but I need to transfer it to a worker thread, and do
its processing in the background.
What am I neglecting to do? Any help is appreciated.
Best Regards,
Thuan![Confused | :confused:](https://codeproject.freetls.fastly.net/script/Forums/Images/smiley_confused.gif)
|
|
|
|
|
What kind of crash it is? Can you post some relevant code fragments?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Have you declared your CFile Object local to your thread or is it a static global object ?
|
|
|
|
|
I'm wrestling a problem that has me stumped.
In a nutshell, here's what happens: if I terminate my program in teh debugger - either becasue of a crash or because I manually stop debugging - it remains in memory. Its main window stays up; I can no longer do builds becasue Windows says the file is on use; and I can't even restart, because my app has code to only allow a single instance to run. Clever me!
When this happens, I have to reboot, and since I'm running Win2K, that's about a 5 minute process. I did learn last night, just through blind luck, that the app will eventually shut itself down on its own, like after about 15 minutes.
I can't terminate the app through Task Manager, either - the mesage I get back says "access denied".
My app is multi-threaded, in that I run a couple threads with to watch for file changes with FindFirstChangeNotification. However, this happens even when I disable those threads.
I've tried using AtExit() to set up a function to be called on shutdown, in an attempt to clean up some stuff of which I am suspicious (my MIDI ports, in particular). However, that does not get called when I shut down in the debugger. So much fdor advice from Usenet.
So the questions are:
1) Any idea what could be causing this sort of hangup?
2) Is there any function I can use that will really be called at shutdown, especially during crashes?
TIA x 10^6
|
|
|
|
|
1) Any idea what could be causing this sort of hangup?
Maybe an automation reference left dangling?
2) Is there any function I can use that will really be called at shutdown, especially during crashes?
I'll go out on a limb and say 'no'... - not for 'Stop Debugging'...
Well, gee that was helpful...
You might want to grep the MSDN for "W32Mar98.exe" - that should get you to a Q&A article by Jeffrey Richter where he discusses enabling the debug priviledge for task manager. The context here is a hung service, but might be worth a try...
|
|
|
|
|
Or, easier, get the PID and use kill.exe to terminate - kill should run with the debug privilege enabled, assuming you are an admin/user who has this privilege.
Check the Microsoft Platform SDK\Bin\Dbg dir if kill.exe is not in your path.
|
|
|
|
|
Thx for the tip - alas, kill doesn't even work!
C:\Microsoft Visual Studio\Platform SDK\Bin\Dbg>kill -f 1420
process PhantomExplorer (1420) - '' could not be killed
So I've got the right process, but it's still unkillable. Will have to look into this deeper. Thanks for the pointers -
|
|
|
|
|
Hmmm... what terrible terrible thing have you done to get yourself into this mess!
"Inquiring minds want to know..."
Well, it could be that the process is being debugged as far as the system is concerned, making it tough to kill, so you might try exiting msdev first (or killing that). Hey, what happens if you try Debug | Attach to process, or try to attach the debugger through task manager?
I think you _should_ have the debug priv if you're an admin on 2000.
What is the mechanism for preventing multiple instances - would it make a diff if you disabled that?
|
|
|
|
|
Got it - I think.
The MIDI ports are not being closed. If I execute the code in such a way as to prevent them from ever being opened, the app will shut down and start up again propelry. If the ports are open when I shut down or crash.. the app won't terminate.
Shee-it. So now all I have to do is figure out how to shut them down after a crash. No big deal - right? (I'm being sarcastic, of course.)
|
|
|
|
|
Is there anyway to force the focus to go to a specific ListView Item after certain action?
I have tried the following after a label edit:
::SetFocus(pDispInfo->hdr.hwndFrom);
but it doesn't seem to work.
Any ideas anyone?
|
|
|
|
|
You can use SetItemState to set the state of the item to LVIS_SELECTED.
|
|
|
|
|
I was wondering if you could search for a string of text in a char variable?
-Matt Newman ![Suspicious | :suss:](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_suss.gif)
|
|
|
|