Home Archive April> Archive> 2011

Archives April 2011

UAC corresponding [C #] application

Note If you want to change the behavior in the administrative privileges and general authority on the application side

  1. I judge from the version information of the OS <br /> whether the application has been started in WindowsVista or later has been started in (UAC installed OS) WindowsVista or later

    using System; private bool IsUAC() { OperatingSystem osInfo = Environment.OSVersion; if (osInfo.Platform == PlatformID.Win32NT) { if (osInfo.Version.Major == 6) { if (osInfo.Version.Minor == 0) { // Windows Vista, Windows Server 2008 return true; } else if (osInfo.Version.Minor == 1) { // Windows 7, Windows Server 2008 R2 return true; } } else if (osInfo.Version.Major > 6) { // new Windows return true; } } return false; } 
  2. When <br /> application is "Run as administrator" whether the application has been started with administrator privileges

     using System.Security.Principal; private bool IsAdministrator() { bool isAllowed = false; try { WindowsIdentity wi = WindowsIdentity.GetCurrent(); WindowsPrincipal wp = new WindowsPrincipal(wi); isAllowed = wp.IsInRole(WindowsBuiltInRole.Administrator); } catch { isAllowed = false; } return isAllowed; } 
  3. The user who started the application when you want to know the user who started even have been started by the general authority whether promoted to the administrator <br /> application belongs to the Administrators group

     using System.DirectoryServices.AccountManagement; private bool IsAdministrators() { bool isAllowed = false; try { PrincipalContext pc = new PrincipalContext(ContextType.Machine, null); UserPrincipal up = UserPrincipal.Current; GroupPrincipal gp = GroupPrincipal.FindByIdentity(pc, "Administrators"); if (up.IsMemberOf(gp)) { isAllowed = true; } } catch { isAllowed = false; } return isAllowed; } 

    Ish not working well in some environments it's the above code? More of the code below is be sure.

     using System.DirectoryServices.AccountManagement; private bool IsAdministrators() { bool isAllowed = false; try { PrincipalContext pc = new PrincipalContext(ContextType.Machine, null); UserPrincipal up = UserPrincipal.Current; foreach (GroupPrincipal gp in up.GetGroups()) { try { if (gp.Name.ToLower().Equals("Administrators".ToLower())) { isAllowed = true; } } finally { gp.Dispose(); } } } catch { isAllowed = false; } return isAllowed; } 
  4. Restart with administrator privileges themselves in case it becomes necessary to administrative privileges when performing <br /> process to restart with administrator privileges the application

     using System; using System.Diagnostics; private void RestartApplication() { ProcessStartInfo psi = new ProcessStartInfo(); psi.UseShellExecute = true; psi.WorkingDirectory = Environment.CurrentDirectory; psi.FileName = Application.ExecutablePath; psi.Verb = "runas"; try { Process p = Process.Start(psi); } catch { return; } Application.Exit(); } 
  5. Show icon UAC (vertical) to the button to inform the user that need administrator privileges to continue <br /> operation that displays the icon UAC (vertical) to the button that require administrative privileges (There is a difference in the shield icon in the Win32API and shield icon of SystemIcons.Shield property, it's being used as a standard in Windows 7 is. is more of Win32 API)

     using System; using System.Windows.Forms; using System.Runtime.InteropServices; namespace Sample { public partial class Form1 : Form { [DllImport("user32.dll")] private static extern IntPtr SendMessage(HandleRef hWnd, uint Msg, IntPtr wParam, IntPtr lParam); // 第2パラメータ:盾アイコンを設定するフラグ uint BCM_SETSHIELD = 0x0000160C; public Form1() { InitializeComponent(); // ボタンの外観を「System」にする必要がある button1.FlatStyle = FlatStyle.System; } private void checkBox1_CheckedChanged(object sender, EventArgs e) { // 第1パラメータ:ボタンのウィンドウ・ハンドル HandleRef hwnd = new HandleRef(button1, button1.Handle); if (checkBox1.Checked) { SendMessage(hwnd, BCM_SETSHIELD, new IntPtr(0), new IntPtr(1)); } else { SendMessage(hwnd, BCM_SETSHIELD, new IntPtr(0), new IntPtr(0)); } } } } 
ツイート Tweets

Part 7 Touch Diamond Environment memo

Settings Note when you be able to use the radio
FMラジオ

  • Replacement of DLL

    I you put the sensitivity of the antenna becomes a little better.

    1. 1.09.25.23 rilphone.cab run, and then transfers the Touch Diamond a
  • Restriction release of Band

    Will be available for selection by changing the value of the registry part of the 76.0 ~ 90.0MHz is the frequency band of Japan since 87.5 ~ 108.0MHz because you can not set a range of set of remains of the original.

    1. FM_JP.cab run, and then transfers to the Touch Diamond
       [HKEY_LOCAL_MACHINE\Software\HTC\FMRadio\FMPlayer] “Band”=dword:0000000 1 
  • Listen FM radio with earphones you are using everyday

    It is possible to listen to the radio without a microphone with earphones included when you use USB audio adapter "slim".

    1. Audio USB adapter "slim" I buy.

Note: Change in Japan corresponding frequency band of the FM radio of Japan non-compliant

ツイート Tweets

Part 6 Touch Diamond Environment memo

Described because a request is received to want to write about setting EMnet mail and SMS.
SMS受信確認設定画面

  • Delete ArcMMS

    Run the DelArcMMS.mscr, to delete the related ArcMMS

    1. DelArcMMS.mscr run, and then transfers to the Touch Diamond
      (You should be able to run for MortScript is already in BsB6.5.1G, but if you can not MortScript-4.2-PPC.cab please run after installation.)
  • Preparing for the MMS Lite installation

    And writes the registry information or to be able to receive SMS in MMS Lite by running PreSetupMMSLite.exe.

    1. PreSetupMMSLite.zip were thawed, run, and then transfers the Touch Diamond a PreSetupMMSLite.exe
  • Installation of MSS Lite

    You want to make available the SMS and MMS to install the MMSLite.1.1.320.wm6.cab

    1. MMSLite.1.1.320.wm6.cab run, and then transfers to the Touch Diamond
  • Setting MMSLite

    And allow these users to rewrite it with their environment MMSLite.mscr, to reflect the setting

    1. MMSLite.mscr Download the, to modify the e-mail address, etc.
       Case(YES) RegWriteDword( "HKCU", "Software\MMS Lite\Profiles\MMS", "AllowDeliveryReport" , 1 ) RegWriteDword( "HKCU", "Software\MMS Lite\Profiles\MMS", "AllowReadReport" , 1 ) RegWriteDword( "HKCU", "Software\MMS Lite\Profiles\MMS", "AutoRetry" , 1 ) RegWriteString( "HKCU", "Software\MMS Lite\Profiles\MMS", "EmailAddres", " 自分のメールアドレス@emnet.ne.jp " ) RegWriteDword( "HKCU", "Software\MMS Lite\Profiles\MMS", "ForceAutoRecv" , 1 ) RegWriteDword( "HKCU", "Software\MMS Lite\Profiles\MMS", "ForceConnect" , 0 ) RegWriteString( "HKCU", "Software\MMS Lite\Profiles\MMS", "MmsGateway", " 10.56.46.1:8080 " ) RegWriteString( "HKCU", "Software\MMS Lite\Profiles\MMS", "MmsServer", " http://mms.internal.emnet.ne.jp " ) RegWriteDword( "HKCU", "Software\MMS Lite\Profiles\MMS", "MsgDurationPeriod" , 0 ) RegWriteDword( "HKCU", "Software\MMS Lite\Profiles\MMS", "RequireDeliveryReport" , 0 ) RegWriteDword( "HKCU", "Software\MMS Lite\Profiles\MMS", "RetryCount" , 0 ) RegWriteDword( "HKCU", "Software\MMS Lite\Profiles\MMS", "RetryTimeout" , 30 ) RegWriteDword( "HKCU", "Software\MMS Lite\Profiles\MMS", "SaveSent" , 1 ) RegWriteDword( "HKCU", "Software\MMS Lite\Profiles\MMS", "ServerPort" , 80 ) RegWriteString( "HKCU", "Software\MMS Lite\Profiles\MMS\UserAgent", " Default ", " S21HT " ) RegWriteString( "HKCU", "Software\MMS Lite\Profiles\MMS\UserAgent", " S21HT ", " S21HT/ArcSoft-MMSUA-PPC-v50 " ) RegWriteDword( "HKCU", "Software\MMS Lite\Profiles\MMS\Connections", " EMnet " , 0 ) 
    2. Run, and then transfers the Touch Diamond a MMSLite.mscr that fix
  • Checking the Configuration

    I make sure the settings are are reflected

    1. that those of EMnet is selected to: The "Select the connection to use"
    2. "E-mail address:" It seems there is no problem to send the phone number would have been displayed in, but addresses are recorded in the registry information, but people anxious to change address.

The Reference: Touch Diamond ROM that was baked EMnet mail (S21HT).

ツイート Tweets

Home Archive April> Archive> 2011

Search
Feed
Translation
Japanese flagEnglish flag

I return to the top of the page