Page 1 of 2

Changing DSP from console to Windowed form

Posted: Wed Feb 11, 2015 3:12 am
by Delaide
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.

Re: Changing DSP from console to Windowed form

Posted: Wed Feb 11, 2015 12:47 pm
by demolish
if you were to change the conf files, the server would need restarting anyways (e.g. base speed and lobby expansions enabled)

Re: Changing DSP from console to Windowed form

Posted: Wed Feb 11, 2015 3:51 pm
by atom0s
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.

Re: Changing DSP from console to Windowed form

Posted: Thu Feb 12, 2015 12:29 am
by Delaide
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.

Re: Changing DSP from console to Windowed form

Posted: Thu Feb 12, 2015 2:25 am
by atom0s
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.

Re: Changing DSP from console to Windowed form

Posted: Thu Feb 12, 2015 3:56 am
by Delaide
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

Re: Changing DSP from console to Windowed form

Posted: Thu Feb 12, 2015 11:59 am
by atom0s
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.

Re: Changing DSP from console to Windowed form

Posted: Thu Feb 12, 2015 1:06 pm
by whasf
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 ?

Re: Changing DSP from console to Windowed form

Posted: Thu Feb 12, 2015 11:10 pm
by Delaide
@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.

Re: Changing DSP from console to Windowed form

Posted: Thu Feb 12, 2015 11:27 pm
by atom0s
What operating system are you on? Very odd that UAC would be giving you this much trouble.