What replaced WM_BNCLICKED - visual-studio-2019

Using this tutorial and translating on the fly to VS2019 IDE. Got to step of "Adding Message Handlers for the Controls" and trying to locate BNCLICKED in Class Wizard Messages tab. I see many other WM_XXXBUTTON... messages but no BNCLICKED. What replaces BNCLICKED?

The WM_XXXBUTTON... message you refer to (such as WM_LBUTTONDOWN) are messages sent when a mouse button does something. For buttons in dialog boxes (and other UI components), the 'message' sent is BN_CLICKED (note the underscore). Technically, this is a notification code rather than a message in its own right, and is sent as the high word of the wParam of a WM_COMMAND message.

Related

How to transmit alert variables by E-mail message

I’m a newbie in AggreGate IoT platform and I’m trying to use its Alerts feature. I need to insert the name of the device that triggered the alert into the email message being sent.
I see some Alert Examples in the documentation but I can’t find the way to extract the context of the current device. I’ve tried to write the Alert Message expression like {env/context} or cell({env/context},"value") but it has no effect.
Please help me to make it work.
You need to send e-mail when Alert rises or deactivates, but with your own subject and message format.
Open "Automatic Corrective Actions" tab
Add action "Execution type" - Rise, "Action" - Send E-mail and click on "Parameters" field.
You should see e-mail sending parameters, such as Recipients, Subject, message, etc. You can write it by yourself or use bindings, in our case we will use bindings.
To get variables from alert we should use an expression for ex. "cell({env/value},"trigger")". This expression will return "Trigger message". You can get any variables that we have in Alert Event (see attached screenshot).
When you get variable value, you can use it with AggreGate expression language. For example, if you get cell({env/value}, "context") it will return context of the device for which this alert was set. You need to get name of this device, using context - you can write expression cell(getVariable(cell({env/value}, "context"),"genericProperties"),"name").

How to pass a filename from a second instance of a program to the main instance?

Let say an instance of my program is running. It has 'File1.My' open (whatever that is).
Now the user double clicks in WinExplorer 'File2.My'. The 'My' extension is associated with my program so, a second instance will start. I use WMCOPYDATA to pass the filename ('File2') from the second instance to the first instance. The first instance will receive the filename load that file. The second instance will closed itself.
My problem is that the WMCOPYDATA message might appear while the first instance is showing a dialog box like "Are you sure you want to save File1 to disk?".
When the message arrives, first instance will load File2 while the dlg box is shown on screen asking about 'File1'.
So, how I handle this??
Maybe by putting the Load(File2) in a queue that I process after the dialog box closes?
Or maybe I should filter from the message queue the WMCopyData when a modal dialog box is open?
Use some kind of flag: if WMCopyDataReceived_Flag then Abort_current_code_after_the_dlgbox
All 3 seems more complicated than necesary.
My problem is that the WMCOPYDATA message might appear while the first instance is showing a dialog box like "Are you sure you want to save File1 to disk?".
When the message arrives, first instance will load File2 while the dlg box is shown on screen asking about 'File1'.
What is wrong with that? The dialog's message loop will still dispatch the WM_COPYDATA message to the correct window message procedure. You should be treating each file individually. Does you app not allow multiple files to be loaded at the same time?
So, how I handle this??
Maybe by putting the Load(File2) in a queue that I process after the dialog box closes?
If you don't want the new file loaded while the dialog is running, then yes, this is what you will have to do. Especially since the user could try to load multiple files (or even the same file multiple times) while the dialog is running.
Otherwise, simply ignore the WM_COPYDATA message altogether while the dialog is running. Perhaps send another message back to the 2nd instance telling it that the WM_COPYDATA message was ignored, so it can then notify the user to try again later. After the 2nd instance sends WM_COPYDATA, make it wait a few seconds before exiting, in case such a reply comes in. Perhaps always send a reply back, either ACK or NACK accordingly, and make the 2nd instance wait for either reply.
Or maybe I should filter from the message queue the WMCopyData when a modal dialog box is open?
No, especially since you don't have access to do that kind of filtering anyway. WM_COPYDATA is a sent message, not a posted message, so the message queue won't ever see it, but performing message retrieval on the message queue will automatically dispatch it.
Use some kind of flag: if WMCopyDataReceived_Flag then Abort_current_code_after_the_dlgbox
I don't even understand what you are trying to do with that.

How to add multiple message validation in only one growl message

I have a p:growl for show message validation, but it shows a growl for each message validation, is there any way to show multiples messages validation in only one message p:growl?
It's just how the growl works. Each message will appear in its own panel. I don't think you can change it unless you develop a custom growl component on your own and put <p:messages> in it :)
As Mr.J4mes has mentioned, it's not a 'add on' function of Growl, you could however get PrimeFaces source and recompile it with your changes/requirements.
GrowlRenderer, puts all of the messages into a JSON object e.g..
{summary:"Successful",detail:"Hello ss",severity:'info'},{summary:"Second Message",detail:"Additional Info Here...",severity:'info'}]});});
Then the grow.js line 32 does a for each loop of 'each mesage', and does a render... using renderMessage on line 50. (may may not change depends fversion you're using)...
basically, you could do several things to fix it, (ie pass in all objects not for each and do it in the renderMessage, or keep as is but just don't end the tags until all messages are finished)..
This is less work than creating your own widget etc, adding a var to the primefaces widget, and conditionally doing this is probably a better option - otherwise you're totlally overwriting the functionality.

Using WM_SETFOCUS and WM_KILLFOCUS

In Delphi, I have two edit boxes and a button.
Edit1 is selected by default. I want to change focus using messages. But if I do as below, it all gets messed up with selection ranges in both edits, caret in the wrong box etc.
The reason I'm using messages is so that I can control focus in an external application. This seems to work, up to a point but clearly, the windows internal state is a bit scrambled. I don't have the source for the external program.
procedure TForm1.Button1Click(Sender: TObject);
begin
PostMessage(edit1.handle,WM_KILLFOCUS,0,0);
PostMessage(edit2.handle,WM_SETFOCUS,0,0);
end;
... So can it be done? Am I missing a message?
WM_SETFOCUS and WM_KILLFOCUS are both notification messages that Windows sends to window handles when they receive and lose input focus, respectively, and you should not post those yourself. Instead, simply call SetFocus(edit2.handle) or edit2.SetFocus() to set the focus.
If for some reason you can't do that synchronously from your button click handler, you can post a custom message to a local message handler in your own form and make the SetFocus call from that message handler.

Oracle Forms - Display message blocks rest of the code execution or message doesn't show

I'm trying to show a message on a form without success.
What I'm doing is: When a new line is clicked, I use the WHEN-NEW-RECORD-INSTANCE to do some verifications and some enabling/disabling on the form and showing up the message. The problem is sometimes it does the enabling/disabling but not the message, then I click another line and it shows the previous message but doesn't do the enabling/disabling...
I've already tried some stuff like:
message('message');
n := Show_alert('message');
with and without SYNCHRONIZE;
I don't think it's the code itself blocking the messages... or I'm missing something...
Does anyone ever had this problem?
Can someone tell me the various options to display messages and their differences?
Thanks.
I managed to fix this using the WHEN-MOUSE-CLICK trigger instead.
I didn't want to use this at first because when I clicked the already selected line it would show the message again but I made some code verification and fixed it.
Someone can close this.
thanks.

Resources