|
for exam my application is at D:\Work\ATLApplication,
Now i want retrive the drive D, through my ATLapplication
|
|
|
|
|
Don't use NULL as the first argument to GetModuleFileName() .
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
what can i put instead of NULL?
|
|
|
|
|
See here. The handle comes to you in the DllMain() function of your DLL. If you don't have access to DllMain() , you might also be able to use GetModuleHandle() to get the DLL's handle.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi all,
I am working on Outlook Addin using vc++. I am facing problem to the get_Subject or GetSubject method . Please give me the solution for this I have given the code snippet below....
Thanks In Advance..
CComQIPtr<Outlook::_Application>Application; <br />
CComPtr<Outlook::_Explorer>pExplorer; <br />
CComPtr<Outlook::Selection>pSelection; <br />
CComQIPtr<Outlook::_MailItem>pMailItem; <br />
char *str=new char[100]; <br />
IDispatch *pDispatchItem; <br />
CComVariant covIndex;<br />
BSTR subject; <br />
<br />
pExplorer =Application->ActiveExplorer(); <br />
pSelection=pExplorer->GetSelection();<br />
covIndex.vt = VT_I4 ;<br />
covIndex.lVal =1;<br />
pDispatchItem=pSelection->Item(covIndex); pMailItem=reinterpret_cast<_MailItem *>(pDispatchItem); <big>pExplorer->get_Subjet(&subject); <br />
str=_com_util::ConvertBSTRToString(subject);
The secret of life is not enjoyment
but education through experience.
- Swami Vivekananda.
|
|
|
|
|
Most probably the statement pExplorer =Application->ActiveExplorer(); has not succeeded .
Try
if(pExplorer)
pExplorer->get_Subjet(&subject); // exception at this statement
And if the if statement failes , then rewrite the allocation code as
while(pExplorer!=NULL)
{
pExplorer =Application->ActiveExplorer();
}
These problems arise mostly in plugin codes becasue , plugin try to use the default memory allocated for the application to which this plugin is intended (here outloook exe)
redindian
|
|
|
|
|
Thanks For the reply.
dharani wrote: f(pExplorer)
pExplorer->get_Subjet(&subject); // exception at this statement
I am Very Sorry. I wrote the wrong statement in my question, the statement I intended to write is as follows...
pMailItem->get_Subjet(&subject);
But....
pExplorer->GetCaption();
this statment is giving the proper output..
Means there is no problem with pExplorer.
Then what is the the problem with _MailItem even sometimes get_SenderName is giving the output.
Please give me the solution.
Thanks Again for ur Immidiate Reply and Helpful suggestion...
The secret of life is not enjoyment
but education through experience.
- Swami Vivekananda.
|
|
|
|
|
You will have to initialize the CComQIPtr Application pointer with the object from Outlook. What I can assume from your code is that you are not initializing this pointer with the outlook object. How does your application know that it has to get an instance for outlook, so this fails and then when you do something to get the subject it causes an exception to be thrown.
you can also try debugging your application.
Try something like this. I haven't checked the code but it might help you.
CComQIPtr<Outlook::_Application> spApp;
HRESULT hr = spApp.CoCreateInstance(__uuidof(Application));
if (FAILED(hr)){
MessageBox("Unable to instantiate Outlook.","Outlook Error",MB_OK);
return 0;
}
-- modified at 0:30 Friday 10th November, 2006
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Hey friend,
I want to transfer query result from sql to a ComboBox.I derive a class from base class CComboBox.But,when using it in project,breaks when InitDialog at
...
myCombo->AddString(Sql.pData[i]);
...
anybody have solution?
Thank.
mad:
Lee
|
|
|
|
|
hello
What do you do to Sql.pData[i] before callinng AddString() ?
Did you check if there are values in Sql.pData ?
Put a break point there ?
Did you verify if you have called CMyComboxClass *myCombo = new CMyComboxClass() ?
redindian
|
|
|
|
|
How do you create combobox before use?
|
|
|
|
|
I want to register ATL COM DllServer in mFC Application, how can i do it.
I adds the sipport of ATL, and one NEw ATL COM object to my application, now i want to register this object in registry through My application, For example if we create ATL COM wizard application ,ther is a function DllRegisterServer() ....
Plz help me out
|
|
|
|
|
Hi
Use shellexecute(regsvr32,path of dll);
redindian
|
|
|
|
|
Hi look at this example
ShellExecute( NULL, _T("open"), _T("regsvr32"), _T("/s \"") + szFolder + _T("yourATLCOM.dll\""),NULL,SW_HIDE);
redindian
|
|
|
|
|
Thnaks for reply.
What is the fourth argument, szFolder what it is?
|
|
|
|
|
Its path of the folder where your dll is present .
redindian
|
|
|
|
|
how to get the path from which drive our ATL COM application is running,
if i used GetCommandString() it gives default path c:\Windows\explorer.exe
but what i want is, if i am running the application from D drive the path comes as d:\ like FOR MFC Application it works but for ATL COM applications doesn't work...
plz help me out
|
|
|
|
|
hi friend,
you already got an answer for your question, but i am having a suggestion. if you use shell functions , you need to add shell library and its platform dependent. So my idea is you to go for DllRegServer() function which is inside your COM object. Load this function, it will do your job. This method will give you the exact error report. If you use shell , you can’t. And one more thing , This method is not useful for all kind of COM dll’s suppose if you are building a Shell Extension dll, you need to use Shell API o register that dll.
thanks
|
|
|
|
|
use CWebBrowser2::Navigate() to display a web page.
how to know if the page is displayed properly or not?
e.g.
if the page is invalid or user doesn't connect to the internet, the page can not be displayed - in the case, I want to display a local page instead.
|
|
|
|
|
Have a look at the definition of this function and try to work around with the return types if it fails .
redindian
|
|
|
|
|
Check for Navigate_complete or Navigate2_complete and Document_complete.
Hope this will help to get when page downloaded completly.
To get knowledge of error you should check MSDN for IWebBrowser2 control.
First deserve then desire. Let be deserved first.
|
|
|
|
|
who can tell me what's the CALLBACK and give me some simple code. thanks
msn:Flashcutreg@hotmail.com
|
|
|
|
|
A callback is a function that's passed to a method by a function pointer, and which then 'calls back' to provide a hook into some aspect of a functions progress, such as providing details for a progress report.
The MSDN has lots of examples, in functions that use them.
|
|
|
|
|
A Callback is a function of which the Name and Address have been registered in a special list in the excecutable file, so that other processes can access it by name It is essentially a 'Widely Advertised Function'
LateNightsInNewry
|
|
|
|
|