only C, not C++
please give me the code for starting %26amp; restarting pc
and tell the libraries to be included
and how to do linking if needed
i don't have user32.lib and windows.h
from where can i get it
thanks
How to shut down or restart pc(windows) using a C program?
windows.h and user32.lib can de found online at microsoft by downloading the visual c++ express edition. You can also get these files by downloading mingw and it w32-lib package.
To restart the computer in C do:
ExitWindowsEx(EWX_REBOOT,0);
to shutdown:
ExitWindowsEx(EWX_POWEROFF,0);
Reply:winuser.h
= http://doc.ddart.net/msdn/header/include... .html
Thursday, July 30, 2009
Are library functions actually a part of C language.Explain?
Thank U!!!
Are library functions actually a part of C language.Explain?
Oh yes... see when u r so much into programming mindset... wouldnt it be irritating to repeat the bulky codings for a simple input and output statements... so only developers have written a common source codes for these and have included them in files called header files and they r called library functions 'cos they can be referenced by anybody any time......(called header 'cos they r at the top position), and its simple now... just include them in ur programs and u don have to repeat codes for clrscr(),printf(),scanf(),getch()... etc...
p.s: it is a chance we have '.h' as the extension for these files...
Reply:yes very much
Reply:Not all of them,..ANSI standrad C lists a set of library functions..(that are machine architecture independent) that are counted as part of C language..
while there are several other libraries that are not necessarially part of C language
Are library functions actually a part of C language.Explain?
Oh yes... see when u r so much into programming mindset... wouldnt it be irritating to repeat the bulky codings for a simple input and output statements... so only developers have written a common source codes for these and have included them in files called header files and they r called library functions 'cos they can be referenced by anybody any time......(called header 'cos they r at the top position), and its simple now... just include them in ur programs and u don have to repeat codes for clrscr(),printf(),scanf(),getch()... etc...
p.s: it is a chance we have '.h' as the extension for these files...
Reply:yes very much
Reply:Not all of them,..ANSI standrad C lists a set of library functions..(that are machine architecture independent) that are counted as part of C language..
while there are several other libraries that are not necessarially part of C language
What is the best method for inserting data into an Access or SQL database using C# and .NET?
I am a Classic ASP programmer learning .NET and C# (and trying not to pull out my hair).
I'm used to setting recordsets via ADO in C-ASP, should I do the same in C#? I already know that I can add references to the ADO libraries and create recordsets, but I'm not sure if this is the best practice.
If you need more detail, let me know...
What is the best method for inserting data into an Access or SQL database using C# and .NET?
first add
using System.Data;
using System.Data.SqlClient;
import statements at the top of the code page.
Then copy the following functions to your code:
public static SqlConnection GetConnection(string strConn)
{
SqlConnection conn=null;
try
{
conn = new SqlConnection(strConn);
conn.Open();
}
catch (SqlException ex)
{
Console.Write("SQL ERROR: " + ex.Message);
}
catch (Exception ex)
{
Console.Write("ERROR: " + ex.Message);
}
return conn;
}
public int ExecuteNonQuery(string strConn,string query)
{
SqlConnection conn = GetConnection(strConn);
int result=0;
SqlCommand cmd = new SqlCommand(query, conn);
try
{
//Configure the SqlCommand object
cmd.Connection = conn;
cmd.CommandType = CommandType.Text;
//Set type to StoredProcedure
cmd.CommandText = query;
result = cmd.ExecuteNonQuery();
}
catch (Exception ex)
{
Console.Write("Error running a query " + query + ": " + ex.Message);
}
finally
{
conn.Close();
}
return result;
}
And then do the following:
string query="INSERT INTO Table1(Field1,Field2)VALUES("test","test...
string strConn="Your database connection string here";
int output=ExecuteNonQuery(strConn,query);
if output=0 the insert failed, otherwise succeeded.
If you are dealing with access database, use the same functions but replace SqlConnection and SqlCommand with OleDbConnection and OleDbCommand
Reply:Stick with ADO.NET and SQL statements. It is indeed the best way to go. ADO.NET should work pretty much the same as you're used to and SQL statements distribute the work to be done onto the database server.
Reply:Use foxy's method, that is exactly what I was going to post. You can use the ADO libraries, but they are horrendously slow in .Net. When LINQ becomes available for Access, that is going to be the way to go.
Reply:If you're using MsSQL I'd recommend to look at Microsoft's new LINQ query and programming language fusion. It doesn't work for Access yet, but I think the thing is brilliant.
LINQ is available in Visual Studio 2008
Reply:I am with the other poster who suggested sticking with the ADO object library. It is time tested, and supported by all of the products you mention. If you are already familiar with recordsets, you should have no problem implementing them in C#. My motto is always : when in doubt, stick with what you know. Good luck. If you need any help or advice, just let me know. Be glad to assist in any way I can.
I'm used to setting recordsets via ADO in C-ASP, should I do the same in C#? I already know that I can add references to the ADO libraries and create recordsets, but I'm not sure if this is the best practice.
If you need more detail, let me know...
What is the best method for inserting data into an Access or SQL database using C# and .NET?
first add
using System.Data;
using System.Data.SqlClient;
import statements at the top of the code page.
Then copy the following functions to your code:
public static SqlConnection GetConnection(string strConn)
{
SqlConnection conn=null;
try
{
conn = new SqlConnection(strConn);
conn.Open();
}
catch (SqlException ex)
{
Console.Write("SQL ERROR: " + ex.Message);
}
catch (Exception ex)
{
Console.Write("ERROR: " + ex.Message);
}
return conn;
}
public int ExecuteNonQuery(string strConn,string query)
{
SqlConnection conn = GetConnection(strConn);
int result=0;
SqlCommand cmd = new SqlCommand(query, conn);
try
{
//Configure the SqlCommand object
cmd.Connection = conn;
cmd.CommandType = CommandType.Text;
//Set type to StoredProcedure
cmd.CommandText = query;
result = cmd.ExecuteNonQuery();
}
catch (Exception ex)
{
Console.Write("Error running a query " + query + ": " + ex.Message);
}
finally
{
conn.Close();
}
return result;
}
And then do the following:
string query="INSERT INTO Table1(Field1,Field2)VALUES("test","test...
string strConn="Your database connection string here";
int output=ExecuteNonQuery(strConn,query);
if output=0 the insert failed, otherwise succeeded.
If you are dealing with access database, use the same functions but replace SqlConnection and SqlCommand with OleDbConnection and OleDbCommand
Reply:Stick with ADO.NET and SQL statements. It is indeed the best way to go. ADO.NET should work pretty much the same as you're used to and SQL statements distribute the work to be done onto the database server.
Reply:Use foxy's method, that is exactly what I was going to post. You can use the ADO libraries, but they are horrendously slow in .Net. When LINQ becomes available for Access, that is going to be the way to go.
Reply:If you're using MsSQL I'd recommend to look at Microsoft's new LINQ query and programming language fusion. It doesn't work for Access yet, but I think the thing is brilliant.
LINQ is available in Visual Studio 2008
Reply:I am with the other poster who suggested sticking with the ADO object library. It is time tested, and supported by all of the products you mention. If you are already familiar with recordsets, you should have no problem implementing them in C#. My motto is always : when in doubt, stick with what you know. Good luck. If you need any help or advice, just let me know. Be glad to assist in any way I can.
I have just finished learning the basics of C++ now I am going to move on to MFC library, advice please?
Okay like I said I finished learning the basics of OOP and what not, I am not going to start learning MFC libraries, is it hard? what excatly will I be able to make with it? And can anyone supply me any good links to tutorials or good books to buy. Thanks in advanced, and if you can please talk about the MCF libraries in detail, thanks again :-)
I have just finished learning the basics of C++ now I am going to move on to MFC library, advice please?
Good you learned the basics of C++.It is a very good start for learning MFC.If you have got your basics of C++ well, then don't worry about MFC.Its very easy.As far as i know MFC programs are well explained in book called-Visual C++ Programming by Yashwant Kanetkar.
MFC library is a collection of ready made C++ classes which you can use to code your C++ program.It is easy to use if you have got the syntax right.The only troubling part of MFC is that you will have to memorize the names of classes and functions.Once you are through with that then you can comfortably write programs.
Anyways Good Luck!!!
Reply:try http://www.google.com
Reply:You can start with "Programming Windows by Charles Petzold". This will give you one direction. Then you can move to "Programming Applications for Microsoft Windows - by Jeffery Richter". Hope this will help you.
flower show
I have just finished learning the basics of C++ now I am going to move on to MFC library, advice please?
Good you learned the basics of C++.It is a very good start for learning MFC.If you have got your basics of C++ well, then don't worry about MFC.Its very easy.As far as i know MFC programs are well explained in book called-Visual C++ Programming by Yashwant Kanetkar.
MFC library is a collection of ready made C++ classes which you can use to code your C++ program.It is easy to use if you have got the syntax right.The only troubling part of MFC is that you will have to memorize the names of classes and functions.Once you are through with that then you can comfortably write programs.
Anyways Good Luck!!!
Reply:try http://www.google.com
Reply:You can start with "Programming Windows by Charles Petzold". This will give you one direction. Then you can move to "Programming Applications for Microsoft Windows - by Jeffery Richter". Hope this will help you.
flower show
Where can I find Turbo C++ 4.5 program .......... PLEASE HELP ??
I'm software student and I need turbo c++ 4.5 program to study ... the library on my college ask me to wait 4 days to get the program ... BUT I have an exam next monday... pls , do you know a site to download the program for a trail period .. just for studying up till my turn to get the program from my college !!!
Where can I find Turbo C++ 4.5 program .......... PLEASE HELP ??
try
http://www.quickerwit.com/links/114894.h...
Reply:Try half.com
Where can I find Turbo C++ 4.5 program .......... PLEASE HELP ??
try
http://www.quickerwit.com/links/114894.h...
Reply:Try half.com
How to simulate a page curl effect in a .Net language like VB.Net or C#? Do you suggest any graphics library?
I am writing a software and need to add a graphical simulation of page curling but I do not know how. I have used a sample code in code project but it seems to work too slow. I need to find a library for such a real time process. I've already search Yahoo and google but only found some plug-in such as AV Bros for photoshop while I want to implement this effect in my .Net software.
How to simulate a page curl effect in a .Net language like VB.Net or C#? Do you suggest any graphics library?
Use UI designed Flash. And use Flash.OCX to show that UI on form
How to simulate a page curl effect in a .Net language like VB.Net or C#? Do you suggest any graphics library?
Use UI designed Flash. And use Flash.OCX to show that UI on form
Microsoft Visual C++ 2005 express edition?
I am a college student and have worked in C++ before but in the Unix environment. I just started using Visual C++ Express Edition (Version 8.0). I am using it for a data mining project. So I have to work with a MySQL database which is present on my local windows machine.
I have some very basic questions:
1.From the IDE when I try to create a new project (File-%26gt;New-%26gt;Project),I see three options. CLR, Win 32 and General. Each option has a few templates, I am not sure what do these options mean and what is the best option for me, can anyone explain this briefly ?
2.I want to use the BOOST library(for some algorithms) and MySQL++ library (connection to MySQL database) and STL. Where do I add these libraries to my project? Do I have to build them seperately ? What does building a library mean ?
Thanks
Microsoft Visual C++ 2005 express edition?
You said you had previous C++ programming experience?
Q1:
CLR refers to managed C++. Managed C++ is the .NET version of C++, so if you are running standard C++ code, this is not what you want.
Win32 refers to Win32 applications. Only pick this if you are writing specific Win32 API code. That is, no console window. You know how to use the Win32 API. And so on.
I'm not sure what general means. Is there an option for command line? If not, general would refer to the command line programs. It's a good bet this is the kind of program you want to write.
Q2:
I don't recall the exact steps for adding libraries and includes. You'll have to open up the project settings. Somewhere, you should be able to add in include paths and lib paths. For each library you want to use, add the appropriate include folder to the include path list, and the library folder to the library path list.
%26gt; Do I have to build them seperately ?
You'll want to build the libraries you use before using them. Otherwise, you can't use them.
%26gt; What does building a library mean ?
Why do you compile code? Because otherwise it's useless. You want to use a library right? A library is a bunch of code. But it's useless as code. You need it to be compiled to be usable.
EDIT: What do you mean by use the STL? Do you mean STLPort? Visual C++ comes with a solid implementation of the STL, so you don't really need STLPort.
I have some very basic questions:
1.From the IDE when I try to create a new project (File-%26gt;New-%26gt;Project),I see three options. CLR, Win 32 and General. Each option has a few templates, I am not sure what do these options mean and what is the best option for me, can anyone explain this briefly ?
2.I want to use the BOOST library(for some algorithms) and MySQL++ library (connection to MySQL database) and STL. Where do I add these libraries to my project? Do I have to build them seperately ? What does building a library mean ?
Thanks
Microsoft Visual C++ 2005 express edition?
You said you had previous C++ programming experience?
Q1:
CLR refers to managed C++. Managed C++ is the .NET version of C++, so if you are running standard C++ code, this is not what you want.
Win32 refers to Win32 applications. Only pick this if you are writing specific Win32 API code. That is, no console window. You know how to use the Win32 API. And so on.
I'm not sure what general means. Is there an option for command line? If not, general would refer to the command line programs. It's a good bet this is the kind of program you want to write.
Q2:
I don't recall the exact steps for adding libraries and includes. You'll have to open up the project settings. Somewhere, you should be able to add in include paths and lib paths. For each library you want to use, add the appropriate include folder to the include path list, and the library folder to the library path list.
%26gt; Do I have to build them seperately ?
You'll want to build the libraries you use before using them. Otherwise, you can't use them.
%26gt; What does building a library mean ?
Why do you compile code? Because otherwise it's useless. You want to use a library right? A library is a bunch of code. But it's useless as code. You need it to be compiled to be usable.
EDIT: What do you mean by use the STL? Do you mean STLPort? Visual C++ comes with a solid implementation of the STL, so you don't really need STLPort.
Subscribe to:
Posts (Atom)