hi
I 'm beginner . I want to program automatic switch display mode to internal.
My program is:
1. read display mode (internal, clone ,...)
2. if display mode is (clone,Extend,duplicat)program change automatic to internal mode
3. if I change manually to other mode program change automatic to internal
4. programming Err: if program not change display to internal mode show "Failed"
please help me to write this program (suorce code please) . thank you
Thank you dear Duthomhas
I try this code with dev c++ compiler but I show Err and nothing else. please test it and share your test code ( with #include ,...) thank you for all.
A large part of programming is studing how to do things.
But, since I’m bored and feeling kind of nice right now, the basics are:
1 2
if (system( "displayswitch /internal" ))
std::cout << "Failed\n";
All of this is easily gleaned from the link I gave you, and should have taken no more than a couple of google searches to learn more about the available choices.
using System;
privatevoid SetDisplayMode(DisplayMode mode)
{
var proc = new Process();
proc.StartInfo.FileName = "DisplaySwitch.exe";
switch (mode)
{
case DisplayMode.External:
proc.StartInfo.Arguments = "/external";
break;
case DisplayMode.Internal:
proc.StartInfo.Arguments = "/internal";
break;
case DisplayMode.Extend:
proc.StartInfo.Arguments = "/extend";
break;
case DisplayMode.Duplicate:
proc.StartInfo.Arguments = "/clone";
break;
}
proc.Start();
}
enum DisplayMode
{
Internal,
External,
Extend,
Duplicate
}
2. use cmd compiler (dot net 4) with this code csc testclass.cs
3. compile fail and show this err
1 2 3 4 5 6 7 8 9 10
C:\Windows\Microsoft.NET\Framework64\v4.0.30319>csc testclass.cs
Microsoft (R) Visual C# 2010 Compiler version 4.0.30319.1
Copyright (C) Microsoft Corporation. All rights reserved.
testclass.cs(3,9): error CS1518: Expected class, delegate, enum, interface, or
struct
testclass.cs(5,16): error CS1518: Expected class, delegate, enum, interface, or
struct
testclass.cs(23,1): error CS1022: Type or namespace definition, or end-of-file
expected
what's problem?please edit this source code to true .I dont know what is my problem ?Thanks
Thank you dear Duthomhas . I solve it and creat final c++ file. Your helps are very important for me . Thank you again ...
I click Report for send "Worked..." . I use thid site for first time . Is it correct for feed back good response(use report)? if no I 'm very sorry for my mistake