Android SDK는 개발자에게 특정 API 인 기기 관리 API를 제공하여 사용자가 애플리케이션 내에서 기기 화면을 직접 잠글 수 있도록합니다.

 

1. 전용 XML 정책 파일 만들기

    res/xml/policies.xml

<?xml version="1.0" encoding="utf-8"?>
<device-admin xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-policies>
        <force-lock />
    </uses-policies>
</device-admin>


2. 장치 관리 API 사용 선언 : AndroidManifest.xml

 

<application
....
>
	<activity
    ...
    >
    ...
	</activity>
    
	<receiver android:name=".MyAdmin" android:permission="android.permission.BIND_DEVICE_ADMIN">
		<meta-data android:name="android.app.device_admin" android:resource="@xml/policies" />
		<intent-filter>
		<action android:name="android.app.action.DEVICE_ADMIN_ENABLED"/>
		</intent-filter>
	</receiver>
    
</application>

 

3. DeviceAdminReceiver의 서브 클래스 작성

package com.ssaurel.lockdevice;

import android.app.admin.DeviceAdminReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;


public class MyAdmin extends DeviceAdminReceiver {

	@Override
	public void onEnabled(Context context, Intent intent) {
		Toast.makeText(context, "Device Admin : enabled", Toast.LENGTH_SHORT).show();
	}

	@Override
	public void onDisabled(Context context, Intent intent) {
		Toast.makeText(context, "Device Admin : disabled", Toast.LENGTH_SHORT).show();
	}
}

 

 

4. 사용자 인터페이스 생성

 

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
	xmlns:app="http://schemas.android.com/apk/res-auto"
	xmlns:tools="http://schemas.android.com/tools"
	android:layout_width="match_parent"
	android:layout_height="match_parent"
	tools:context="com.ssaurel.lockdevice.MainActivity">

    <Button
    android:id="@+id/lock"
    android:layout_width="200dp"
    android:layout_height="wrap_content"
    android:layout_marginTop="50dp"
    android:text="Lock the Phone"
    android:layout_centerHorizontal="true"/>

    <Button
    android:id="@+id/enableBtn"
    android:layout_width="200dp"
    android:layout_height="wrap_content"
    android:layout_marginTop="50dp"
    android:text="Enable"
    android:layout_centerHorizontal="true"
    android:layout_below="@id/lock"/>

    <Button
    android:id="@+id/disableBtn"
    android:layout_width="200dp"
    android:layout_height="wrap_content"
    android:layout_marginTop="50dp"
    android:text="Disable"
    android:layout_centerHorizontal="true"
    android:layout_below="@id/enableBtn"/>

</RelativeLayout>

 

5. 주요 활동의 Java 코드 작성

public class MainActivity extends AppCompatActivity implements View.OnClickListener{

    private Button lock, disable, enable;
    public static final int RESULT_ENABLE = 11;
    private DevicePolicyManager devicePolicyManager;
    private ComponentName compName;

    @Override
    public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      devicePolicyManager = (DevicePolicyManager) getSystemService(DEVICE_POLICY_SERVICE);
      compName = new ComponentName(this, MyAdmin.class);

      lock = (Button) findViewById(R.id.lock);
      enable = (Button) findViewById(R.id.enableBtn);
      disable = (Button) findViewById(R.id.disableBtn);
      lock.setOnClickListener(this);
      enable.setOnClickListener(this);
      disable.setOnClickListener(this);
    }

    @Override
    protected void onResume() {
      super.onResume();
      boolean isActive = devicePolicyManager.isAdminActive(compName);
      disable.setVisibility(isActive ? View.VISIBLE : View.GONE);
      enable.setVisibility(isActive ? View.GONE : View.VISIBLE);
    }

// ...
}

6. onActivityResult

...

public class MainActivity extends AppCompatActivity implements View.OnClickListener{

  private Button lock, disable, enable;
  public static final int RESULT_ENABLE = 11;
  private DevicePolicyManager devicePolicyManager;
  private ComponentName compName;

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    devicePolicyManager = (DevicePolicyManager) getSystemService(DEVICE_POLICY_SERVICE);
    compName = new ComponentName(this, MyAdmin.class);

