|  Alert(MsgBox in VB) Help? | 
| Author: | 
Message: | 
Hit 
New Member 
 
  
 
Posts: 10 
Joined: Aug 2006 
 | 
O.P.  Alert(MsgBox in VB) Help?
Somebody know how to do a Yes/No alert or msgbox? 
And explain how to use please    
 |   
 | 
| 08-21-2006 05:48 PM | 
 | 
  | 
Eljay 
Elite Member 
     
  
  
:O
  
Posts: 2945 Reputation: 77 
– /   / – 
Joined: May 2004 
 | 
 RE: Alert(MsgBox in VB) Help?
code: var result = Interop.Call('user32', 'MessageBoxW', 0, 'Main message text', 'Title text',4);
  
if yes was selected result will contain 6 
if no was selected result will contain 7  
 |   
 | 
| 08-21-2006 05:58 PM | 
 | 
  | 
KnRd_WC 
Junior Member 
  
  
  
Florian PAQUET
  
Posts: 74 Reputation: 1 
36 /   /   
Joined: Aug 2006 
 | 
 RE: Alert(MsgBox in VB) Help?
Hi Hit !! 
To make a Yes/no msgbox, I will use my Basic knowledge to explain it to you   
code: Val=Interop.Call("User32.dll", "MessageBoxW", WndHandle,'Message','Title', Param); 
 
// WndHandle can set to 0 if MsgBox is not attached to a window 
// Param : 
// 4 = MB_YESNO 
// 
// 16 = MB_ICONERROR 
// 48 = MB_ICONEXCLAMATION 
// 32 = MB_ICONQUESTION 
// 64 = MB_ICONINFORMATION 
// 
// So, if you want a Yes/No MsgBox with an error icon, Param=4|16 
// 
// If Yes button pressed : Val=6 
// If No button pressed : Val=7 
  
  
 |   
 | 
| 08-21-2006 06:05 PM | 
 | 
  | 
Hit 
New Member 
 
  
 
Posts: 10 
Joined: Aug 2006 
 | 
O.P.  RE: Alert(MsgBox in VB) Help?
Whoow thx both   
Fast! 
But is it 
If( val == 6) Then???  
 This post was edited on 08-21-2006 at 06:16 PM by Hit.
 |   
 | 
| 08-21-2006 06:14 PM | 
 | 
  | 
KnRd_WC 
Junior Member 
  
  
  
Florian PAQUET
  
Posts: 74 Reputation: 1 
36 /   /   
Joined: Aug 2006 
 | 
 RE: Alert(MsgBox in VB) Help?
code: var Val=Interop.Call("User32.dll", "MessageBoxW", 0,"Message","Title", 4|32); 
 
if (Val==6) { // Yes 
    // .... 
} 
else if (Val==7) { // No 
    // .... 
} 
  That's your question ? And good answer ?  
 This post was edited on 08-21-2006 at 06:26 PM by KnRd_WC.
 |   
 | 
| 08-21-2006 06:19 PM | 
 | 
  | 
Hit 
New Member 
 
  
 
Posts: 10 
Joined: Aug 2006 
 | 
| 
O.P.  RE: Alert(MsgBox in VB) Help?
 Yes thx it works 
One more question you know how to block something sending 
So if i type something it wont send if you click no 
 |   
 | 
| 08-21-2006 06:28 PM | 
 | 
  | 
KnRd_WC 
Junior Member 
  
  
  
Florian PAQUET
  
Posts: 74 Reputation: 1 
36 /   /   
Joined: Aug 2006 
 | 
 RE: RE: Alert(MsgBox in VB) Help?
quote: Originally posted by Hit 
One more question you know how to block something sending 
So if i type something it wont send if you click no 
  
If you want to send a message to a contact ?? 
Maybe I don't understand (I'm French   ), but... what is "something" ??
 
For ALL messages
 code: function OnEvent_ChatWndSendMessage(ChatWnd,Message) { 
    var Val=Interop.Call("User32.dll", "MessageBoxW", ChatWnd.Handle,"Message","Title", 4|32); 
    if (Val==6) { // Yes 
        return Message; 
    } 
    else if (Val==7) { // No 
        return ""; 
    } 
} 
  
For a DEFINED message
 code: function OnEvent_ChatWndSendMessage(ChatWnd,Message) { 
    if (Message=="MyMessage") { 
        var Val=Interop.Call("User32.dll", "MessageBoxW", ChatWnd.Handle,"Message","Title", 4|32); 
        if (Val==6) { // Yes 
            return Message; 
        } 
        else if (Val==7) { // No 
            return ""; 
        } 
    } 
return Message; 
} 
   
 This post was edited on 08-21-2006 at 06:44 PM by KnRd_WC.
 |   
 | 
| 08-21-2006 06:34 PM | 
 | 
  | 
Matti 
Elite Member 
     
  
  
Script Developer and Helper
  
Posts: 1646 Reputation: 39 
33 /   /   
Joined: Apr 2004 
 | 
 RE: Alert(MsgBox in VB) Help?
You mean, if the user tries to send a message it'll display a box and if the box result is No, it shouldn't send it? 
Very easy, just let it return nothing!   
code: } else if(Val == 7) { 
   return; 
}
  If you use that code in the OnEvent_ChatWndSendMessage function (where I guess it is in), it will return nothing. This is because a ChatWndSendMessage event can return a string to the scripts parser telling what message has to be send.    
 This post was edited on 08-21-2006 at 06:41 PM by Matti.
 |   
 | 
| 08-21-2006 06:38 PM | 
 | 
  | 
Hit 
New Member 
 
  
 
Posts: 10 
Joined: Aug 2006 
 | 
| 
O.P.  RE: Alert(MsgBox in VB) Help?
 thx i finaly done my sure to send project 
If i do return; 
It still sends if i do return ""; message is gone it most stay there  
 This post was edited on 08-21-2006 at 06:46 PM by Hit.
 |   
 | 
| 08-21-2006 06:43 PM | 
 | 
  | 
Matti 
Elite Member 
     
  
  
Script Developer and Helper
  
Posts: 1646 Reputation: 39 
33 /   /   
Joined: Apr 2004 
 | 
 RE: Alert(MsgBox in VB) Help?
quote: Originally posted by Hit 
thx i finaly done my sure to send project 
If i do return; 
It still sends if i do return ""; message is gone it most stay there
  Hmm, strange. I saw scripts just sending nothing with the return... But if that wouldn't work, I suggested you to use return "" anyway.    
 |   
 | 
| 08-21-2006 06:57 PM | 
 | 
  | 
| 
Pages: (2): 
« First
  
 [ 1 ]
 2
 
»
 
Last »
 | 
| 
 |