forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Request For Comment (RFC): VDS Extensions for VDS
Goto page 1, 2  Next
 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript Open Source Projects
View previous topic :: View next topic  
Author Message
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 762
Location: Rockeledge, GA

PostPosted: Sun May 08, 2011 3:53 pm    Post subject: Request For Comment (RFC): VDS Extensions for VDS Reply with quote

[new-tsr] updated 4/20/2021
xapp.exe
Code:

#include tsrdll.dsu
DIALOG CREATE,New Dialog,-1,0,240,160
REM *** Modified by Dialog Designer on 4/20/2021 - 11:48 ***
  DIALOG ADD,EDIT,EDIT1,41,51,,,beans,,exit
  DIALOG ADD,EDIT,EDIT2,71,51
  DIALOG SHOW
 
#instance 1
%%xdll = @rundll(xdll.dll)
#instance 2
%%xdll2 = @rundll(xdll.dll)

:evloop
wait event
goto @event()

:edit1exit
info @senddll(%%xdll,"add,1,2")
info @senddll(%%xdll2,"subtract,2,1")
info @dlgtext(edit1)
goto evloop

:close
unloaddll %%xdll
unloaddll %%xdll2
exit


xdll.dll
Use project manager to set file specs like an EXE. Make sure to change original file name from exe to dll. Compile as exe, rename file to dll. Do not compile as dsu.
Code:

#include tsrdll.dsu
initdll %1

#%a is event. %b..%i are the parameters. %%getdll contains entire command string.
:add
return %1,@fadd(%b,%c)
exit

:subtract
return %1,@fsub(%b,%c)
exit


tsrdll.dsu
Code:

#must be space here.
#define function,rundll
#define function,senddll
#define command,return
#define function,getdll
#define command,initdll
#define command,unloaddll
#define command,listen
exit

:unloaddll
window settext,%1,unload
exit

:rundll
if @equal(%%dllinit,true)
runh %1 %%dllmsgw %2 %3 %4 %5 %6 %7 %8 %9
goto dllresponder
else
%%dllinit = true
DIALOG CREATE,$
dialog add,edit,dllmsg,0,0,0,0,,,multi
%%dllmsgw = @winexists(~dllmsg)
dialog disable,dllmsg
dialog select,0
runh %1 %%dllmsgw %2 %3 %4 %5 %6 %7 %8 %9
rem bake me a cake as fast as you can.
:dllresponder
OPTION SLEEPTIME,1
rem wait for message to be received.
repeat
wait 0
until @wintext(%%dllmsgw)
%%dllmsg = @wintext(%%dllmsgw)
window settext,%%dllmsgw,""
rem ok kitchen staff is worn out.
OPTION SLEEPTIME,50
end
exit %%dllmsg

:initdll
DIALOG CREATE,$
dialog add,edit,dllmsg,0,0,0,0,,,multi
%%dllmsgw = @winexists(~dllmsg)
dialog disable,dllmsg
return %1,%%dllmsgw
goto listen

:getdll
OPTION SLEEPTIME,1
rem wait for message to be received.
repeat
wait 0
until @wintext(%%dllmsgw)
%%dllmsg = @wintext(%%dllmsgw)
window settext,%%dllmsgw,""
rem ok kitchen staff is worn out.
OPTION SLEEPTIME,50
exit %%dllmsg

:return
window settext,%1,%2
exit

:senddll
window settext,%1,%2
OPTION SLEEPTIME,1
rem wait for message to be received.
repeat
wait 0
until @wintext(%%dllmsgw)
%%dllmsg = @wintext(%%dllmsgw)
window settext,%%dllmsgw,""
rem ok kitchen staff is worn out.
OPTION SLEEPTIME,50
exit %%dllmsg

:listen
%%fieldsep = @fsep()
option fieldsep,","
%%getdll = @getdll()
parse "%a;%b;%c;%d;%e;%f;%g;%h;%i",%%getdll
option fieldsep,%%fieldsep
gosub %a
goto listen

:unload
stop

[/new-tsr]

