Worksheet_SelectionChange event in xla add-in - events

Is to possible to trigger Worksheet_SelectionChange event in xla add-in. I put the code in Worksheet module of add-in. but it did not enter into this module. My target is to set the comment box in the center of active window. I got the code from here. Please help me.

You need to work with Application-level events if you want to capture an event in another workbook. See here

Related

In Outlook Interop, how do I tell if an AppointmentItem has been saved (and not simply closed without saving)?

I have some code that needs to run whenever a user saves or sends an Outlook appointment.
Currently I register a close event to the Inspector and run my code within that event:
((Outlook.InspectorEvents_Event)_inspector).Close += InspectorWrapper_Close;
For the most part this is okay unless the user closes the inspector window without saving their changes. In that case, it is critical that my code does not run.
I have been searching for either a save event to which I can register my appointment or any kind of flag to indicate if the item was actually saved.
The AppointmentItem object has a .Saved property, but it always returns false.
Any help is appreciated.
Use AppointmentItem.Write / AfterWrite events. Keep in mind that Outlook can autosave an appointment.

Is ther an "initialisation complete" function available for an ActiveX?

I'm creating an ActiveX using VS and MFC. Initialisation is done in constructor of my control. There the m_hWND window handle is not valid, it is still NULL.
So: is there some kind of "initialisation complete" function available in COleControl() that is called as soon as m_hWnd is valid and additional controls can be added to it?
Thanks!
It's been a while since I've written an ActiveX control, but, I seem to remember using OnResetState, or, one of the other events shown in the link to handle initialization.
Remember that there are windowless ActiveX controls. For such controls you never get a window handle!
So normally after the creation a ActiveX Control is "initialized", and you can use it.
ActiveX controls usually reside in the same Thread so there is nothing that can run beside your code and do further initialization.
If this doesn't help you Need to refine your question.
See discussion here too about ActiveX controls without a window handle.
I think OnActivate is what you are looking for.

Why is the OnComm event of MSCOMM32.OCX in Access 2003 VBA missing?

I've dropped the VB6 MSCOMM32.OCX (Microsoft Comm Control 6.0 (SP6)) on to a VBA form. I had to apply a Microsoft Security Update KB926857 to VB6 to get the control to drop on the form because a Windows Update set a kill bit on the older version.
When I look at the object's events in VBA I do not have "OnComm" available. I can get it in VB6 by double clicking its icon (a phone) but not in VBA. Importing it in Delphi shows OnComm as the only event handler.
I know the control is registered properly and licensed.
I've done it a couple of years ago with the older control, but has anybody done this lately?
Available Events: OnEnter, OnExit, OnGetFocus, OnLostFocus & OnUpdated
I discovered independently that HK1's suggestion was correct. I created an event handler that looked like this
Private Sub MSComm1_OnComm()
Nothing needed to be done to the object properties to link it to the routine.
In the form load event I placed an MSCOMM1.PortOpen = True. I scanned a bar code and presto it worked.
Why this is treaded differently than other events I do not know and how/where it is documented is a mystery.
This Microsoft site has helpful information on handling the data properly and is what I used for the test.
http://support.microsoft.com/kb/194922

Why are some events not shown in the Visual Studio properties window?

I wanted to add an event for a textbox to handle when it loses focus. I was sure I remembered some sort of LostFocus event, but I didn't see it in the Properties grid. But sure enough, the event exists if I access it programmatically. I'm using VS2008 - any reason why this event (and maybe others?) wasn't shown in the Properties grid?
Control.LostFocus is marked with [BrowsableAttribute(false)]. This means it will not be shown in the Properties window. For details see BrowsableAttribute.
Here's the declaration:
[BrowsableAttribute(false)]
public event EventHandler LostFocus
LostFocus is a troublesome event, this is the fine print from the SDK docs for WM_KILLFOCUS, the underlying Windows message:
While processing this message, do not make any function calls that display or activate a window. This causes the thread to yield control and can cause the application to stop responding to messages. For more information, see Message Deadlocks.
Use the Leave event instead.

Getting screenshot of Child Window

If I have a handle to a window, how do I take a screenshot of any new child windows when they show up? Right now I have code that takes a screenshot every .1 seconds of a windows form. When I click on a drop down list box the subsequent screenshots do not include it. Using spy++ I can see that a new child window was created but not sure how to make sure it is included in my screenshots. Does anybody have any code that might include child windows?
Thanks in advance,
Bob
Yes, the dropdown of a ComboBox is a special window, a LISTBOX. .NET doesn't provide a built-in way to get the handle for it, you can P/Invoke SendMessage and send the CB_GETCOMBOBOXINFO message. COMBOBOXINFO.hwndList contains the handle.
Note that there are other controls that behave that way, DateTimePicker for example. Also note that the window can extend beyond the bounds of your form.
The code in this thread should be helpful to get the P/Invoke right.

Resources