Thread: Shadowed window effect in DOS

  1. #1
    fiveball
    Guest

    Shadowed window effect in DOS

    I'm trying to create a shadowed window effect in dos, but it is not coming out right....here is what I have so far...

    #include <stdio.h>
    #include <conio.h>

    void main()
    {
    textmode(3); textattr(15 + (8<<4)); clrscr();
    window(16,6,66,21);
    textattr(15 + (0<<4));
    clrscr();
    window(15,5,65,20);
    textmode(3); textattr(15 + (1<<4));
    clrscr();


    while(!kbhit());

    }

    As you can see...the first command sets the entire background to a dark gray color. Then it creates a window and sets it's background to black. It works till there. After that it creates a new window and the background is supposed to be blue but it is coming up black. Does anyone know what I did wrong????

  2. #2
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    You forgot code tags

  3. #3
    Registered User Vber's Avatar
    Join Date
    Nov 2002
    Posts
    807
    And you forgot too, that it's incorrect to use void main(), void only returns int, so change it to int main() and return an integer value at the end.

  4. #4
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    >> void only returns int

    I'm sure Vber meant "main only returns an int"

  5. #5
    Fiveball
    Guest
    OK, sorry about the code tags. Didn't read that till after I typed it. This program is for a class and our teacher is having us use void main() instead of int main().....I too think this is very stupid, but I have to follow orders or fail.

  6. #6
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    Location
    between photons and phonons
    Posts
    1,110
    >>Does anyone know what I did wrong????

    Nothing when icompile this it works fine. Although i dont really understand why u first draw everything gray (with black window) to set it all blue afterwards.....

    Mayb u should try to compile your code and hmm ill just give an example.
    Code:
    #include <stdio.h>
    #include <conio.h>
    
    int main()
    {
    
    
    	textmode(3);
    	textattr(15 + (8<<4));
    	clrscr();
    	window(16,6,66,21);
    	/*
    	textattr(15 + (0<<4));
    	clrscr();
    	window(15,5,65,20);
    	textmode(3);
    	textattr(15 + (1<<4));
    	clrscr();
    	while(!kbhit());
    	*/
    	return 0;
    }
    Try to do the same thing just put some /* and */ in ur code to see where it goes wrong with you. Because if i hadnt done it this way i would never have seen that there was a black window and grey background be4 the blue window.

    And according to my compiler reference: clrscr, window and textattr arent really portable.
    Last edited by GanglyLamb; 03-14-2003 at 01:04 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How make platform from DOS to window?
    By Yumin in forum C++ Programming
    Replies: 12
    Last Post: 01-27-2006, 01:16 AM
  2. Window scrollbar
    By maxorator in forum Windows Programming
    Replies: 2
    Last Post: 10-07-2005, 12:31 PM
  3. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 10:12 PM
  4. Scrollbar In Dos Window
    By speve in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 12-17-2001, 08:12 PM
  5. DOS window
    By speve in forum C Programming
    Replies: 1
    Last Post: 12-17-2001, 05:42 AM