View previous topic :: View next topic |
Author |
Message |
CodeScript Moderator Team
Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Mon Sep 01, 2003 12:49 pm Post subject: Ability to fire a event in VDS script |
|
|
Ability to fire a event in VDS script.
This can be invaluable if multitasking is ever implemented in far future,(Running the include files/dsu as a seperate thread may be simplest of all ) but even otherwise like for PIPE.
I don't know if it is a good idea or a stupid one.
Code: |
RUN Blah.,PIPE,PIPEEVENT,3
:PIPEEVENT
INFO @PIPE()
GOTO EVLOOP
|
where PIPEEVENT is the name of the event fired on completion and 3 is the timeout duration in seconds. So if wait is not specified then the script will continue as usual immediately after the command/function. When the command is over then an event is fired. If error occurs and nothing returns still the script doesn't freeze because it simply timesout. _________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
Back to top |
|
|
FreezingFire Admin Team
Joined: 23 Jun 2002 Posts: 3508
|
Posted: Mon Sep 01, 2003 2:48 pm Post subject: |
|
|
Actually I'd just like to see the ability to create events/add events to
the event buffer, which is necessary sometimes and cannot be used
with GOTO or GOSUB. _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Mon Sep 08, 2003 2:51 pm Post subject: |
|
|
FreezingFire wrote: | Actually I'd just like to see the ability to create events/add events to
the event buffer, which is necessary sometimes and cannot be used
with GOTO or GOSUB. |
FF,
Gadget has this ability. If you need this ability now please let me know and I will send you a copy of the new version with this ability. But really there is not much of a difference between an event in VDS and a GOTO or GOSUB routine. The routine in Gadget just allows you to fire an event when ever your code wants the event to happen and you actually want your Eventloop to handle this instead of a GOTO or GOSUB. I did this because of the lack of callback functions in VDS and the fact that Gadget's callback functions do not work very well in NT. _________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
FreezingFire Admin Team
Joined: 23 Jun 2002 Posts: 3508
|
Posted: Mon Sep 08, 2003 6:04 pm Post subject: |
|
|
Thanks for the offer Mindpower, but I don't need this right now. I look forward
to the new version of Gadget though and I'll surely check it out when it's
released. _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Mon Sep 08, 2003 6:07 pm Post subject: |
|
|
FF or anyone,
Well that ability is in Gadget now so if you need it before the official release of Gadget let me know. _________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
jules Professional Member
Joined: 14 Sep 2001 Posts: 1043 Location: Cumbria, UK
|
Posted: Fri Sep 12, 2003 8:07 am Post subject: |
|
|
VDS 5 can respond to windows messages using OPTION MSGEVENT. So couldn't you use @sendmsg() to send a message to your own app? _________________ The Tech Pro
www.tech-pro.net |
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Fri Sep 12, 2003 2:23 pm Post subject: |
|
|
jules wrote: | VDS 5 can respond to windows messages using OPTION MSGEVENT. So couldn't you use @sendmsg() to send a message to your own app? |
Yes this would work but you only get 4 MESSAGES I don't know if Jules really understands here. I have and many others have VDS scripts that are thousands of lines long. Actually I just recently tried to wrap the full Win32 API but that did not go over so well. I ran out of memory But the PC I ran it on only had 256megs _________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
Skit3000 Admin Team
Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Fri Sep 12, 2003 3:07 pm Post subject: |
|
|
Can't you send messages like "Eventname|Parameters" ? That way you should be able to parse it out, and use the goto command to go to the right label in your script (just like a real event... ).
Something like this:
Code: |
option msgevent,99,messages
DIALOG CREATE,Nieuw Dialoog,-1,0,240,160
DIALOG SHOW
%z = @sendmsg(@dlgtext(),99,Eventname|par1|par2)
wait 2
:Evloop
wait event
goto @event()
:Eventname
info It worked?
goto Evloop
:Messages
rem Does something like the @receivedmessage() function exist?
parse "%%event;%1;%2;%3;%4;%5;%6;%7;%8;%9",@receivedmessage()
goto %%event
|
_________________ [ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial! |
|
Back to top |
|
|
CodeScript Moderator Team
Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Fri Sep 12, 2003 4:01 pm Post subject: |
|
|
@receivedmessage() should be @MSGPARAMS( <flags> )
Help file doesn't have that in index _________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
Back to top |
|
|
Skit3000 Admin Team
Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Fri Sep 12, 2003 5:20 pm Post subject: |
|
|
Still doesn't work...
Code: | option msgevent,1,messages
DIALOG CREATE,Nieuw Dialoog,-1,0,240,160
DIALOG SHOW
%z = @sendmsg(@winexists(@dlgtext()),1,Eventname|par1|par2)
wait 2
:Evloop
wait event
goto @event()
:Eventname
info It worked?
goto Evloop
:Close
exit
:Messages
parse "%%event;%1;%2;%3;%4;%5;%6;%7;%8;%9",@msgparams()
goto %%event |
_________________ [ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial! |
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Fri Sep 12, 2003 6:51 pm Post subject: |
|
|
Skit and CodeScript,
I cannot get the internal message events to work either:(
I tried everything that I could think of. I moved the option command after the dialog and I set the message ID to a known windows message WM_COMMAND & WM_USER but still nothing. I even tried placing the @sendmsg in a BUTTON event and pass the string by Address but still the message event did not fire _________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
CodeScript Moderator Team
Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Sat Sep 13, 2003 2:48 am Post subject: |
|
|
As far as option msgevent and @MSGPARAMS() are concerned they work as I had implemented in an example adding custom items to system menu.
http://forum.vdsworld.com/viewtopic.php?t=1728
I am having doubts that @sendmsg either is unable to send a custom message or that the message number you are using is conflicting with an existing windows message number.
Mindpower did you try using @LIB() and user32 to directly send the message rather than @sendmsg - You might have already done that ? _________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
Back to top |
|
|
CodeScript Moderator Team
Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Sat Sep 13, 2003 3:36 am Post subject: |
|
|
I think there is aproblem that occurs with the hooking vds does as we use the same thread. So the message dies of after geeting caught in a loop. So sendmessage either @SENDMSG or using user32 fails because both wait for the outcome. I am not an expert but this is my thinking. I may be wrong
So I used PostMessage just to post a message into the que and return. It works here let me know your results mindpower.
Regards
Code: | OPTION MSGEVENT,$1FFF,messages
DIALOG CREATE,Nieuw Dialoog,-1,0,240,160,class testmsg
DIALOG ADD,BUTTON,BUTTON1,29,69,104,40,&Send Message
DIALOG ADD,BUTTON,BUTTON2,76,70,105,41,Stll &Alive ?
DIALOG SHOW
wait 2
:Evloop
wait event
goto @event()
:BUTTON1BUTTON
REM %z = @sendmsg(@winexists(Nieuw Dialoog),$0203,0,0)
LOADLIB USER32
%H = @STRDEL(@WINEXISTS(#testmsg),1,1)
%A = @LIB(USER32,PostMessageA,INT:,%H,$1FFF,300,4500)
FREELIB USER32
goto Evloop
:BUTTON2BUTTON
info I am alive [Not hanged]
goto Evloop
:Close
exit
:Messages
INFO YES!! U SENT the message $1FFF with W parameter @MSGPARAMS(W) and L param @MSGPARAMS(L) to me.@CR()-#testmsg !
goto Evloop |
_________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Sat Sep 13, 2003 1:13 pm Post subject: |
|
|
CodeScript,
Your code above works just fine:-) But take a look at your code with Skit's code added:-( This does not work. This would work with Gadget just fine. Also Gadget has the ability to hook messages too 512 messages at that so Skit you could use Gadget to do what you want. Then again if your going to use Gadget then you would be able to do
Code: | Gadget FireEvent,<Name of Event> |
Below is code that does not work. At least not on Win9x boxes let me know if anyone gets different results. Not the same code using VDS'es built in @SendMsg() did not work either. It actually did not fire the MSGEVENT.
Code: | LOADLIB USER32
OPTION MSGEVENT,$1FFF,messages,HANDLED
DIALOG CREATE,Nieuw Dialoog,-1,0,240,160,class testmsg
DIALOG ADD,BUTTON,BUTTON1,29,69,104,40,&Send Message
DIALOG ADD,BUTTON,BUTTON2,76,70,105,41,Stll &Alive ?
DIALOG SHOW
wait 2
:Evloop
wait event
goto @event()
:BUTTON1BUTTON
rem %z = @sendmsg(@winexists(Nieuw Dialoog),$0203,0,0)
%H = @STRDEL(@WINEXISTS(#testmsg),1,1)
%B = Eventname|par1|par2
%A = @LIB(USER32,PostMessageA,INT:,%H,$1FFF,0,@Addr("%B"))
goto Evloop
:BUTTON2BUTTON
info I am alive [Not hanged]
goto Evloop
:Eventname
info It worked?
goto Evloop
:Messages
%C = @val(@msgparams(L))
Info %C
parse "%%event;%1;%2;%3;%4;%5;%6;%7;%8;%9",%C
goto %%event
:Close
FREELIB USER32
exit
| [/code:1:a7ba7b1179] _________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Sat Sep 13, 2003 1:14 pm Post subject: |
|
|
CodeScript,
Your code above works just fine:-) But take a look at your code with Skit's code added:-( This does not work. This would work with Gadget just fine. Also Gadget has the ability to hook messages too 512 messages at that so Skit you could use Gadget to do what you want. Then again if your going to use Gadget then you would be able to do
Code: | Gadget FireEvent,<Name of Event> |
Below is code that does not work. At least not on Win9x boxes let me know if anyone gets different results. Note the same code using VDS'es built in @SendMsg() did not work either. It actually did not fire the MSGEVENT.
Code: | LOADLIB USER32
OPTION MSGEVENT,$1FFF,messages,HANDLED
DIALOG CREATE,Nieuw Dialoog,-1,0,240,160,class testmsg
DIALOG ADD,BUTTON,BUTTON1,29,69,104,40,&Send Message
DIALOG ADD,BUTTON,BUTTON2,76,70,105,41,Stll &Alive ?
DIALOG SHOW
wait 2
:Evloop
wait event
goto @event()
:BUTTON1BUTTON
rem %z = @sendmsg(@winexists(Nieuw Dialoog),$0203,0,0)
%H = @STRDEL(@WINEXISTS(#testmsg),1,1)
%B = Eventname|par1|par2
%A = @LIB(USER32,PostMessageA,INT:,%H,$1FFF,0,@Addr("%B"))
goto Evloop
:BUTTON2BUTTON
info I am alive [Not hanged]
goto Evloop
:Eventname
info It worked?
goto Evloop
:Messages
%C = @val(@msgparams(L))
Info %C
parse "%%event;%1;%2;%3;%4;%5;%6;%7;%8;%9",%C
goto %%event
:Close
FREELIB USER32
exit
|
_________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|