Tuesday, 31 October 2017

[DELPHI] ClientSocket/ServerSocket.

TClientSocket and TServerSocket missing from XE8

How to install TClientSocket and TServerSocket back into your Delphi / C++ Builder XE8 RadStudio IDE.
  • Select the menu Component->Install Packages
  • Click on the Add... button
  • Navigated to your XE8 install directory probably C:\Program Files (x86)\Embarcadero\Studio\16.0\bin
  • Select dclsockets220.bpl and press open

TclientSocket和TserverSocket

ClientSocket组件为客户端组件。它是通信的请求方,也就是说,它是主动地与服务器端建立连接。

ServerSocket组件为服务器端组件。它是通信的响应方,也就是说,它的动作是监听以及被动接受客户端的连接请
求,并对请求进行回复。

DelphiXE Android的所有权限按照分类总结说明

DelphiXE Android的所有权限按照分类总结说明

相关资料:http://www.delphitop.com/html/Android/2778.html
 
网络相关的:
android.permission.INTERNET 允许程序打开网络套接字
android.permission.CHANGE_NETWORK_STATE 允许程序改变网络连接状态
android.permission.ACCESS_NETWORK_STATE  允许程序访问有关GSM网络信息
 
 
位置相关:
android.permission.WRITE_GSERVICES
允许程序修改Google服务地图(Allows an application to modify the Googleservice map. )
 
android.permission.ACCESS_COARSE_LOCATION
允许一个程序访问CellID或WiFi热点来获取粗略的位置(Allows anapplication to access coarse (e.g., Cell-ID, WiFi) location)
android.permission.ACCESS_FINE_LOCATION
允许一个程序访问精良位置(如GPS) (Allows an application to access fine (e.g., GPS)location)
android.permission.ACCESS_LOCATION_EXTRA_COMMANDS
允许应用程序访问额外的位置提供命令(Allows anapplication to access extra location provider commands)
android.permission.ACCESS_MOCK_LOCATION
允许程序创建模拟位置提供用于测试(Allows anapplication to create mock location providers for testing)
android.permission.CONTROL_LOCATION_UPDATES
允许启用禁止位置更新提示从无线模块(Allows enabling/disabling location update notifications from the radio. )
 
 
 
wifi相关:
android.permission.ACCESS_COARSE_LOCATION  允许一个程序访问CellID或WiFi热点来获取粗略的位置
android.permission.ACCESS_WIFI_STATE  允许程序访问Wi-Fi网络状态信息
android.permission.CHANGE_WIFI_STATE  允许程序改变Wi-Fi连接状态
 
 
蓝牙相关:
android.permission.BLUETOOTH  允许程序连接到已配对的蓝牙设备
android.permission.BLUETOOTH_ADMIN  允许程序发现和配对蓝牙设备
 
 
广播:
android.permission.BROADCAST_PACKAGE_REMOVED
允许程序广播一个提示消息在一个应用程序包已经移除后(Allows anapplication to broadcast a notification that an application package has beenremoved)
android.permission.BROADCAST_STICKY
允许一个程序广播常用intents(Allowsan application to broadcast sticky intents)
android.permission.RECEIVE_BOOT_COMPLETED
允许一个程序接收到ACTION_BOOT_COMPLETED广播在系统完成启动(Allows anapplication to receive the ACTION_BOOT_COMPLETED that is broadcast after thesystem finishes booting. )
 
 
短信相关:
android.permission.READ_SMS
允许程序读取短信息(Allows anapplication to read SMS messages.)
android.permission.RECEIVE_SMS
允许程序监控一个将收到短信息,记录或处理(Allows anapplication to monitor incoming SMS messages, to record or perform processingon them.)
android.permission.SEND_SMS
允许程序发送SMS短信(Allows an application to send SMS messages)
android.permission.WRITE_SMS
允许程序写短信(Allows anapplication to write SMS messages)
android.permission.RECEIVE_MMS
允许一个程序监控将收到MMS彩信,记录或处理(Allows anapplication to monitor incoming MMS messages, to record or perform processingon them. )
android.permission.RECEIVE_WAP_PUSH
允许程序监控将收到WAP PUSH信息(Allows an application to monitor incoming WAP pushmessages. )
 
 
拨打电话相关:
 
