|
|
DanYELL wrote: From CDoc, how can I get a handle on the
active document.
What's wrong with calling AfxGetMainWnd() , which is a global function, followed by GetActiveDocument() ?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hello. - Does anyone out there know of a GPRS API for C++.
Thankyou
|
|
|
|
|
flippydeflippydebop wrote: Does anyone out there know of a GPRS API for C++.
See here.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Ahh, nice 1.. thanks Dave... I will have a look into that now
|
|
|
|
|
question: Can i use the eMbedded Visual C++ 4.0 Sample with Visual C++ Studio 6?
|
|
|
|
|
I do not know. Why not try it and see?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
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:
WCHAR wcFilename[1024];
MultiByteToWideChar(CP_ACP, 0, filename, strlen(filename)+1, wcFilename, 1024);
IStorage *pStorage = NULL;
IStream *pStream = NULL;
HRESULT hr;
hr = ::StgOpenStorage(wcFilename, NULL, STGM_READ|STGM_SHARE_EXCLUSIVE , NULL, 0, &pStorage);
if(FAILED(hr)) {
return 0;
}
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?
|
|
|
|
|
waldermort wrote: 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.
--
The Show That Watches Back
|
|
|
|
|
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.
|
|
|
|
|
Creating a temp copy of the file seems to work. For anybody with a similar problem here is the modified code:
if(FAILED(hr)) {
if(hr == STG_E_SHAREVIOLATION ) {
char tmpPath[MAX_PATH];
char tmpName[MAX_PATH];
GetTempPath(MAX_PATH,tmpPath);
GetTempFileName(tmpPath,"TMP",0,tmpName);
if (!CopyFile(filename,tmpName,FALSE) )
return 0;
MultiByteToWideChar(CP_ACP, 0, tmpName, strlen(filename)+1, wcFilename, 1024);
hr = ::StgOpenStorage(wcFilename, NULL, STGM_READ|STGM_SHARE_EXCLUSIVE , NULL, 0, &pStorage);
if(FAILED(hr))
return 0;
}
else
return 0;
}
|
|
|
|
|
waldermort wrote: Everything works perfectly, but
If I had a nickel for every time somebody said that in this forum...;P
|
|
|
|
|
Does StgOpenStorageEx() work any better?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
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.
|
|
|
|
|
Hi,
I'm trying to program a custom control using VS2005 MFC AppWizard.
The framework code built by the wizard produces several errors, when I try to built it:
for instance:
IMPLEMENT_OLETYPELIB(CEchoCtrl, _tlid, _wVerMajor, _wVerMinor)
error C2065: '_tlid' : undeclared identifier
error C2065: '_wVerMajor' : undeclared identifier
error C2065: '_wVerMinor' : undeclared identifier
Any ideas how to fix this bug?
Thanks a lot in advance.
Matthias
|
|
|
|
|
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...
// {EF6B41DD-E766-45d8-B731-5923AF4B105A}
const GUID CDECL BASED_CODE _tlid =
{ 0xef6b41dd, 0xe766, 0x45d8, 0xb7, 0x31, 0x59, 0x23, 0xaf, 0x4b, 0x10, 0x5a } };
const WORD _wVerMajor = 1;
const WORD _wVerMinor = 0;
|
|
|
|
|
Hi,
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.
Thanks
|
|
|
|
|
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 in advance.
|
|
|
|
|
_johan wrote: do list controls send some kind of message notifying the parent of when they're going to start to select/deselect multiple items
Do you mean LVN_ITEMCHANGING ?
_johan wrote: ...what would be the best method of implementing this type of behavior?
After each item has been selected, why not just iterate through each one using:
POSITION pos = m_list.GetFirstSelectedItemPosition();
while (pos != NULL)
{
int nItem = m_list->GetNextSelectedItem(pos);
}
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
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...
|
|
|
|
|
If change bk color of CPropertySheet and CPropertyPage by OnCtrlColor(), the CTabCtrl's bk color is not changed.
how to change bk color of CTabCtrl which is used by CRropertySheet?
|
|
|
|
|
Hi All,
Please briefly explin the difference between the CList and CArray.
regards
Mohan.
-Mohan-
|
|
|
|
|
CArray is a sequentially allocated chunk of memory containing a series of objects. It is comparable to a standard C++ array, but resizeable (and with some helper functions.)
CList is a double linked list of objects. For all intents and purposes each object is placed in a container with a pointer to the previous object and one to the next.
Interestingly, I've actually never used a CList in a commercial program, though I've used single linked lists many times.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|