[new-nontsr] Updated 5/7/2021 Supported. Specify non-tsr if asking for help.
xapp.exe
Code:

#include dll.dsu
info @rundll(xdll.dll,@chr(34)Hello@cr()World@chr(34))


xdll.dll
Use project manager to set file specs like an EXE. Make sure to change original file name from exe to dll. Compile as exe, rename file to dll. Do not compile as dsu.
Code:

#include dll.dsu
return %1,%2


dll.dsu
Code:

#must be space here.
#define function,rundll
#define command,return
exit

:rundll
DIALOG CREATE,hidden,,,,,,
dialog add,edit,dllmsg,0,0,0,0,,,multi
dialog disable,dllmsg
runh %1 @winexists(~dllmsg) %2 %3 %4 %5 %6 %7 %8 %9
rem bake me a cake as fast as you can.
OPTION SLEEPTIME,1
rem wait for message to be received.
repeat
wait 0
until @dlgtext(dllmsg)
%%dllmsg = @dlgtext(dllmsg)
dialog close
%%toss = @event()
rem ok kitchen staff is worn out.
OPTION SLEEPTIME,50
exit %%dllmsg

:return
window settext,%1,%2
exit


[/new-nontsr]

UNSUPPORTED
[old]
<ramble>
"WAIT! Wha? What is with you and these 'RFC's?"
Individuality is beautiful, but cooperation is powerful. If we can start using standards to get some basic things done, then we will be much better off as a community. Also I need a semi-permanent way to solidify my ramblings, if I don't hold myself accountable by making statements then I keep on doing the same thing various ways...recreating the wheel over and over again. This is helping me at the least, and possibly could help the entire community.
</ramble>

The general purpose behind this project is to allow a standard for extensions to be built within VDS for other VDS programs. Created extensions need not be ingenious in nature, only reusable and useful (the goal is to not recreate the wheel).

As we know, VDS doesn't actually allow you to make extensions. DSU's are neat, but ultimately get built into your executable and cannot be placed in the SYSWOW64 or System32 directory for others to reuse. Another problem I have is credit. There is no way to get credit for others using your DSU in a redistributable. <not in Vista, 7>With a extension people can check the property details and discover author, version, create date, etc.</not in Vista, 7>. For later operating systems an About entry is placed into the registry for users to obtain information on the extension.

The concept behind a extension is simple, you place input into another file and receive output, basically file communication.

With WebWrite Pro 3, I used .ini files for this. Believe it or not, this worked astonishingly well; however I feel I may have improved upon this method. I'm mentioning this as a form of proof of concept: VDS can build executables that can effectively communicate to each other through various means.

The message receiver element is to be passed as the first parameter to the extension.

The extension will operate from %1-%9 passed to it from the run command, then send the result back to the receiving window.

NOTE: When you compile the extension it must be as EXE and not VDSX. If you try VDSX it uses the DSU protocol, which will not work. You have to rename the EXE to VDSX.

Certain registry entries must exists for the extension to work.
Install/Uninstall commands, credit to Liquidcode
Code:

#Define Command,VDSXInstall,VDSXUninstall
:VDSXInstall
registry write,HCR,.VDSX,,vdsxfile
registry write,HCR,.VDSX,Content Type,application/x-msdownload
registry write,HCR,vdsxfile\DefaultIcon,,"%1"
registry write,HCR,vdsxfile\Shell\Open\Command,,@chr(34)"%1"@chr(34)" %*"
registry write,HCR,vdsxfile\Shell\About\Command,,@chr(34)"%1"@chr(34)" About"
registry write,HCR,vdsxfile\Shell\RunAs\Command,,@chr(34)"%1"@chr(34)" %*"
#refresh Icons to show changes
loadlib shell32.dll
%x = @lib(shell32, SHChangeNotify, INT:, $8000000, 0, 0, 0)
freelib shell32.dll
 exit
 
