Jump to content

c# and api functions

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
6 replies to this topic

#1
Computer Engineer

Computer Engineer

    Newbie

  • Members
  • PipPip
  • 14 posts
hello every body
please can you help me
how to use api functions in c#

such as :
- eject cd drive
- restart the os
- shutdown the monitor

#2
Davide

Davide

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 506 posts
I doubt that you can shut down the monitor in C#. That's hardware-based.

To restart:
using Microsoft.Win32;
and then
System.Diagnostics.Process.Start("ShutDown","/r");

as for the CD, try this: How to Eject CD tray using Win32 API Samples and examples - C#, VB.NET, ASP.NET
If you ask me, I'd rather write a .bat file and then run it from my C# application. (Or prompt the user to do that himself :P )
Are you a newbie programmer trying to learn C#? Check out my small tutorial: Visual C# Programming Basics

#3
Computer Engineer

Computer Engineer

    Newbie

  • Members
  • PipPip
  • 14 posts
please if you have advanced books in c# send me at
eng_shakercom@yahoo.com

thank you so much

#4
Davide

Davide

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 506 posts
A simple Google search for "using API's c#" or "C# win32 api" would get you good results.
Start with this:
C# And API's|C# Help – C# Tutorials Resources
And if you ask me, C++ would be better if you want to use Win32 API's, even if it takes longer, you can do much more powerful programs.
Are you a newbie programmer trying to learn C#? Check out my small tutorial: Visual C# Programming Basics

#5
Computer Engineer

Computer Engineer

    Newbie

  • Members
  • PipPip
  • 14 posts
thank you Davide can we be friends :)

#6
Davide

Davide

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 506 posts
Sure, add me to your MSN: davide.vitelaru@live.com
Are you a newbie programmer trying to learn C#? Check out my small tutorial: Visual C# Programming Basics

#7
TkTech

TkTech

    The Crazy One

  • Moderators
  • 1,396 posts
De-facto standard site for using the win32 API from .NET is pinvoke.net: the interop wiki!.