For starters remove the ; at the end of Wnd.Close(7) if you want to use the short form.
If you write IF THEN ELSE code in that way, thus seperated over multiple lines, remember that all those lines are actually always seen as 1 command line. But ; donates the end of a command line. So, it is a small syntax error, which can confuse the interpreter in some cases. It isn't realy 
wrong wrong in this case though since the interpreter is smart enough to interpret it properly in this particular case, but just be aware of it that it shouldn't be there.
But the real fault is in your 
Else syntax.
As you said so yourself, it should be IF THEN ELSE or IF THEN ELSEIF. But what you did is a IF THEN ELSEIF but without the IF.
Even in a language like Visual Basic (I assume you're used to that seeing that you said "
if/then/else/elseif"), you need an 
IF codeword if you want to compare something else on the 
Else line:
code:
If ControlId = "BtnNo" Then
     CloseWindow Wnd, 7
ElseIF ControlId = "BtnYes" Then
     LockWorkStation "", "N"
End If
Thus what you actually wrote is (in Visual Basic terms):
vb code:
Function OnWndLockEvent_CtrlClicked(Wnd, ControlId)
     If ControlId = "BtnNo" Then
          CloseWindow Wnd, 7
     Else
          ControlId = "BtnYes"
     End If
     LockWorkStation "", "N"
End Function
Or  (in J(ava)Script Terms):
js code:
function OnWndLockEvent_CtrlClicked(Wnd, ControlId)
{
        if (ControlId == "BtnNo") { 
                 Wnd.Close(7);
        } else {
                 ControlId == "BtnYes";
        }
        Interop.Call("User32.dll", "LockWorkStation", "", "N");
}
Hence your 
unexpected (but logical) behaviour.
Hence also my suggestion to always use brackets { } and not trying to shorten stuff, especially when debugging.
(this is a good example and exactly the reason why I did not agree with Eljay's comment here.)
Also, J(ava)Script doesn't have an ELSEIF statement. If you want to do an ELSEIF you actually must do another IF inside the first ELSE.
Thus either (in short form):
js code:
if(ControlId == "BtnNo")
     Wnd.Close(7)     
else if(ControlId == "BtnYes")
     Interop.Call("User32.dll", "LockWorkStation", "", "N");
Or either (in longer form):
js code:
if(ControlId == "BtnNo") {
     Wnd.Close(7)
} else if(ControlId == "BtnYes") {
     Interop.Call("User32.dll", "LockWorkStation", "", "N")
}
which is a shorter form of:
js code:
if(ControlId == "BtnNo") {
     Wnd.Close(7)
} else {
     if(ControlId == "BtnYes") {
          Interop.Call("User32.dll", "LockWorkStation", "", "N")
     }
}
quote:
Originally posted by dfnkt
Is that really considered good to to say:
If(blah)
   blah
If(blah2)
  blah
I've just always been accustomed to doing if/then/else/elseif type of a flow.
For stuff like this, where there are only 2 things to compare the 
ControlId to, it depends on what you're used to. All forms are considered 
good, as long as you don't make any errors in the syntax of course 
 
Just remember that using multiple 
IF's is 'slower' than using the 
IF ELSE(IF) structure. This because in the first, all 
IF's will be executed and compared for a possible match, while in the later only the 
IF's and 
ELSE's up to a match will be executed.
Either way, if there are many more things to compare 
ControlId to, then you could consider using a 
switch structure (equivalent of the 
Select Case statement in Visual Basic).