:VDSXUninstall
Registry delete,HCR,.VDSX
Registry delete,HCR,vdsxfile
#refresh Icons to show changes
loadlib shell32.dll
%x = @lib(shell32, SHChangeNotify, INT:, $8000000, 0, 0, 0)
freelib shell32.dll
exit


xapp.exe
Code:

DIALOG CREATE,New Dialog,-1,0,240,160
REM *** Modified by Dialog Designer on 5/8/2011 - 10:59 ***
  DIALOG ADD,BITBTN,BITBTN1,41,61
  DIALOG ADD,BUTTON,BUTTON1,83,195,,,BUTTON1
  DIALOG ADD,LIST,LIST1,111,43
  DIALOG ADD,BITCOMBO,BITCOMBO1,30,224
  DIALOG ADD,CHECK,CHECK1,92,30,,,CHECK1
  rem EDIT1 is my message reciever. It is multi line so it can get arrays returned from extensions or single line returns.
    DIALOG ADD,EDIT,EDIT1,0,0,0,0,,,multi
  rem disable it. We aren't using sendkeys nor should we.
  dialog disable,edit1
DIALOG SHOW
rem @cr() does not work properly. Not sure why.
run xdll.vdsx @winexists(~edit1) @chr(34)Hello@chr(13)@chr(10)World!@chr(34)
rem bake me a cake as fast as you can.
OPTION SLEEPTIME,1
rem wait for message to be received.
repeat
wait 0
until @dlgtext(edit1)
rem ok kitchen staff is worn out.
OPTION SLEEPTIME,50
info @dlgtext(edit1)
rem variable utilized, clear the receiver for the next message.
dialog clear,edit1
wait event


Uncommented code for clarity, here's the call/code to know.

Code:

run xdll.vdsx @winexists(~edit1) @chr(34)Hello@chr(13)@chr(10)World!@chr(34)
OPTION SLEEPTIME,1
repeat
wait 0
until @dlgtext(edit1)
OPTION SLEEPTIME,50


xdll.vdsx
Code:

if @equal(%1,about)
goto about
end
window settext,%1,%2
exit
:about
Info VDSX Example by cnodnarb


[/old]
Code:


Last edited by cnodnarb on Fri May 07, 2021 6:29 pm; edited 69 times in total
Back to top
View user's profile Send private message AIM Address
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 762
Location: Rockeledge, GA

PostPosted: Sun May 08, 2011 4:26 pm    Post subject: getchildwindow VDS Built DLL Reply with quote

When calling %1 contains receiver element %2 contains window parameter with hash sign or with %1234 format. %3 contains the child window to be obtained WITHOUT # sign.

So it would be:

Code:

run getchildwindow.vdsx @winexists(~edit1) #ieframe @chr(34)Internet Explorer_Server@chr(34)


Well, it's entirety should be...
Code:

run getchildwindow.vdsx @winexists(~edit1) #ieframe @chr(34)Internet Explorer_Server@chr(34)
OPTION SLEEPTIME,1
repeat
wait 0
until @dlgtext(edit1)
OPTION SLEEPTIME,50


On my machine the entire call takes 3ms.

getchildwindow.vdsx
Code:

if @null(%1)
exit
end
if @equal(%1,About)
goto about
end

%a = @window(@winexists(%2),child)
%b = @succ(%b)
%c = 2
list create,%b
list add,%b,%a
repeat
    if %a
        %a = @window(%a,next)
        list add,%b,%a
    end
until @null(%a)
repeat
    list seek,%b,0
    list create,%c
    %%list = %b
    %%index = 0
    %%count = @count(%%list)
    repeat
        list seek,%%list,%%index
            if @item(%b)
                %a = @window(@winexists(@item(%b)),child)
                    if %a
                        list add,%c,%a
                        repeat
                            if %a
                                %a = @window(%a,next)
                                list add,%c,%a
                            end
                        until @null(%a)
                    end
            end
        %%index = @succ(%%index)
    until @equal(%%index,%%count)
    %b = @succ(%b)
    %c = @succ(%c)
until @null(@text(%b))

%b = @succ(%b)
list create,%b

