|
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"
|
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
Well, depending on what you mean, yes:
CString::Find()
or maybe
strstr()
|
|
|
|
|
Ok, I was hoping to use the char format but I guess I can convert it.
-Matt Newman
|
|
|
|
|
See, that's what I meant when I said "depending on what you mean".
You can't search a char for a string. A char is one char. A string is many. What you apparently want to do is search a string - an array of chars - for a string. In that case, you want strstr().
|
|
|
|
|
strchr(yourstring, ch) will do this. Or, if you prefer STL lifestyle, std::string::find.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi all,
I have a situation where I wish to pass a NULL to a varchar(200) parameter
of an SQL Server stored procedure using ADO and Visual C++.
I have tried various things, but with no success.
Anybody done this before?
Thanks,
Bob.
|
|
|
|
|
you can try
variant_t vtNull;
vtNull.ChangeType(VT_NULL);
and pass that. There is no constructor to make a variant NULL from the
start.
Also make sure the size parameter is 200 as your varchar is defined with a length of 200.
|
|
|
|
|
What is the difference between C and Pascal calling convention ? I have heard that pascal calling convention saves bytes - Is it true ? IF true how ?
|
|
|
|
|
The C calling convention puts the parameters on the stack from right to left, this allows the C calling convention to have an limitless parameter list like in the printf function. The caller pops parameters from the stack.
The pascal calling convention is obsolete in WIN32, but it passes its parameters from left to right.
I am not sure, but I believe that the callee pops parameters from the stack frame.
|
|
|
|
|
The pascal (stdcall) calling convention is not obsolete in Win32. Most of the Win32 API uses it. Is has various macros to describe it such as WINAPI, CALLBACK, APIPRIVATE, PASCAL, and IMAGEAPI. It is used for two reasons : first so that multiple programming languages can be supported and second because M$ claims that it is slightly more efficient. Whatever.
You are right that the callee fixes the stack. This is done by adding the number of bytes that were pushed back to ESP.
BTW: I actually do have something that resembles a life but I have spent lots of time reading .cod listings.
|
|
|
|
|
I wrote a little article on calling conventions. However, you won't find anything about Pascal calling convention. It was replaced by stdcall in Win32
I vote pro drink
|
|
|
|