    lock = (Button) findViewById(R.id.lock);
    enable = (Button) findViewById(R.id.enableBtn);
    disable = (Button) findViewById(R.id.disableBtn);
    lock.setOnClickListener(this);
    enable.setOnClickListener(this);
    disable.setOnClickListener(this);
  }

  @Override
  protected void onResume() {
    super.onResume();
    boolean isActive = devicePolicyManager.isAdminActive(compName);
    disable.setVisibility(isActive ? View.VISIBLE : View.GONE);
    enable.setVisibility(isActive ? View.GONE : View.VISIBLE);
  }

  @Override
  public void onClick(View view) {
    if (view == lock) {
      boolean active = devicePolicyManager.isAdminActive(compName);

      if (active) {
        devicePolicyManager.lockNow();
      } else {
        Toast.makeText(this, "You need to enable the Admin Device Features", Toast.LENGTH_SHORT).show();
      }

    } else if (view == enable) {
      Intent intent = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN);
      intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, compName);
      intent.putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION, "Additional text explaining why we need this permission");
      startActivityForResult(intent, RESULT_ENABLE);

    } else if (view == disable) {
      devicePolicyManager.removeActiveAdmin(compName);
      disable.setVisibility(View.GONE);
      enable.setVisibility(View.VISIBLE);
    }
  }

  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    switch(requestCode) {
      case RESULT_ENABLE :
        if (resultCode == Activity.RESULT_OK) {
          Toast.makeText(MainActivity.this, "You have enabled the Admin Device features", Toast.LENGTH_SHORT).show();
        } else {
          Toast.makeText(MainActivity.this, "Problem to enable the Admin Device features", Toast.LENGTH_SHORT).show();
        }
      break;
    }
    
	super.onActivityResult(requestCode, resultCode, data);
  }
}

 

 

펌) https://medium.com/@ssaurel/creating-a-lock-screen-device-app-for-android-4ec6576b92e0

재보시財布施는 금전이나 재물로써 남을 이

롭게 하는 것이고,

법보시法布施는 부처님의 가르침, 즉 진리를 가르쳐 줌으로써 중생을 이익되게 하는 것이다.

무외시無畏施는 계율을 지녀 남을 해치지 않고 두려워하는 마음이 없게 하여 평안하게 해 주는 것.

육肉보시(몸보시)는 몸으로 하는 힘든 보시를 말하여 청소하는일 불기딱는일 등이다

재능才能보시는 일을 하는 데 필요한 재주와 능력을 제공하는 기술인데 악기연주등을 말한다

 

 

량(양)자역학을 파고 들면 막다른길에서

색증시공 공즉시색(色卽是空空卽是色) 이라는 말이 절로 나온다.

불교에서는 이미 수천년 수억년전에 우주의 진리를 파악 했을것이다.

 

 

http://encykorea.aks.ac.kr/Contents/Item/E0027487

 

참고문헌

  • 『반약파라밀다심경찬(般若波羅蜜多心經贊)』(원측)

  • 반약심경 (이기영 역해, 한국불교연구원, 1979)

양자역학으로 이해하는 원자의 세계
국내도서
저자 : 곽영직
출판 : Gbrain(지브레인) 2016.04.01
상세보기

'' 카테고리의 다른 글

아스트라 제네카 백신 맞았어요  (0) 2021.06.10
보아라! 나의 대통령 이시다  (1) 2021.05.24
2021.05.21 한미정상 노마스크 회담  (0) 2021.05.22

0. powershell 이란?

https://docs.microsoft.com/ko-kr/powershell/scripting/getting-started/getting-started-with-windows-powershell?view=powershell-6

 

1. regedit로 직접 편집 하기

HKEY_CLASSES_ROOT
    => Directory
         => Background
              => shell 
                   ==> 새로만들기 : Key "Show TaskBar"
                          ==> Show TaskBar에 Key 새로만들기 "command"                              
                   또는 ==> command의 (기본값) "powershell -executionpolicy unrestricted c:\ViewTaskBar.ps1"

2. Shell_TrayWnd 를 보이게 하는 powershell script

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\ViewTaskBar\command]
@="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell -executionpolicy unrestricted c:\\ViewTaskBar.ps1"

[HKEY_CLASSES_ROOT\Directory\Background\shell\HideTaskBar\command]
@="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell -executionpolicy unrestricted c:\\HideTaskBar.ps1"

[HKEY_CLASSES_ROOT\Directory\Background\shell\SetTaskBar\command]
@="explorer ms-settings:taskbar"

 

3. c:\ViewTaskBar.ps1

