hello, I used to type my programs on console application.by C language and use
these libraries , <stdio.h>,<conio.h>,<stdlib.h> .etc and used these function (printf),(scanf) under <stdio.h> library.. but then I wanted to know how they make programs on windows application by C language . I figure out they used another libraries .. like <windows.h>.and the functions that used under this library is different from which I used to make my program on it.so my qusetion is that :I need to know how many the libraries under C language until this day.. ? is there any location to know that.. ? and how I can run my programs that I made it on dos make run on windows .. what should I do..?

Recommended Answers

All 15 Replies

>so my qusetion is that :I need to know how many
>the libraries under C language until this day.. ?
It sounds like you just want to focus on Win32 for now. You can start here, but eventually you'll be checking MSDN regularly.

Note that GUI programming is not easy as there's quite a learning curve when coming from console applications.

no, I don't like to focus on Win32 . but I would like to know how many libraries on C language until today is there any location.?

>but I would like to know how many libraries on C language until today is there any location.?
There are thousands upon thousands of C libraries. And no, there's no centralized location.

ok.. but just I would like to know is
this library <windows.h> part form C or C++ language.?

<windows.h> is from the Win32 API.

Member Avatar for iamthwee

No, windows.h is definitely not part of the c/c++ standard.

No, windows.h is definitely not part of the c/c++ standard.

ok. but why they say ..:programming under win32 using C language ..!
most of programs that made it on win32 used windows.h under C language .. what is that mean.?

>but why they say ..:programming under win32 using C language ..!
You're using the C language to access the Win32 API through a C interface (the header and library).

It just means you can use C language to build gui MS-Windows programs. You can also use other languages, such as C#, VB, php, C++, and others. The win32 api functions were made by Microsoft to be called by as many different programming languages as possible. windows.h is just a header file used within C and C++ language.

I can understand from your answers ..<windows.h> it's just library under win32 that I can use it in different languages .. like C , C++,C# ,VB,etc... but when I use <windows.h> in C language I will use some functions .. that I can't use it when I'm using <windows.h> in C++ language.. etc.. is that right.?

The functions declared in windows.h can be used in all languges. windows.h is specific to C and C++. The other languages have a similar header file that is targeted to that language, but they all reference the same win32 api functions.

do you mean there is no difference in any thing when I use <windows.h> in C langauge and when I use it in C++ ? , then why they say programming win32 by C and programming win32 by C++..!?

>do you mean there is no difference in any thing when I
>use <windows.h> in C langauge and when I use it in C++ ?
More or less.

>then why they say programming win32 by C and programming win32 by C++..!?
Probably because it's true. "Win32 by C" means a C program that uses Win32. Likewise, "Win32 by C++" means a C++ program that uses Win32. C and C++ are different languages, so it's a rather important distinction even if <windows.h> is usable in both.

ok.. thank you I will try to find more information about this topic..

Some addition.
The original MS windows.h header is a root of the lots of include files: windef.h, winbase.h, wingdi.h and others. In itself it contains few declarations.
Open these files (any) and search the __cplusplus identifier. It's the key point to understand why the single window.h used in C and C++ (different) languages.

The program in C++ can use functions written in C (but not vice versa). The C++ Standard requires that "The name _ _ cplusplus is defined to the value [tbd] when compiling a C++ translation unit" (defined as a macros). In other words you (and MS) can write headers with common for C and C++ preprocessor conditional statements which are "sensitive" to the compiled unit language.

All classic Windows API functions have C interface (written in C). For example (all-capital words are type aliases defined by typedef):

VOID GetSystemTime(LPSYSTEMTIME lpst);
VOID GetSystemInfo(LPSYSTEM_INFO  lpSystemInfo);

The program in C needs these prototypes. The program in C++ needs to know that these functions written in C:

extern "C" {
VOID GetSystemTime(LPSYSTEMTIME lpst);
VOID GetSystemInfo(LPSYSTEM_INFO  lpSystemInfo);
}

Let's invent common code:

#ifdef __cplusplus
extern "C" { /* skip this line if it's C code compiled */
#endif
VOID GetSystemTime(LPSYSTEMTIME lpst);
VOID GetSystemInfo(LPSYSTEM_INFO  lpSystemInfo);
#ifdef __cplusplus
} /* /* skip this line if it's C code compiled */
#endif

That's why C and C++ can use common system headers...

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.