|
Hi,
SheetCalculate function is getting fired whenever there is change in function(like =sum(A1,A2)) related Excel workbook cells. My aim is to get the function result in excel. To get that I'm trying by calling different functions of iDispatch. But couldn't able to get the expected result. Please guide me to read the function result. Thanks in advance.
_ATL_FUNC_INFO SheetCalculateInfo = { CC_CDECL, VT_EMPTY, 1, { VT_DISPATCH } };
BEGIN_SINK_MAP(ExcelBookEventHandler)
SINK_ENTRY_INFO(1, __uuidof(Excel::WorkbookEvents), 0x0000061b, &ExcelBookEventHandler::SheetCalculate, &SheetCalculateInfo)
END_SINK_MAP()
void _stdcall SheetCalculate(IDispatch *iDispatch)
{
////////////*******GetIDsOfNames*******////////////
static DISPID dispid = 0;
wchar_t *ucName = L"Evaluate"; //I tried by giving "Run" and "Calculate" values in place of "Evaluate"
HRESULT result = iDispatch->GetIDsOfNames(IID_NULL, &ucName, 1,LOCALE_SYSTEM_DEFAULT, &dispid);
////////////*******Invoke*******////////////
VARIANT varResult;
DISPID dispid;
DISPID dispidNamed = DISPATCH_METHOD;
EXCEPINFO excep;
UINT uArgErr;
DISPPARAMS dispparams;
dispparams.cNamedArgs = 0;
dispparams.cArgs = 2;
dispparams.rgdispidNamedArgs = &dispidNamed;
HRESULT result = iDispatch->Invoke( odispid, IID_NULL, LOCALE_SYSTEM_DEFAULT,
DISPATCH_METHOD, &dispparams, &varResult, &excep, &uArgErr);
////////////*******GetTypeInfo*******////////////
ITypeInfo* pTypeInfo;
HRESULT result= iDispatch->GetTypeInfo(0,LOCALE_SYSTEM_DEFAULT,&pTypeInfo);
////////////*******GetTypeInfoCount*******////////////
UINT pct1;
HRESULT result= iDispatch->GetTypeInfoCount(&pct1);
////////////*******QueryInterface*******////////////
HRESULT result = iDispatch->QueryInterface(IID_IDispatch,(void**)&iDispatch);
}
|
|
|
|
|
hi
i have little bit problem in how to get folder path ??
UpdateData();
CFile __file;
CFileDialog __FileDialog(true,"*.*",NULL,OFN_EXPLORER,"All Files : (*.*)|*.*||");
if (__FileDialog.DoModal() == IDOK)
{
if( __file.Open(__FileDialog.GetFileName(), CFile::modeRead) == FALSE )
return;
<big>CArchive ar(&__file, CArchive::load);</big>
}
__file.Close();
UpdateData(true);
here output is : D:\2009\October\Visual Studio Projects\visual\centerI.TIF
but i need save this file path :
D:\2009\October\Visual Studio Projects\visual\
please how to get folder path ?
Thanks
|
|
|
|
|
raju_Code wrote: please how to get folder path ?
__FileDialog.GetFolderPath()
|
|
|
|
|
Thanks for your response Mr.Naveen
its throwing exception ..
when comes __FileDialog.DoModel()
its open's system dialog its having Open and Cancel button
i need Save and Cancel button //
Thanks
|
|
|
|
|
raju_Code wrote: i need Save and Cancel button //
Read some documentation[^]
|
|
|
|
|
i think its not possible na?
|
|
|
|
|
Pass the first parameter to the CFileDialog constructor as "FALSE". Then you will get "save as" dialog.
|
|
|
|
|
Thanks naveen ..
i finished from SHBrowseForFolder APIs ..
now its working
Thanks for your proper response
|
|
|
|
|
raju_Code wrote: i need Save and Cancel button //
You need them for what?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi,
You can make use of _splitpath() after getting the complete path to the file.
Regards,
Suku PK
|
|
|
|
|
raju_Code wrote:
here output is : D:\2009\October\Visual Studio Projects\visual\centerI.TIF
but i need save this file path :
D:\2009\October\Visual Studio Projects\visual\
please how to get folder path ?
Use PathRemoveFileSpec() .
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
how can I write a code for scanning harmful USB devices in a good programming language and with a good GUI.I have a database for the viruses
so when the USB device is connected the software will look up for in the list and if there is a virus tehn it will prompt the user.
|
|
|
|
|
Scanning USB devices is easy enough. How would your code know whether they were harmful?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Dear Expert,
How to create visual c++ project using ADSI
|
|
|
|
|
What about documentation [^]?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hey, I know this has been asked many times, and I've researched several solutions like atod etc,
here are some bits from my code.
CString line;
chkfile.ReadString(line)
CString token;
token = line.Tokenize(_T(" "),v);
TRACE(L"token %s\n",token);
TRACE(L"converted %d\n",_tstof(token));
chkfile is a CStdioFile.
the TRACE reads something like
token 66
converted 0
Why is always returning error code 0?
Thanks
soong
|
|
|
|
|
soongez wrote: TRACE(L"converted %d\n",_tstof(token));
%d expects an integer type
_tstof returns a double
Try with %f or %g or somesuch instead of %d.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
soongez wrote: TRACE(L"converted %d\n",_tstof(token));
Wait, so you already have your double in a string but you first want to convert to a float and then back to a string... Why don't use the string directly ?
|
|
|
|
|
Thanks the %f worked, but I used _tstof because the other double converters would give me errors such as cannot convert CString to char* because 'line' was a CString and I couldn't change it to char* when using ReadLine. I'm still pretty poor in using pointers etc.
The TRACE is just to test if the output is correct, it will be used somewhere else later in the program.
cheers.
|
|
|
|
|
Hi all,
I have created a dialog box with blue background color. i want to change the background color of message box too in that dialog.How to add background image to a message box?
Thanks,
|
|
|
|
|
AFAIK you cannot do that with standartd message boxes: you've to roll your own version of.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Of course you can !
simply subclass it
|
|
|
|
|
How do you 'subclass' the MessageBox function?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Do you need to handle the WM_CTLCOLORDLG message?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Do you mean message box as in MessageBox(), or message box as in an IDC_STATIC text control?
|
|
|
|