My hobby is embedded programming therefore I’m learning C , I was just wondering if C has library functions like windows forms,buttons etc(like in C#)?

Recommended Answers

All 12 Replies

No. Windows Forms require c++, not C. If your embedded device is running some version of MS-Windows then you might be able to use pure win32 api functions. But if its running *nix then I don't know.

Hi there,

It's good to learn C. Basically C program can interact with hardware and you can do even more with it if you are pro in it. But C is a 16-bit DOS oriented programming language, it uses 16 bit address scheduling. It's neither possible to design a window form or button nor such library exists. Windows programming requires win32 api functions as Ancient Dragon narrated above. To design a window form or button you have to use VC++ or any 32-bit compiler that will make a 32-bit specific executable. However you may design them for your own interest using graphics environment on command line platform [16-bit/ console application] using graphics.h file and can create your own form using rectangle and ellipse fillstyle, outtextxy and many more features of graphics library. And you may add a mouse call in C using 33h interrupt in C remember to include DOS.H cause in86() is defined in dos.h file here is the code to show mouse in C:

initmouse()
{
// this function will initialize mouse
// you have to call this function before calling showmouseptr
// cause it need to know that rather environment is console or graphics. 
i.x.ax=0; // push 0 into ax register
int86(0x33,&i,&o); // call 8086 interrupt routine
return(o.x.ax); // return the output in output not needed in actual
}
void showmouseptr()
{
// this function will show mouse pointer
i.x.ax=1; // push 1 into ax register
int86(0x33,&i,&o);// call 8086 interrupt routine
}

Regards
Surya

Thank you both!

>>But C is a 16-bit DOS oriented programming language, it uses 16 bit address scheduling

You are totally wrong dude. The entire Windows api was written in C language. You are obviously only familar with Turbo C which does have the limitations you mentioned. But if you come into the 21st century and get a compiler that isn't 25 years old, and has been obsolete 10+ years ago, you would have found out that the statements you made about C language is totally wrong.

VC++ 2005/2008 and 2010 are all 32 bit compilers that will gladly compile either C programs or C++ programs. Programmers have been writing pure MS-Windows programs using win32 api functions in C language for decades.

@ Ancient Dragon

Yes you are right now a days we can compile our C code on any 32 bit C compatible compilers like VC++. And I was talking about it's history so the comment I made:

>>But C is a 16-bit DOS oriented programming language, it uses 16 bit address scheduling.

is wrong, I agree. But it is what I wanted to explain :

>>But C was initially developed as 16-bit console oriented programming language, it used to map 16 bit address scheduling.

This type you are wrong dude I didn't mentioned that it was working for DOS, I had said for console. Please look at the latest post.

I think I phrased the question poorly! Mainly I want to learn C to program “Microchips” but occasionally I’ll want to create a window application to interface with an embedded project(something like the logic tool interface on the PICkit2).
I don’t want to learn two different languages if possible( Finding C hard enough). So would I be able to create something resembling a windows form, with something resembling a button with C? How difficult would it be in C? Or would it easier to learn C++ and how big a jump is it from C to C++?

You said it was 16-bit console. Unix has never been a 16-bit operating systm.

@interrupt: doing graphics on a microchip may not be possible due to lack of memory. Drawing a button in C language will be no different than doing the same thing in c++. Windows Forms is CLR/C++ language and requires the operating system to have the .NET framework installed. There is nothing inherent in standard c++ that will let you do any graphics, that will require other libraries whether you use C or C++.

You said it was 16-bit console. Unix has never been a 16-bit operating systm.

...

My rememberence was that *nix started on the DEC PDP-11 which was a 16-bit computer. After checking with wikipedia, the current version of the article indicates that the team started on the DEC PDP-7. PDP-7 wikipedia article indicates that the PDP-7 was a 18-bit computer. Then the team moved *nix to the PDP-11. The wikipedia PDP-11 article confirms that it was a 16-bit computer. My conclusion is that the statement "Unix has never been a 16-bit operating system." is not correct.

>>My conclusion is that the statement "Unix has never been a 16-bit operating system." is not correct.
And you may well be correct.

It's ok. I had left thinking of it with my last visit to this post.

@Phieninger, Nice case study dude..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.