Windows API - Window registration event - winapi

Is there any event function in WinAPI that allows catching window registration moment by it's class name? For exaple trigger event when application starts or create new window.
I've found EVENT_OBJECT_CREATE but it doesn't seem to catch proper event. Any ideas?

Related

Outlook Add-In: AppointmentTimeChanged Event not getting triggered on changing the time of the event

I am trying to listen for any change in timing of the appointment through my Add-In. Here is the code where I am adding the handler.
Office.onReady(function() {
mailboxItem = Office.context.mailbox.item;
console.log("Added event handler");
mailboxItem.addHandlerAsync(Office.EventType.AppointmentTimeChanged, args =>
console.log("AppointmentTimeChanged")
),
args => {
console.log("Listening");
};
});
This however is not working for me.
AppointmentTimeChanged event listener works only till the lifecycle of the add-in. If you are using UI-less add-in functions you will not receive notifications beyond your call to event.completed().
To listen to changes beyond that you will have to listen to change using graph web hooks (https://learn.microsoft.com/en-us/graph/webhooks). This subscription from your backend service will enable you to be notified for event changes even from other clients.
But there is a catch to it, Outlook for MAC does not provide way to listen these changes till the event is sent out. To work around this problem you can use custom properties and listener to changes with these properties. Here is the doc explaining it: https://learn.microsoft.com/en-us/outlook/troubleshoot/calendars/cannot-save-meeting-as-draft-in-outlook-for-mac.

(3D touch) How to open a specific page in the application when the user kill the application?

I'm using 3D Touch and Quick Actions to navigate to "Search" page in my application.
I handle event click Shortcut button at method PerformActionForShortcutItem() of AppDelegate.cs::
public override void PerformActionForShortcutItem(UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler)
{
bool handledShortCutItem = HandleShortCutItem(shortcutItem);
completionHandler(handledShortCutItem);
}
At method HandleShortCutItem(), I send a MessagingCenter to MainPageViewModel.cs:
MessagingCenter.Send(new SearchContactEventMessage(), nameof(SearchContactEventMessage));
At method Initialize() of MainPageViewModel.cs, I subscribe the above MessagingCenter:
MessagingCenter.Subscribe<SearchContactEventMessage>(this, nameof(SearchContactEventMessage), message =>
{
// TODO Open page Search in my app
.....
}
It's work (can open "search" page) when my app is running foreground or background.
If my app don't open or user kill it, "Search" page couldn't be showed.
Can give me an idea when user "kill" app and they use "Quick Actions", my application can show a certain page in the application.
Cause:
Once you click and send the MessagingCenter when user "kill" app, in you MainPageViewModel.cs, it has not subscribe the MessagingCenter because your app is terminated. So, it won't receive the MessagingCenter and Open page Search in your app.
Solution:
I would suggest you open search page directly in the handledShortCutItem method.

uiless action in Outlook add-in with displayDialog()

We are seeing a change in Outlook with one of actions (“Help”) that stopped working on the web client only.
This action simply calls a js that opens a web page in a displayDialog() but it’s uiless in the sense that there’s no pane.
The other action (“Sign”) works ok but it launches a pane that does this.
Both of them work fine on the rich client (at least the version I use).
I wonder if there has been in recent changes in the requirements or the way this works?
We’re not seeing any error messages, just nothing happens after the prompt saying that the add-in is doing something.
We did some initial testing and noticed that in chrome the dialog will sometimes appear briefly. Could you confirm that you are calling event.completed() in the eventhandler of EventType.DialogEventReceived? event.completed() must be called in the DialogEventReceived handler otherwise the dialog will be closed prematurely.
Office.context.ui.displayDialogAsync(url, dialogOptions, function(result) {
// In the callback, save the dialog object
dialog = result.value;
// Add an event handler for messages sent via messageParent
dialog.addEventHandler(Microsoft.Office.WebExtension.EventType.DialogMessageReceived, receiveMessage);
// Add an event handler for events from the platform (like closing the dialog, etc.)
dialog.addEventHandler(Microsoft.Office.WebExtension.EventType.DialogEventReceived, dialogClosed);
});

Callback or completion event for Ti.Platform.openUrl or Ti.App.fireEvent

Does anyone know a way of finding out precisely when either a Ti.Platform.openUrl or Ti.App.fireEvent finishes? Something like a callback or an completion event? Thanks.
Nathan
App-level events are global to your app. They are accessible in all contexts, functional scopes, CommonJS modules, and so forth. You can fire them and listen for them via the Ti.App module as follows.
//Creating an app level custom event
Ti.App.addEventListener('myAppEvent', myCallBack);
//Fire the event like
Ti.App.fireEvent('myAppEvent');
//Callback function of your custom event
function myCallBack(e){
alert("In call back. App level event get fired!!!");
}
Please refer Event handling in Titanium for more details

Show a Dialog Box from non event thread

I need to show a Dialog box, from an app started via an alternate entry point, when a push message arrives.
To do this I need to create an Application instance from the alternate entry point and listen for incoming push.
The problem is when I extend my application class from UiApplication, and call enterEventDispatcher() from the alternate entry point it shows an application icon in running applications forever.
I need to listen for push messages and alert user by a dialog without having an application icon.
So is there any way I can show a dialog from an alternate entry point without a UI event thread?
You can use global dialog. Just use this code.
synchronized (Application.getEventLock()) {
UiEngine ui = Ui.getUiEngine();
Screen screen = new Dialog(Dialog.D_OK, "Look out!!!", Dialog.OK,
Bitmap.getPredefinedBitmap(Bitmap.EXCLAMATION),
Manager.VERTICAL_SCROLL);
ui.pushGlobalScreen(screen, 1, UiEngine.GLOBAL_QUEUE);
}

Resources