%%match = %3
%%list = 0
repeat
%%list = @succ(%%list)
%%index = 0
%%count = @count(%%list)
    repeat
    list seek,%%list,%%index
        if @item(%%list)
            if @equal(@winclass(@item(%%list)),%%match)
                    list add,%b,@item(%%list)
                    end               
                end
            end
        end
        %%index = @succ(%%index)
    until @equal(%%index,%%count)
until @equal(%%list,@diff(%b,2))

window settext,%1,@text(%b)
exit

:about
  DIALOG CREATE,About ,-1,0,240,100,SMALLCAP,ontop
REM *** Modified by Dialog Designer on 5/8/2011 - 20:04 ***
  DIALOG ADD,TEXT,TEXT1,6,12,,,TEXT1
  DIALOG ADD,BUTTON,BUTTON1,70,168,64,24,OK
  DIALOG SHOW
dialog set,text1,Get Child Window@cr()Visual DialogScript Extension@cr()Copyright © Brandon Cunningham 2011.@cr()Version 1.0
wait event


Feel free to integrate the above code into a DSU or directly into your DSC file with necessary modifications.

I will forgive recompiles (maybe you use VDSRUN60.DLL) as long as the about entry is placed in the registry.

This version relies on VDSRUN50.DLL.

Attached as EXE, to properly comply with RFC rename to VDSX.



getchildwindow.exe
 Description:

Download
 Filename:  getchildwindow.exe
 Filesize:  11 KB
 Downloaded:  2267 Time(s)



Last edited by cnodnarb on Mon May 09, 2011 2:22 am; edited 3 times in total
Back to top
View user's profile Send private message AIM Address
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1751
Location: Space and Time

PostPosted: Sun May 08, 2011 6:37 pm    Post subject: Reply with quote

This is a cool and neat idea. I just may have to give this a shot...after I finish my latest version of Save-It. (Thanks BTW!) I should have it ready in a few along with a help file! Smile
_________________
Chris
Http://theblindhouse.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 762
Location: Rockeledge, GA

PostPosted: Sun May 08, 2011 11:46 pm    Post subject: Reply with quote

Please see top post and comment on the file rename issue for which of the three options you deem most meet and fit.

Thanks!
Very Happy
Back to top
View user's profile Send private message AIM Address
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1751
Location: Space and Time

PostPosted: Mon May 09, 2011 12:00 am    Post subject: Reply with quote

I'd like to add a 4th option. Creating an additional executable extension. Maybe .VDX? I have done this before as an experiment and it worked in XP not sure if it'll work in Win 7. Just create another extension in the registry set to the same as an .EXE file (exefile, application/x-msdownload) and it'll run just like an application (.EXE). This way, we have our "own" VDS extensions an not have to worry about renaming them before executing them and can either have them in the applications install folder or in the System32 folder.

A DSU can be easily made or even source code for all to use in apps.

What about that?

_________________
Chris
Http://theblindhouse.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 762
Location: Rockeledge, GA

PostPosted: Mon May 09, 2011 12:07 am    Post subject: Reply with quote

Nice. Here's one from PGWARE I actually was able to read after I got over something else he said that didn't agree with me.

Quote:
A way to bypass these things is when installing the files to program files or the registry you can set an ACL to the specific files and registry keys you want to modify using a non-elevated process/exe, setting the acl to everyone-modify even gives guest users on the computer access to modify those files and registry entries - so be careful with this. So for instance if you give the everyone-modify ACL access on your c:\program files(x86)\my program\program.exe then a guest user could login to the system and replace program.exe with a trojan - thus opening the door to a security violation on the entire system when someone thought your software was secure and didnt expect program.exe to be malicous. So be careful with ACL permissions. Most installers will allow you to write ACL permissions, I use Innosetup and it allow it.


I'm adding both these to the list of options. I like them both. A lot. I think I may like yours better though, because we are not technically creating DLL's, and your way seems really honest and accomplishes my credit to author goal. Also would simplify the call to the external by two lines of code.
Back to top
View user's profile Send private message AIM Address
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1751
Location: Space and Time

