Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / visual basic and dbc?

Author
Message
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 21st Feb 2009 06:34
ok well i heard someone say a while back that they made a windows form in vb and used it in dbc somehow does anyone know how that would be possible (or if i could be mistaken?)
Quirkyjim
16
Years of Service
User Offline
Joined: 18th Oct 2008
Location: At my computer
Posted: 21st Feb 2009 20:50
I believe that you're mistaken, but if you could, that would be AWESOME

~QJ
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 21st Feb 2009 21:32
ya i know thats why i was wondering lol


i think (as i just read someone else say this in another post)
that i saw someone say something like :

make a vb app and run it in the background and communicate with it.


that was probebly it lol jw thanks
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 21st Feb 2009 23:17
Yeah, communicate with it by using either files, the clipboard, or by passing memory using the pointers to memblocks. An alternative may be to use VBScripting. That will allow you to write code directly from DBC if you want. If you use HTA, you can actually create forms and such. Here's an example right off of Microsoft Tech (modified for DBC):



It basically creates an html file (renamed with the extension hta) that contains a VBScript. Once you launch the HTA file, it runs the script and behaves like a form. Check out:

HTA

Enjoy your day.
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 22nd Feb 2009 04:52 Edited at: 22nd Feb 2009 05:05
hmmm interesting.... i ran it. it "worked" but db froze up and then i left it for a while and it ended (like the hta had ran then exited already) then i pressed f12 and it exited and the hta was running.


that is a very cool thing but i really wouldn't beable to use this would i? because if i used this i would have to program everything in the script and it really wouldn't be much of a dbc app anymore lol.

unless you mean just running the db and then if you need another window making and running a hta(for like a settings box or something) but how would you get info from the hta?


after all of this i think it is going to be easier to learn the win32api and use the call dll commands because in the end it would be easier then learning a hole new language (the vbscript i already know html thats easy lol). i think if i could just understand how to make a new window(or form lol) everything else is a litle easier. plus i'm learning c++ so as soon as i get a handle on that i won't need the conversion to dbc anymore lol
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 22nd Feb 2009 11:09
Quote: "that is a very cool thing but i really wouldn't beable to use this would i? because if i used this i would have to program everything in the script and it really wouldn't be much of a dbc app anymore lol."

If you are adding a window under any circumstances, you'll be doing it through a Windows means - and it wouldn't be DBC. What's the difference in using VB to make a window vs vbscript? In either case, the form would just be an interface to DBC (you handle the interaction through files, memory, or clipboard).

It makes much more sense to use the Win32 api and make the windows calls directly instead of going through another bloated BASIC or scripting language. The VBScript example is just a quick and dirty way to get some windows functionality only needing html and vbscript knowledge.

Just as a note, to use DBC with windows you'll need a custom DLL that handles the window (form) creation - that includes buttons, sliders, listboxes, etc. . 1 basic reason is because the call dll command in DBC can't hold all of the parameters of a user32.dll CreateWindowEx() function call. Also if you want to use windows menus, you'll need to subclass the DBC window to gain access to your own WindowProc() callback... If this doesn't make sense now, as you continue to study C++ and the win api, you'll understand.

Enjoy your day.
Quirkyjim
16
Years of Service
User Offline
Joined: 18th Oct 2008
Location: At my computer
Posted: 22nd Feb 2009 18:08
Just a question: How would one RUN the HTA?

~QJ
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 23rd Feb 2009 00:11 Edited at: 23rd Feb 2009 00:17
execute file "test.hta","","",1

unless you mean just running it outside of db if thats the case then it acts like a app(well it is. a html app) just double click on it


latch:


i didn't know that db coudn't handle all the function parramiters of createwindowex() maybe thats why db kept giving a erro when i tried using it (it said call dll expects integer,string,,,,,,, give or take some commas). the reason i said that was because i was trying to get away from having another file like that. but thanyou very much for your help. this has been a very interesting thread
Quirkyjim
16
Years of Service
User Offline
Joined: 18th Oct 2008
Location: At my computer
Posted: 23rd Feb 2009 00:16
Okay, though you could only execute .exe's

