Changing DSP from console to Windowed form

Any discussion not related to the other forum topics
Delaide
Posts: 478
Joined: Sat Jun 14, 2014 8:58 am

Changing DSP from console to Windowed form

Post by Delaide » Wed Feb 11, 2015 3:12 am

So, I am currently trying to change DSP from a console based application to a windows form based application (non-GUI to GUI based application).

My goal is to build a server front end that allows the user to do multiple things. One is single click start/stop/reset the server. Eventually, even being able to edit the server settings straight from there, instead of messing with the settings.lua and the conf files.

For step 1 though, I want to just turn the console apps into a form app. I have managed to convert, but with no graphics. I end up with a task process in Task Manager that shows the server is running, with no window anywhere.

What I would like to know is what resources are available for me to study more and learn how to do this. I don't expect anyone to do this for me, just point me towards some resources, since when I look at a general "Learn C++" website, I get very basic code, with 1 cpp file, and maybe a header file, etc. So, I have went from "Okay, this is simple" to "wtf do I do now".

I asked one of our developers, and he recommended I make a general post.

I have thought of a couple options:
1. Just turn the pure console apps into windows forms apps and figure out a way to create the UI and merge the servers into a single control application
2. Turn the servers into a .dll and then use those .dll files to plug into a C# program, since this is easier for Windows forms.

Any hints, resources, or recommendations would be great, and once I have each working milestone, I will either submit to dsp for review, or create a public fork with the modifications.

User avatar
demolish
Developer
Posts: 262
Joined: Thu Jul 26, 2012 7:12 am

Re: Changing DSP from console to Windowed form

Post by demolish » Wed Feb 11, 2015 12:47 pm

if you were to change the conf files, the server would need restarting anyways (e.g. base speed and lobby expansions enabled)
<Giblet[NewBrain]> kj with this first step would be fine on my shit
Click here for a guide on scripting missions.

User avatar
atom0s
Developer
Posts: 537
Joined: Thu Oct 25, 2012 9:52 am

Re: Changing DSP from console to Windowed form

Post by atom0s » Wed Feb 11, 2015 3:51 pm

This project is not specific to Windows. It works on Linux as-is as well. So if you plan on doing any changes to add a GUI front end, it should either:
A. Be an entirely separate application that just manages the processes of the current consoles.
B. Be an entirely separate configuration to compile with allowing the UI code to be if/def'd out if people do not want it.

Essentially not doing so you are going to land up making the project specific to one OS, which we do not want, or you are going to add a ton of bloat using some cross-platform UI library, also something we do not want.

Delaide
Posts: 478
Joined: Sat Jun 14, 2014 8:58 am

Re: Changing DSP from console to Windowed form

Post by Delaide » Thu Feb 12, 2015 12:29 am

atm0s, this is one of the reasons I posted this, to get ideas on how to do it. I understand your suggestion, and if you have any ideas how I can ensure it is cross-platform compliant, then I welcome those ideas. The Windows-form wording might be incorrect. Basically, I want to create something that has a simple UI, buttons, and eventually some separate windows to allow modification of the conf files.
This is why I would prefer to just do it in C++, rather than in C#, but right now I am having difficulties with creating the proper form in C++. I may just try the QT IDE (That is if a different IDE will even work. I am unsure, since the Windows version is built around VE), I know it is more cross platform and creates in pure C++, not in Windows modified C++. I wanted to avoid this, since I only have 1 PC with Qt, but you are right, it would probably be better.

Of course, I also do not plan on adding anything directly to the DSP repository. First, once I have something working, I will find a dev like you, kj, someone, to run through what I have done and give me feedback. I am just beginning to learn how to use programming, so I am using something I am interested in to learn from. So even if I can get the code working as I want it to, I am not sure that it will be the best implementation.
But thanks for your feedback, and if you have any other ideas on where I can go to find better guides, I would love to hear them.
Currently, I am using ideas from:
http://stackoverflow.com/questions/3884 ... indows-app
http://www.codeproject.com/Questions/31 ... -Form-Appl

Or even just using a stand alone app to launch the consoles. I am still working on learning how to create a C++ GUI:
http://stackoverflow.com/questions/9872 ... redentials

And of course, even if I fail to make this into something for linux, I can still release what I have on my own git for those who run their server on Windows. I don't assume what I work on will be good enough for DSP at this stage, but it never hurts to try to give more tools for people to use.

User avatar
atom0s
Developer
Posts: 537
Joined: Thu Oct 25, 2012 9:52 am

Re: Changing DSP from console to Windowed form

Post by atom0s » Thu Feb 12, 2015 2:25 am

