Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

C++ GUI


yours31f's Avatar
Retired
10 0

Hey im making a new OS called "Looking Glass" and i need to implement gui with windows.h but i have no idea how. i'm using dev-cpp.I need a tutorial or something . any help is appreciated.


yours31f's Avatar
Retired
10 0

this is what i have so far. (whitey and cody are friends)

#include <iostream> #include <string> #include <vector> #include <dos.h> #include <stdio.h> #include <conio.h> using namespace std;

int main() { // Logins login: cout << "\tLooking Glass\n"; int security = 0; int logged_in = 0; int menu = 0; string user; int submenu; int newSecurity;

string username=&quot; &quot;;
cout &lt;&lt; &quot;&#92;nUsername: &quot;;
cin &gt;&gt; username; 

string password;
cout &lt;&lt; &quot;Password: &quot;;
cin &gt;&gt; password; 

if (username == &quot;spencer&quot; ){if ( password == &quot;nowhere&quot;)
{
 security = 5;
}}
if (username == &quot;whitey&quot; && password == &quot;imgay&quot; )
{
security = 3;
}
if (username == &quot;cody&quot; && password == &quot;imafruit&quot;)
{
security = 3;
}
system(&quot;cls&quot;);
if (security = 5){
    if (username == &quot;spencer&quot; && security == 5){
    cout &lt;&lt; &quot;&#92;nNow logged in Chris.&#92;n&quot;;
        }

menu: cout << "\n\nMenu:\n\n"; cout << "1 - All users and security\n"; cout << "2 - Programs\n"; cout << "3 - Log out\n"; cin >> submenu; if (submenu == 1){ vector<string> users; users.push_back("Spencer"); users.push_back("Cody"); users.push_back("Whitey");

vector&lt;string&gt;::iterator myIterator;
vector&lt;string&gt;::const_iterator iter;

cout &lt;&lt; &quot;All Users:&#92;n&quot;;
for (iter = users.begin(); iter != users.end(); ++iter)
    cout &lt;&lt; *iter &lt;&lt; endl;
    goto menu;}

}

 if (submenu == 2){
      
      cout &lt;&lt; &quot;option 2&quot;;
      }
 if (submenu == 3){
      security = 0;
      system(&quot;cls&quot;);
      goto login;
      }

goto login;

system("pause"); return 0;

}


ghost's Avatar
0 0

And how exactly are you planing to do the booting? Or the filesystem? Maybe you mean you are making a new shell for windows?


yours31f's Avatar
Retired
10 0

well right now it would run over windows.

and i think im going to make a team


ghost's Avatar
0 0

Yeah well, hen it won't be a OS, that's a replacement shell.


yours31f's Avatar
Retired
10 0

yeah well it might become an os later. but now i need to debug it.


yours31f's Avatar
Retired
10 0

any1 interested in helping me out? i'm fairly new to c++ (only about 2 weeks) so i may need some 1 with some more exp.


ghost's Avatar
0 0

yours31f wrote: any1 interested in helping me out? i'm fairly new to c++ (only about 2 weeks) so i may need some 1 with some more exp.

If you have only been coding 2 weeks, then why try and code an OS? lol

also you have a 'goto' statement……….


yours31f's Avatar
Retired
10 0

i know it's bad syntax to spaghetti program but i don't know any other way and it seemed like a really good idea for practice on this language.


reaper4334's Avatar
Member
0 0

If you're planning on making this into an OS, and you're only debugging it in windows… you've already failed.


yours31f's Avatar
Retired
10 0

ok let me explain. i am makeing a cover shell. eventually i may make it an os. now i just want to cover windows. this way you don't have to wipe your drive of windows and you can still have a new "OS"


reaper4334's Avatar
Member
0 0

Yes. I read that already. You've failed if you intend to modify it into an OS.


alldatizholy's Avatar
Member
0 0

*nix 2 the rescue……..:D:D:D:D:D:D:D:D:D


yours31f's Avatar
Retired
10 0

alldatizholy wrote: *nix 2 the rescue……..:D:D:D:D:D:D:D:D:D ??? and well if you have a better project for me to learn on im open to suggestions.


reaper4334's Avatar
Member
0 0

yours31f wrote: ??? and well if you have a better project for me to learn on im open to suggestions.

Who said it's a bad project?


yours31f's Avatar
Retired
10 0

if you fail try try again. or the smart inventor tries something new.


reaper4334's Avatar
Member
0 0

An idiotic inventer doesn't realise when he's using OS specific libraries and planning to modify it to an OS.


yours31f's Avatar
Retired
10 0

WOW Thank You i have been searching for EVER. i wish i could answers like this more often.


ynori7's Avatar
Future Emperor of Earth
0 0

@yours31f- my first advice to you is to never use goto's. it's just bad form and can lead to nesting errors and such.

also, the user interface is the last thing you should focus on. if you really want to make an OS, you need to get the main body of the code written before you focus on making it 'pretty'.


Futility's Avatar
:(
80 122

Wow…just…wow. First thing you post in a few weeks, and I already hate you again. Where to start…

2 weeks and you're trying to write an 'OS'. And you claim that it's so you can learn, yet you come here asking for us to do the research for you. You want advice? Learn how to use google yourself, rather than getting other people to do it for you. Find something easier to do. Stick with the simple stuff until you get a more in-depth view of the language.

I can already see what's going to happen. You're gonna realize that noone here is going to do it for you, so you're going to quit and move onto something harder, then come back and try again.

I've told you to learn the basics before moving on to the harder stuff…at least ten times already, yet you continue to waste everyone's time. So why don't you just do it? Rather than fiddle around for about 15 minutes then come here and bother us, why not find a tutorial online or buy a book and get to work for yourself? When you get some real questions, *then *ask them. And just as clarification, a real quesiton doesn't consist of "I need a tutorial or something."

Thats all for right now. I'm sure I could do more, but suddenly I've lost interest.


Uber0n's Avatar
Member
0 0

yours31f wrote: if (username == "spencer" ){if ( password == "nowhere") { security = 5; }} Why not use two conditions for one if statement instead of two separate ones?

if (username == "spencer" && password == "nowhere") { etc

if (security = 5){

This is NOT good, since it'll actually set the security level to 5 and continue. Should be

if (security == 5){

menu: cout << "\n\nMenu:\n\n"; (some more code…) goto menu;}

Come on man! This isn't batch! Learn how to use functions!

Seems like you have a lot of things to do, but it's a good project to learn stuff anyway. However I don't think you'll be able to code a separate OS depending on windows.h ^^


yours31f's Avatar
Retired
10 0

everyone was right. i gave up on the whole six years of os programming but i have to say i learned alot from it. and well the new project is even better because i want to help everyone else out by making them a useable prog for their own needs.


ynori7's Avatar
Future Emperor of Earth
0 0

yours31f wrote: i gave up on the whole six years of os programming but i have to say i learned alot from it.

did you just say you've done six years of OS programming? i must have misread that.


ghost's Avatar
0 0

Let me give you a lil hint that might make things a lil different for you. The definition of insanity is doing the same thing over and over again and expecting a different outcome. That whole try try again thing…the guy that said that was insane.


ghost's Avatar
0 0

Hmmm, okay, now i'm confused???????

Are u making a shell replacement or an os or what?

And secondly, why?

When we already have ubuntu, linux, windows, beos, dos and loads of variants.

Maybe u should try writing something a little less challenging and a little more useful if you've only started. There are loads and loads of programs and routines u could write to actuially help you by automating some actions on your pc etc, why not try something like that instead of putting yourself in competition with all the other extremely excellent programmers that already make the os's in the first place.