$sig = @"
  [DllImport("user32.dll", CharSet = CharSet.Unicode)]
  public static extern IntPtr FindWindow( String sClassName, IntPtr sAppName);

  [DllImport("kernel32.dll")]
  public static extern uint GetLastError();

  [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
  public static extern IntPtr SendMessage( IntPtr hwnd, uint Msg, uint wParam, uint lParam);

  [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
  public static extern IntPtr ShowWindow( IntPtr hwnd, uint Msg);
"@

$fw = Add-Type -Namespace Win32 -Name Funcs -MemberDefinition $sig -PassThru
$hwnd = Add-Type -Namespace Win32 -Name Funcs -MemberDefinition $sig -PassThru

$sClassName='Shell_TrayWnd' # any existing window name
$wname='Shell_TrayWnd' # any existing window name

$hwnd = $fw::FindWindow( $sClassName, [IntPtr]::Zero ) # returns the Window Handle
$hwnd
$a = $fw::GetLastError()
$a
# WM_SHOWWINDOW 24
# SW_SHOW = 5
# SW_HIDE = 0
#
$fw::SendMessage( $hwnd, 24, 5, 0 ) # OnShowWindow만 콜한다.
$fw::ShowWindow( $hwnd, 5) # 여그서 결정타를 날려야 홈인이다.

4. HideTaskBar.ps1

$sig = @"
  [DllImport("user32.dll", CharSet = CharSet.Unicode)]
  public static extern IntPtr FindWindow( String sClassName, IntPtr sAppName);

  [DllImport("kernel32.dll")]
  public static extern uint GetLastError();

  [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
  public static extern IntPtr SendMessage( IntPtr hwnd, uint Msg, uint wParam, uint lParam);

  [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
  public static extern IntPtr ShowWindow( IntPtr hwnd, uint Msg);
"@

$fw = Add-Type -Namespace Win32 -Name Funcs -MemberDefinition $sig -PassThru
$hwnd = Add-Type -Namespace Win32 -Name Funcs -MemberDefinition $sig -PassThru

$sClassName='Shell_TrayWnd' # any existing window name
$wname='Shell_TrayWnd' # any existing window name

$hwnd = $fw::FindWindow( $sClassName, [IntPtr]::Zero ) # returns the Window Handle
$hwnd
$a = $fw::GetLastError()
$a
# WM_SHOWWINDOW 24
# SW_SHOW = 5
# SW_HIDE = 0
#
$fw::SendMessage( $hwnd, 24, 0, 0 ) # OnShowWindow만 콜한다.
$fw::ShowWindow( $hwnd, 0) # 여그서 결정타를 날려야 홈인이다.

5. Set Taskbar


HKEY_CLASSES_ROOT\Directory\Background\shell\SetTaskBar\command
	explorer ms-settings:taskbar

'Visual Studio C++' 카테고리의 다른 글

CDialog에서 xp 스타일 적용  (0) 2019.12.30
MFC 편집용 커서 그리기  (0) 2019.12.20
VC++ Macro __FILE__에서 경로 제거 후 표시 하기  (0) 2019.12.13
C# DLL을 C++에서 사용 하기  (0) 2019.12.06
AfxBeginThread  (0) 2019.11.26

1) MySQL 5.7.28 다운로드

https://dev.mysql.com/downloads/file/?id=489911

 

 

MySQL :: Begin Your Download

The world's most popular open source database

dev.mysql.com

2) PHP 7 다운로드

https://windows.php.net/download#php-7.3

 

PHP For Windows: Binaries and sources Releases

PHP 7.3 (7.3.10) Download source code [26.96MB] Download tests package (phpt) [14.18MB] VC15 x64 Non Thread Safe (2019-Sep-26 08:53:57) Zip [24.39MB] sha256: 46475c3b079556f0c46bf9d20f26130a9a369148be502794f93ba1cfc354f911 Debug Pack [23.01MB] sha256: 55cd

windows.php.net

3) Apache2 httpd 다운로드

https://www.apachelounge.com/download/

 

Apache VS16 binaries and modules download

Apache 2.4 VS16 Windows Binaries and Modules Apache Lounge has provided up-to-date Windows binaries and popular third-party modules for more than 15 years. We have hundreds of thousands of satisfied users: small and big companies as well as home users. Alw

www.apachelounge.com

 

Download the Windows Driver Kit (WDK)

 

https://docs.microsoft.com/ko-kr/windows-hardware/drivers/download-the-wdk

 

 

Download the Windows Driver Kit (WDK) - Windows drivers

Download instructions for the latest released version of the Windows Driver Kit (WDK)

docs.microsoft.com

*) 참고사이트

https://wezz.tistory.com/287

http://www.osronline.com/

 

OSR Online - The Home Page for Windows Driver Developers

Welcome!OSRONLINE is OSR's Legacy Community Site For information about our OSR's seminars and services, please visit our Corporate site at http://www.osr.com. Welcome to OSR's original community web site, named "OSRONLINE." Established back in 2004, it con

www.osronline.com

 

+ Recent posts