android.permission.CALL_PHONE
允许一个程序初始化一个电话拨号不需通过拨号用户界面需要用户确认(Allows anapplication to initiate a phone call without going through the Dialer userinterface for the user to confirm the call being placed.)
android.permission.CALL_PRIVILEGED
允许一个程序拨打任何号码,包含紧急号码无需通过拨号用户界面需要用户确认(Allows anapplication to call any phone number, including emergency numbers, withoutgoing through the Dialer user interface for the user to confirm the call beingplaced)
android.permission.PROCESS_OUTGOING_CALLS
允许程序监视、修改有关播出电话(Allows an application to monitor, modify, or abort outgoing calls)
 
android.permission.READ_CONTACTS
允许程序读取用户联系人数据(Allows anapplication to read the user’s contacts data.)
android.permission.WRITE_CONTACTS
允许程序写入但不读取用户联系人数据(Allows anapplication to write (but not read) the user’s contacts data. )
 
 
 
系统级权限:
android.permission.ADD_SYSTEM_SERVICE
允许程序发布系统级服务(Allows anapplication to publish system-level services).
android.permission.MANAGE_APP_TOKENS
允许程序管理(创建、催后、 z- order默认向z轴推移)程序引用在窗口管理器中(Allows anapplication to manage (create, destroy, Z-order) application tokens in thewindow manager. )
android.permission.DUMP
允许程序返回状态抓取信息从系统服务(Allows anapplication to retrieve state dump information from system services.)
android.permission.INTERNAL_SYSTEM_WINDOW
允许打开窗口使用系统用户界面(Allows anapplication to open windows that are for use by parts of the system userinterface. )
android.permission.MOUNT_UNMOUNT_FILESYSTEMS
允许挂载和反挂载文件系统可移动存储(Allowsmounting and unmounting file systems for removable storage. )
android.permission.READ_LOGS
允许程序读取底层系统日志文件(Allows anapplication to read the low-level system log files. )
android.permission.RECEIVE_BOOT_COMPLETED
允许一个程序接收到ACTION_BOOT_COMPLETED广播在系统完成启动(Allows anapplication to receive the ACTION_BOOT_COMPLETED that is broadcast after thesystem finishes booting. )
android.permission.SET_ACTIVITY_WATCHER
允许程序监控或控制activities已经启动全局系统中Allows an application to watch and controlhow activities are started globally in the system.
android.permission.WRITE_SETTINGS
允许程序读取或写入系统设置(Allows anapplication to read or write the system settings. )
android.permission.WRITE_SYNC_SETTINGS
允许程序写入同步设置(Allowsapplications to write the sync settings)

Friday, 6 October 2017

Delphi XE10 取得android Wifi資訊

[转]http://kamilia1470.pixnet.net/blog/post/199762657-delphi-xe10-%E5%8F%96%E5%BE%97android-wifi%E8%B3%87%E8%A8%8A

網路上查了很多 取得Wifi資訊的方式
但都是XE6 XE7
Code丟到XE10都不能用
以下是XE10測試成功的Code
uses Androidapi.Helpers, Androidapi.JNI.JavaTypes, Androidapi.JNIBridge,
  Androidapi.JNI.GraphicsContentViewText,Androidapi.JNI.Net;
procedure TForm2.FormCreate(Sender: TObject);
var
  Service: JObject;
  WifiManager: JWifiManager;
  ConnectionInfo: JWifiInfo;
  ScanResults: JList;
  ScanResult: JScanResult;
  I: Integer;