Don't think that I am discouraging you, if you are. It's just that DSP is not designed to be a UI driven server set. It is made for console as it works best that way cross-platform. Your tool would be better suited being something external from DSP that just manages the processes instead rather then integrating directly into DSP's core code.

UI coding in using raw API on any system is not that fun, it's not insanely hard, it is just a fair amount of work to get every little thing that you want working properly. If you are targeting Windows specifically, C# may be your better route to take for easy UI coding to manage the servers and create a config editor etc.

Delaide
Posts: 478
Joined: Sat Jun 14, 2014 8:58 am

Re: Changing DSP from console to Windowed form

Post by Delaide » Thu Feb 12, 2015 3:56 am

Yes, that is why I was originally exploring just an external app. Sadly, I am still fighting with UAC. When I try to launch the apps from a C# window, the servers do not start. I end up with:
Capture.JPG
The last line get cuts off, and it gives me the same [ERROR]: Could not open 'log\login-server.log', access denied.

Basically, I think it is a UAC control issue. I can launch using batch files with no problem (Only after I fixed my UAC control issue in the batch file. It still requires me to approve permission when first launched), but not by using a runas command. Sadly, it also will not prompt for user control access for the actual server either, so I cannot get this to work. One thing I have hated since Windows Vista, they have created such a headache with the UAC...

I have started feeling that I may need to build it using the servers themselves, but yes, more of a headache because that means changing the consoles to UI forms. My preferred method would be to solve this UAC issue and just put the server consoles as child elements, so I can minimize the windows and make it at least appear seamless.

I am still poking around on this thread, and looking for others, to figure out how to implement this:
http://stackoverflow.com/questions/9872 ... redentials

Eh, maybe I will have something to simplify the process for people who do better with just click here and go xD

User avatar
atom0s
Developer
Posts: 537
Joined: Thu Oct 25, 2012 9:52 am

Re: Changing DSP from console to Windowed form

Post by atom0s » Thu Feb 12, 2015 11:59 am

Have you tried just disabling UAC on your machine? There is really no need for it if you are the sole user of the system.
Otherwise, launch your UI program as an Administrator via the right-click menu option.

User avatar
whasf
Site Admin
Posts: 1312
Joined: Thu Jul 19, 2012 9:11 pm

Re: Changing DSP from console to Windowed form

Post by whasf » Thu Feb 12, 2015 1:06 pm

Delaide wrote:Yes, that is why I was originally exploring just an external app. Sadly, I am still fighting with UAC. When I try to launch the apps from a C# window, the servers do not start. I end up with:
Capture.JPG
The last line get cuts off, and it gives me the same [ERROR]: Could not open 'log\login-server.log', access denied.

Basically, I think it is a UAC control issue. I can launch using batch files with no problem (Only after I fixed my UAC control issue in the batch file. It still requires me to approve permission when first launched), but not by using a runas command. Sadly, it also will not prompt for user control access for the actual server either, so I cannot get this to work. One thing I have hated since Windows Vista, they have created such a headache with the UAC...

I have started feeling that I may need to build it using the servers themselves, but yes, more of a headache because that means changing the consoles to UI forms. My preferred method would be to solve this UAC issue and just put the server consoles as child elements, so I can minimize the windows and make it at least appear seamless.

I am still poking around on this thread, and looking for others, to figure out how to implement this:
http://stackoverflow.com/questions/9872 ... redentials

Eh, maybe I will have something to simplify the process for people who do better with just click here and go xD

Do you actually have those folders and files located under D:\playonline\squareenix\final fantasy xi server\darkstar ?
-- Whasf

Delaide
Posts: 478
Joined: Sat Jun 14, 2014 8:58 am

Re: Changing DSP from console to Windowed form

Post by Delaide » Thu Feb 12, 2015 11:10 pm

@whasf, Correct. We actually discussed in this other thread. They are someone related on the UAC front: viewtopic.php?f=16&t=2429

@atm0s, unfortunately, even running the application as administrator still produces this error window. I have tried multiple ways to get this to work and am still not having much luck. This is one reason why I started thinking I may need to turn the consoles into UI centric apps.

Sadly, I even tried just launching the .bat file I created in the thread I just linked whasf to. All that does is trigger a console popup infinite loop (Had to unplug my notebook and pull the battery), at least if I launch the batch file from the created app. Batch file works with no problem if I run directly.

Eh, good learning process I guess?
/em beats head against the wall repeatedly.

User avatar
atom0s
Developer
Posts: 537
Joined: Thu Oct 25, 2012 9:52 am

Re: Changing DSP from console to Windowed form

Post by atom0s » Thu Feb 12, 2015 11:27 pm

What operating system are you on? Very odd that UAC would be giving you this much trouble.

Post Reply