|
Hello, I am writing an outlook DLL, it is for a phone system and when a call is received I search through the outlook contacts (using called ID) find the person and open the contact in a window.
My problem is that this locks up outlook. When I open the contact under a button, e.g.
void __stdcall CAddin::OnClickButton2(IDispatch* Ctrl,VARIANT_BOOL * CancelDefault)
{
USES_CONVERSION;
CComQIPtr<office::_commandbarbutton> pCommandBarButton(Ctrl);
static Outlook::_InspectorsPtr inspectorsPtr;
static Outlook::_InspectorPtr inspectorPtr;
Outlook::MAPIFolderPtr pFolder = m_spApp->GetNamespace("MAPI")->GetDefaultFolder(olFolderContacts);
Outlook::_ItemsPtr pItems = pFolder->Items;
Outlook::_ContactItemPtr pContact = pItems->GetFirst();
inspectorsPtr= m_spApp->GetInspectors();
inspectorPtr = inspectorsPtr->Add(pContact);
inspectorPtr->Display(vtMissing);
}
This works fine, when I put the same code in my dll, e.g.
static void openContactOnCall(char* number)
{
static Outlook::_InspectorsPtr inspectorsPtr;
static Outlook::_InspectorPtr inspectorPtr;
Outlook::_ContactItemPtr contact = findContact(number);
if (contact)
{
// Contact is valid
inspectorsPtr= m_spApp->GetInspectors();
inspectorPtr = inspectorsPtr->Add(contact);
inspectorPtr->Display(vtMissing);
}
else
Debug("Didn't find contact");
}
A window opens with the contact but outlook then freezes. The contact must be valid as I see the correct name in the windows title bar. I have triggered outlook as it does open the window.
I've hacked around with this for sometime, and haven't got anywhere. I am clearly missing something quite fundamental but the fact the same code works under a button but not in the dll has got me confused, and shows that I do not understand something fundamental to how this should be working. Any help would be greatly appreciated.
Gavin.
|
|
|
|
|
Hi all,
I am partly through creating a console application that runs a Windows app. All this I have managed to perform, but the following I am unsure of.
I now need to bring the form to the current view (which I have achieved), then put the mouse pointer in a certain position then simulate pressing the left mouse button.
Can anyone suggest where I need to start looking to allow me to work this one out ?
Pete
|
|
|
|
|
Fritzables wrote: then put the mouse pointer in a certain position then simulate pressing the left mouse button.
Is mouse_event() of any help here?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
G'Day Dave,
That sounds the GO, but what about getting the Mouse Cursor in the position I want ?
Pete
|
|
|
|
|
i guess the right way would be the SendMessage function. use it with the parameter WM_LBUTTONUP.
walter
|
|
|
|
|
Thanks Walter..... have a look at the reply I shot Dave.
Pete
|
|
|
|
|
I am not sure about a console application.
In Windows the mouse pointer is called a ‘cursor’ and you can set the position by calling SetCursorPos(x,y). Note that if ClipCursor was used to limit its rectangular area of movement then it will remain in that area.
After setting its position you can post the button-down and button-up messages, in that order, to simulate a button press & release.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
Thanks John,
Yep, got the cursor now moving all over the place using the Cursor->Position. I will now concentrate on the mouse clicking now.
Thanks again John.
Pete
|
|
|
|
|
You are welcome,
Just a thought that this may come in handy, if do not have the have the handle to the button and have the handle to the parent then you can call ChildWindowFromPoint to get it. I guess that if you know its coordinates then you already have the handle; anyway I thought I would pass that along.
John
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
Hi friends.. tis is M.V.Nair. I am now doing a program to track the URL(Internet) using MFC and to indicate it to the server in case if any unwanted website is accessed. First pls do tell me can we associate C++ with Internet? Pls do reply if anyone of you know tat friends!!
Malini
|
|
|
|
|
Malini Nair wrote: I am now doing a program to track the URL(Internet) using MFC
you need either knowledge of COM to implement the project or you have to hack through the different browser using FindWindow api to reterieve the website name
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|
|
Malini Nair wrote: using MFC and to indicate it to the server in case if any unwanted website is accessed.
This is best done at the router; anything you can do on the client side can be undone or usurped. The added benefit of doing it at the router is centralized logging.
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
|
|
|
|
|
Hi All,
As per our design my application should launch in the system startup itself.
and also my application require the privilegeg level as "requireAdministrator"
to function proper. So i added one manifest file and in that i mentioned the snippet below
<security>
<requestedprivileges>
<requestedexecutionlevel
level="requireAdministrator"
="" uiaccess="false">
with this everything is fine.
But the problem is that when the system restarts, My Application is geeting blocked,VISTA prompting "Windows has bloked some startup progrsms" this is not expected for my application.
how can i avoid this. i.e how can i start my application in system startup?
Please support me in fixing this problem?
Thanks in Adv,
Are
|
|
|
|
|
You can't, this is by design. Vista won't run an app at startup if running the app would result in a UAC prompt.
|
|
|
|
|
hi,
When I am trying to run the my dll and program use it in release mode it crashs on these lines:
_AFXWIN_INLINE HINSTANCE AFXAPI AfxGetResourceHandle()<br />
<br />
{ ASSERT(afxCurrentResourceHandle != NULL);
in AFXWIN1.inl header
What can be the cause for that ?
It functions perfectly in debug mode.
Thanks,
Ohad
|
|
|
|
|
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.
|
|
|
|
|
You should use the debug dll in Debug mode,and the Release dll in release mode.
|
|
|
|
|
This is what I am doing.....
|
|
|
|
|
Not sure though. I face registration problem in one of my COM dlls in release mode. I found that .rc was excluded accidenlty in release configuration. See, if simlar thing is happening to you.
In addition I recommend you to go through this[^] article.
|
|
|
|
|
I have only one .rc, he create two diffrent files for debug and release (.res).
|
|
|
|
|
prasad_som wrote:
In addition I recommend you to go through this[^] article.
hi,
Happy new year.. i am afraid, this article is no use here!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|
|
ThatsAlok wrote: Happy new year
Thanks. Same to you.
ThatsAlok wrote: i am afraid, this article is no use here!
Atleast, should get idea, what problem may occurs in release, but not in debug build.
|
|
|
|
|
Ohad Cabiri wrote: When I am trying to run the my dll and program use it in release mode it crashs on these lines:
_AFXWIN_INLINE HINSTANCE AFXAPI AfxGetResourceHandle()
{ ASSERT(afxCurrentResourceHandle != NULL);
in AFXWIN1.inl header
How... how you debugged a released mode dll
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|
|
ThatsAlok wrote: How... how you debugged a released mode dll
Possibly , using this[^] technique.
|
|
|
|
|
I have developed a program in which i created the window using HWND hwnd,createwindow(hwnd......
My program looks for usb drive device and if its found message is displayed.Now the problem is if i minimize the window and insert the usb drive i want the window to be maximized automatically like autoplay for usbdrive.How to go about this?How to maximize the window from taskbar?I tried setwindowpos, it works when we click the window.I want to maximize it from the task bar.Thanks in advance
|
|
|
|