begin
  Memo.Lines.Clear;
  Service := SharedActivity.getSystemService(TJContext.JavaClass.WIFI_SERVICE);
  WifiManager := TJWifiManager.Wrap((Service as ILocalObject).GetObjectID);
  if not WifiManager.isWifiEnabled then
    Memo.Lines.Add('Wifi is disabled')
  else
  begin
    ConnectionInfo := WifiManager.getConnectionInfo;
    Memo.Lines.Add('Connection info');
    Memo.Lines.Add('  SSID: ' + JStringToString(ConnectionInfo.getSSID));
    Memo.Lines.Add('  BSSID: ' + JStringToString(ConnectionInfo.getBSSID));
    Memo.Lines.Add('  MAC address: ' + JStringToString(ConnectionInfo.getMacAddress));
    ScanResults := WifiManager.getScanResults;
    for I := 0 to ScanResults.size - 1 do
    begin
      Memo.Lines.Add('');
      Memo.Lines.Add('Detected access point ' + IntToStr(I));
      ScanResult := TJScanResult.Wrap((ScanResults.get(I) as ILocalObject).GetObjectID);
      Memo.Lines.Add('  SSID: ' + JStringToString(ScanResult.SSID));
      Memo.Lines.Add('  BSSID: ' + JStringToString(ScanResult.BSSID));
      Memo.Lines.Add('  Capabilities: ' + JStringToString(ScanResult.capabilities));
      Memo.Lines.Add('  Frequency: ' + IntToStr(ScanResult.frequency) + 'MHz');
      Memo.Lines.Add('  Signal level: ' + IntToStr(ScanResult.level) + 'dBm');
    end
  end
end

Plan Oct 2017

1. Cool water
2. Add wood
3. Road Tex
4. CCTV
5. Doctor

verificar conexion a internet Firemonkey con Rad



Thursday, 5 October 2017

Android获取当前网络状态

转载地址:http://blog.csdn.net/gdutxiaoxu/article/details/53008266


Detect an internet connection activation with Delphi

uses WinInet;

function IsConnected: boolean;
const
  // local system uses a modem to connect to the Internet.
  INTERNET_CONNECTION_MODEM      = 1;
  // local system uses a local area network to connect to the Internet.
  INTERNET_CONNECTION_LAN        = 2;
  // local system uses a proxy server to connect to the Internet.
  INTERNET_CONNECTION_PROXY      = 4;
  // local system's modem is busy with a non-Internet connection.
  INTERNET_CONNECTION_MODEM_BUSY = 8;

var
  dwConnectionTypes : DWORD;
begin
  dwConnectionTypes := INTERNET_CONNECTION_MODEM +
                       INTERNET_CONNECTION_LAN +
                       INTERNET_CONNECTION_PROXY;
  Result := InternetGetConnectedState(@dwConnectionTypes,0);
end;

Delphi 防止程序多次运行《转》

//防止多次打开
unit MultInst;
interface
uses Windows ,Messages, SysUtils, Classes, Forms;
implementation
const
  STR_UNIQUE    = '{2BE6D96E-827F-4BF9-B33E-8740412CDE96}';
  MI_ACTIVEAPP  = 1;  {激活应用程序}
  MI_GETHANDLE  = 2;  {取得句柄}
var
  iMessageID    : Integer;
  OldWProc      : TFNWndProc;
  MutHandle     : THandle;
  BSMRecipients : DWORD;
function NewWndProc(Handle: HWND; Msg: Integer; wParam, lParam: Longint): Longint; stdcall;
begin
  Result := 0;
  if Msg = iMessageID then
  begin
    case wParam of
      MI_ACTIVEAPP: {激活应用程序}
        if lParam<>0 then
        begin
          {收到消息的激活前一个实例}
          {为什么要在另一个程序中激活?}
          {因为在同一个进程中SetForegroundWindow并不能把窗体提到最前}
          if IsIconic(lParam) then
            OpenIcon(lParam)
          else
            SetForegroundWindow(lParam);
          Application.Terminate; {终止本实例}
        end;
      MI_GETHANDLE: {取得程序句柄}
        begin
          PostMessage(HWND(lParam), iMessageID, MI_ACTIVEAPP, Application.Handle);
        end;
    end;
  end
  else
    Result := CallWindowProc(OldWProc, Handle, Msg, wParam, lParam);