PostPosted: Mon May 09, 2011 12:14 am    Post subject: Reply with quote

My vote is for #4. Smile
_________________
Chris
Http://theblindhouse.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 762
Location: Rockeledge, GA

PostPosted: Mon May 09, 2011 12:24 am    Post subject: Reply with quote

Ugh, I put your option as #5 Surprised, did you mean ACL or new (vdx) extension?

Editing post to make yours the 4th option LoL!
Back to top
View user's profile Send private message AIM Address
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 762
Location: Rockeledge, GA

PostPosted: Mon May 09, 2011 12:27 am    Post subject: Reply with quote

Can't be VDX that's a visio document ;p

Got to be careful with that one..
Back to top
View user's profile Send private message AIM Address
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1751
Location: Space and Time

PostPosted: Mon May 09, 2011 12:33 am    Post subject: Reply with quote

Ok, Yeah, meant the alt ext.

.VDSX or .DSUX or even .VDSEXE, .VDLL ,...

Did a search and .VDSX seems like it should work.

Edit: Oops, nope that is a type of media extension...

Edit Oops, again....after more research, .VDSX should work.... I think

_________________
Chris
Http://theblindhouse.com


Last edited by LiquidCode on Mon May 09, 2011 1:06 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 762
Location: Rockeledge, GA

PostPosted: Mon May 09, 2011 1:04 am    Post subject: Reply with quote

Having troubles setting the property sheet handlers for a new extension, basically refuses to list Copyright information on the sheet handler. I've copied DLL and EXE, no avail yet. I'll keep at it.
Back to top
View user's profile Send private message AIM Address
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1751
Location: Space and Time

PostPosted: Mon May 09, 2011 1:12 am    Post subject: Reply with quote

This works well on XP. Maybe try on Win 7? Run the install and rename an .EXE to .VDSX. Should run fine...it did for me.

It be made into a DSU in VDS 5 and VDS 6

Code:

#Define Command,VDSXInstall,VDSXUninstall

:VDSXInstall
registry write,HCR,.VDSX,,vdsxfile
registry write,HCR,.VDSX,Content Type,application/x-msdownload
registry write,HCR,vdsxfile\DefaultIcon,,"%1"
registry write,HCR,vdsxfile\Shell\Open\Command,,@chr(34)"%1"@chr(34)" %*"
registry write,HCR,vdsxfile\Shell\RunAs\Command,,@chr(34)"%1"@chr(34)" %*"
#refresh Icons to show changes
loadlib shell32.dll
%x = @lib(shell32, SHChangeNotify, INT:, $8000000, 0, 0, 0)
freelib shell32.dll
exit 
 
:VDSXUninstall
Registry delete,HCR,.VDSX
Registry delete,HCR,vdsxfile
#refresh Icons to show changes
loadlib shell32.dll
%x = @lib(shell32, SHChangeNotify, INT:, $8000000, 0, 0, 0)
freelib shell32.dll
exit


Screen Shot of property sheet:
http://cl.ly/0M3J2b3I420z3L2y4409
http://cl.ly/3k3h213m311z1s0o2Z1V

_________________
Chris
Http://theblindhouse.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 762
Location: Rockeledge, GA

PostPosted: Mon May 09, 2011 1:52 am    Post subject: Reply with quote

Unfortunately there seems to be (yet more annoying) changes in Windows 7.
No dice. I'm considering making a shell/about for the extension so people can build there own about boxes into the file.
Back to top
View user's profile Send private message AIM Address
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 762
Location: Rockeledge, GA

PostPosted: Mon May 09, 2011 1:59 am    Post subject: Reply with quote

I like the about ideal because you can ALSO include instructions on use, links to license files etc.

So Properties already work on XP, but don't on Vista/7, but with the about registry entry I think this resolves.
Back to top
View user's profile Send private message AIM Address
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 762
Location: Rockeledge, GA

PostPosted: Mon May 09, 2011 2:24 am    Post subject: Reply with quote

RFC heavily updated!
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript Open Source Projects All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
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

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group