I have created my own Excel reader which opens and reads the compound files using the ISorage and IStream classes. Everything works perfectly, but I would like to make it a little more user friendly. Here is the code used to open the file:
MultiByteToWideChar(CP_ACP, 0, filename, strlen(filename)+1, wcFilename, 1024);
IStorage *pStorage = NULL;
IStream *pStream = NULL;
// Open the document as an OLE compound document.
hr = ::StgOpenStorage(wcFilename, NULL, STGM_READ|STGM_SHARE_EXCLUSIVE , NULL, 0, &pStorage);
When you try to open an excel file with MS Excel, and the file is already in use, it opens it as read only. I want to add the same functionality to my code, but so far I have been unable to. StgOpenStorage always returns with the 'File unavailable' (locked) error. Does anybody know of a method of doing this?
When you try to open an excel file with MS Excel, and the file is already in use, it opens it as re
Ehm, remove the STGM_SHARE_EXCLUSIVE flag. You're telling StgOpenStorage to open the file as read only, but you don't want to share it with anyone. Since the file is already open, you obviously can't be granted exclusive access to it.
I have tried a variation of just about all the flags, none of which work. The STG_E_SHAREVIOLATION is returned for each. After spending quite some time searching the web for an answer I have concluded that there isn't one. However, I am going to try copying the file to the temp directory and opening it from there. This app is a simple reader, the file would not be modified in any way at all.
I have a problem regarding keyboard navigation in child controls of dialog boxes. I have mentioned the style of the child controls to Tab stop while desining the dialog boxes . It works fine when I test the dialog boxes from Layout->Test menu option in Developer Studtio. But when i run the program the keyboard navigation does not work.
Can any one tell me the solution?
If you create your dialogs using the DialogBox API then there is nothing further to do. However if you have modeless dialogs (CreateDialog API) then you need the IsDialogMessage API in you main-message loop.
I've had this happen when trying to add OLE automation support after my project was already created.
I had to use the GUID generator tool, to create a GUID in the IMPLEMENT_OLECREATE format and place something like the following in my Application implementation file. Your needs may be slightly different but maybe this'll help you work out the details. For what it's worth...
Could someone please show me how to insert data to a number field in an access database. I am using ADO with safe arrays. I can insert and retrieve strings but havent got the hang of working with numbers and boolean data.
Currently I am using the LVN_ITEMCHANGED notification message to update some controls containing data related to the items selected in the a list control. The problem is that since LVN_ITEMCHANGED gets called for every item that changes state even if they all change state at the same time, say 100 items get deselected at once, it makes the processing very slow.
My question is: do list controls send some kind of message notifying the parent of when they're going to start to select/deselect multiple items (I haven't found any such notifications) or what would be the best method of implementing this type of behavior?
Thanks for your reply. I wasn't clear enough in my original post.
Let's say 50 items are deselected at the same time by clicking on the list view outside of an item. The list view sends notifications for every single item thats deselected. I was wondering if there was a way to know when all 50 items have been deselected, instead of processing each one independently. I suppose the only way to do this is to manually handle mouse and keyboard messages...