end;
procedure InitInstance;
begin
  {取代应用程序的消息处理}
  OldWProc := TFNWndProc(SetWindowLong(Application.Handle, GWL_WNDPROC, Longint(@NewWndProc)));
  {打开互斥对象}
  MutHandle := OpenMutex(MUTEX_ALL_ACCESS, False, STR_UNIQUE);
  if MutHandle = 0 then
  begin
    {建立互斥对象}
    MutHandle := CreateMutex(nil, False, STR_UNIQUE);
  end
  else
  begin
    Application.ShowMainForm  :=  False;
    {已经有程序实例,广播消息取得实例句柄}
    BSMRecipients := BSM_APPLICATIONS;
    BroadcastSystemMessage(BSF_POSTMESSAGE or BSF_POSTMESSAGE,@BSMRecipients,iMessageID,MI_GETHANDLE,Application.Handle);
    //BroadCastSystemMessage(BSF_IGNORECURRENTTASK or BSF_POSTMESSAGE, @BSMRecipients, iMessageID, MI_GETHANDLE,Application.Handle);
  end;
end;
initialization
  {注册消息}
  iMessageID  := RegisterWindowMessage(STR_UNIQUE);
  InitInstance;
finalization
  {还原消息处理过程}
  if OldWProc <> Nil then
    SetWindowLong(Application.Handle, GWL_WNDPROC, LongInt(OldWProc));
  {关闭互斥对象}
  if MutHandle <> 0 then
    CloseHandle(MutHandle);
end.

Delphi获取CPU CPUID《转》

uses
  ActiveX, ComObj;


function GetWMIProperty(WMIType, WMIProperty:AnsiString):String;
var
  Wmi, Objs, Obj:OleVariant;
  Enum:IEnumVariant;
  C:Cardinal;
begin
  try
    Wmi:= CreateOleObject(AnsiString('WbemScripting.SWbemLocator'));
    Objs := Wmi.ConnectServer(AnsiString('.'),AnsiString('root\cimv2')).ExecQuery(AnsiString('Select * from Win32_'+WMIType));

    Enum:=IEnumVariant(IUnknown(Objs._NewEnum));
    Enum.Reset;
    Enum.Next(1,Obj,C);
    Obj:=Obj.Properties_.Item(WMIProperty,0).Value;
    if VarIsArray(Obj) then Result:=Obj[0]
    else Result:=Obj;
  except
     Result:='Error';
  end;
end;


ShowMessage(GetWMIProperty('Processor','ProcessorId'));

【转】http://www.cnblogs.com/LceMeaning/p/7284202.html

手机电脑互传文件的小工具

http://www.mye100.com/filetransfer/

Monday, 2 October 2017

SDK Error


1
C:\Users\Public\Documents\Embarcadero\Studio\17.0\PlatformSDKs\android-sdk-windows\build-tools\22.0.1\ZipAlign.exe
C:\Users\x\AppData\Local\Android\android-sdk\build-tools\26.0.0\ZipAlign.exe

2
C:\Users\Public\Documents\Embarcadero\Studio\17.0\PlatformSDKs\android-sdk-windows\build-tools\22.0.1\Aapt.exe
C:\Users\x\AppData\Local\Android\android-sdk\build-tools\26.0.0

C:\Users\Public\Documents\Embarcadero\Studio\17.0\PlatformSDKs\android-sdk-windows\platforms\android-22
C:\Users\Public\Documents\Embarcadero\Studio\17.0\PlatformSDKs\android-sdk-windows\platforms\android-26

2018 Mar 30 added

zomok E-commerce system plan. Choose your online ordering system. No-risk 30 day free trial. Then USD 9/month. No credit card required.

zomok E-commerce system plan. Choose your online ordering system. No-risk 30 day free trial. Then USD 9/month. No credit card required. h...