locked
Help in windows api programming RRS feed

  • Question

  • Asalam-o-Alikum...!!!

     

                 i m new to windows api programming in vc++ 6.0. I want to write a simple progam in vc++ 6.0 that shutdown the computer. this program must use ExitWindowsEx function of some dll file of windows (hopefully user32.dll).

     

    i want also to get knowledge about different data types of windows.

    like word, Dword, etc...

     

    Just give me the code of some simple programs that use windows api in vc++ 6.0. plz remember i dont have any idea about calling windows api in vc++ 6.0. ur code must be of beginner level.

     

    Thanks in advance.

    Thursday, September 27, 2007 6:41 PM

Answers

  • Well...why do you need to write such a program in the first place? I am not sure whether this is the correct approach to start learning programming with the API.

    Other than that, take a look at the following tutorial:

    theForger's Win32 API Tutorial
    Thursday, September 27, 2007 7:07 PM
  • You shouldn't attempt to get into the Windows API if you are not serious about it, it isn't easy to learn at all and can be confusing.

    Yes, windows is mainly written in C/C++ so getting access to the API is easier through this language but you will have to learn it to begin with.

    First of all, can you program in C/C++ well, if you can't then you should get a good book and learn that for. After that you should then start looking into basic windows programming there are quite a few good ones. Programming Windows by Charles Petzold is still one of the better ones I know of.

    As a quick hint though.

    include windows.h first of all.

     

    #include <windows.h>

     

    Then in your code have the call to ExitWindowsEx.

     

    ExitWindowsEx(EWX_POWEROFF, 0);

     

    This will then Shutdown Windows and then turn the power off.

    Thursday, September 27, 2007 9:35 PM

All replies

  • Well...why do you need to write such a program in the first place? I am not sure whether this is the correct approach to start learning programming with the API.

    Other than that, take a look at the following tutorial:

    theForger's Win32 API Tutorial
    Thursday, September 27, 2007 7:07 PM
  • do u want to know ? why i want to do so ???

     

    Actually i have take a project in java.  and I have to shutdown, restart, log off and also i have to get the complete access of a remote pc. i know its becoming a trojan horse. but i want to do so just for learning. there is no other cause behind this. my teacher suggested me use the windows api for this purpose. but when i started the project. i didnt know that calling windows api is difficult in java. coz java uses the jni for this purpose. and ultimately jni uses the native methods of c++. so is possible in vc++ directly. thats y i started the vc++. but i dont have any idea that how i will do it in vc++. therefore im searching for help. so plz help me if u have knowledge about that. coz i have to complete my project.

     

    send me small and easy code that i works. and also that r understandable for me.

     

    thank u very much.

    i hope some 1 will help me.

    Thursday, September 27, 2007 7:20 PM
  • You shouldn't attempt to get into the Windows API if you are not serious about it, it isn't easy to learn at all and can be confusing.

    Yes, windows is mainly written in C/C++ so getting access to the API is easier through this language but you will have to learn it to begin with.

    First of all, can you program in C/C++ well, if you can't then you should get a good book and learn that for. After that you should then start looking into basic windows programming there are quite a few good ones. Programming Windows by Charles Petzold is still one of the better ones I know of.

    As a quick hint though.

    include windows.h first of all.

     

    #include <windows.h>

     

    Then in your code have the call to ExitWindowsEx.

     

    ExitWindowsEx(EWX_POWEROFF, 0);

     

    This will then Shutdown Windows and then turn the power off.

    Thursday, September 27, 2007 9:35 PM
  • As crescens2k indicates, it would help to learn C++ first. To learn C++, you can use a book or tutorial about just C++ and the programs can be compiled and executed by VC as command-line (also known as console) programs.

     

    There are many sample programs provided with VC and with the Windows (Platform) SDK. They are probably already installed in your local hard drive or one of them. There is also documentation of the SDK in the SDK that is essentially a copy of the SDK documentation in the MSDN.

     

    Friday, September 28, 2007 3:00 AM
  •  

    Thanks for ur help guys. I am really serious in learning win32 programing. But problem is that i have got very short time to complete my project. therefore, i m asking about shortcuts. When i will complete my project then i have an aim to get deeper into win32 programing.

     

    therefore plz plz give me some idea about win32 progaming as a quick quide and also provide me short programs that i can easily understant. and then i may able to write my own short programs that meet my goal.

     

    Thank you very very much...!!!

    Friday, September 28, 2007 7:06 AM
  • Friday, September 28, 2007 11:10 AM
  •  

    Plz help me. i m in trouble.

     

    plz plz

    Saturday, September 29, 2007 4:40 AM