~QJ
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 23rd Feb 2009 00:24 Edited at: 23rd Feb 2009 00:27
i'm not sure what you mean?


you can execute any file (exe,txt,dba,hta,html) though if its not a app it will just open it in the default program that is used to open that file.

if its a file windows does not recognize the file i'm not sure what will happen i'm geussing you will get a error



Latch:


Since were on the subject of winapi

for later when i hae a better knoledge of c++ what is better?? calling the winapi functions or using the form editor in visuall c++?
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 23rd Feb 2009 02:10
I don't use visual c++ . I would imagine that since visual c++ is a microsoft product, it's optimized to manage the windows functions. Probably creating the form does all the background work for you. If that is the case, for your own benefit and knowledge, it's probably best to learn the details of the function calls and how they work.

Enjoy your day.
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 23rd Feb 2009 06:32
ok thanks tons
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 25th Feb 2009 00:55
just wondering how would you access files with a html file???? since you said you would communicate through files
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 25th Feb 2009 01:48
If you are referring to my suggestion of using an hta document as a form, you don't use html (or hta in this case) to performn the scripting operations. You instead embed vbscript subroutines into the HTA document that are triggered by events such as clicking buttons etc. The HTA document is like a web page that runs locally. VBscript handles what automation you want the web page to do. If you were to read in a file, you'd have to create a script with code similar to:

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("c:\myfile.txt", ForReading)

then read the file into an array and do with the information whatever you want. So you could, in theory, save all the parameters of a level editor designed in DBC saved in myfile.txt, manipulate the parameters, and save them back to the file. You could probably create a form in visual basic that does the same thing (if it's easier for you). Then just load and save files or the clipboard between DBC and the VB form.

Back to HTA, so you could write an app in DBC, then call your HTA files that have embedded scripts in them anytime you want form-like interaction with DBC. The output from the forms selections or vbscript subroutines could be saved to the clipboard or a file and then upon closing the script, DB reads the clipboard info and does whatever.

I have to admit, I haven't actually created an app that does this, but it makes sense to my brain as I write this. I probably should test if it truly can be done, though I don't see why it couldn't.

Enjoy your day.
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 25th Feb 2009 03:14 Edited at: 25th Feb 2009 03:49
ok i see what you mean exept i was reading on msdn (thought i'd look there to lol) and it said to use file open and save dialog things you have to have some liscence and if you don't then it won't work. i didn't quite understand what they ment but any ideas what they are talking about? lol

i can't find the page now lol


i'm not sure if i will use this.

i just started to try and make a set of functions to make fake windows forms and stuff. it doesn't look great but it better then nothing and right now i have buttons and moving the windows around so if this goes well i wouldn't need the hta but i always like learning new things lol


edit:

wait did you say (in theory) that you could use a vb form and just run it and communicate with dbc? (in the same thoery as the hta)

i still probly wouldn't use it but like i said i like learning things hahaha
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 25th Feb 2009 22:00 Edited at: 25th Feb 2009 22:03
I don't know what that's about. But to prove that an app can be created that can read and edit text files at least - including an open and save dialog (which you actually don't need - you could load files directly, but never mind that) . This is a notepad that's written totally in HTA with VBScript subroutines. Less than 300 lines.

HTA Notepad

I guess the only reason to mention HTA is that you could include the entire script in DBC data statements if you wanted, and then save it out as a file, launch it from DB and you're good to go. Of course you could always distribute it as it's own file... It's smaller than VB, and with some clever coding, you could probably make it do whatever you were going to try to do in VB to work with DBC.

Enjoy your day.
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 26th Feb 2009 04:05
ok ya i don't know wht they were talking about either lol


that is very cool thnks alot this is a very simple/interesting way of creating a program i had never herd about hta until this thread lol

Login to post a reply

Server time is: 2025-05-18 06:02:03
Your offset time is: 2025-05-18 06:02:03