ยินดีต้อนรับแขกผู้มาเยือน กรุณา เข้าสู่ระบบ หรือ ลงทะเบียน
ส่งอีเมล์ยืนยันการใช้งาน?
 
Please Login!

แสดงกระทู้

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - sak2005

หน้า: [1] 2 3 ... 63
1
General Programming / Re: HotTips : Delphi XE4
« เมื่อ: 22 พฤษภาคม 2013, 16:08:21 »
วิธีเขียน Class หรือ Unit ใน Delphi

ถ้าใครเขียน Class Form เป็นอย่างเดียว การพัฒนาโปรแกรมใหญ่ๆ จะเป็นไปด้วยความยากลำบาก

เพราะยิ่งเขียน คำสั่งต่างๆก็ต้องใช้มากขึ้นด้วย เวลากลับไปแก้ไขคำสั่งต่างๆที่เขียนไว้

ก็จะเจอคำสั่งที่ปนเปกันไปหมด  ทำให้การแก้ไขคำสั่ง ต้องใช้เวลาหรือแก้ไขได้ยากขึ้น

ฉนั้นถ้าเราแยกคำสั่งออกมาเป็น Unit Class จะทำให้การแก้ไขเพิ่มเติมคำสั่งต่างๆได้ง่ายไม่ซับซ้อน
------------------------------------------------------------------------------------------------------
AnimationWindow Unit class
โค๊ด: [Select]
unit Unit2; //AnimationWindow Class.
interface
 uses
 Windows, Classes;
 type
 TAW = Record
 FADE_IN: Integer;
 FADE_OUT: Integer; //Types DwordFlags Enum.
 EXPLODE: Integer;
 IMPLODE: Integer;
 end;
 var
 AW: TAW;
implementation
function AnimateWindow
 (hWnd: HWND; dwTime: DWORD; dwFlags: TAW): bool; //ImportDll. Create functions.
  stdcall; external 'user32.dll' name 'AnimateWindow';
begin
  AW.FADE_IN:= 524288;
  AW.FADE_OUT:= 589824;
  AW.EXPLODE:= 262160;   //Statement DwordFlags Enum.
  AW.IMPLODE:= 327696;
end.
---------------------------------------------------------------------------------------
Form class Example
โค๊ด: [Select]
unit Unit1; //Form class.
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Unit2; //<-- Import Unit class.
type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
    procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
  AnimateWindow(self.Handle, 1000, AW.EXPLODE);
end;
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
  AnimateWindow(self.Handle, 1000, AW.IMPLODE);
end;
end.

2
General Programming / Re: Run at Startup [vb 2008]
« เมื่อ: 21 พฤษภาคม 2013, 22:04:09 »
ถ้า Startup แบบถาวร ใช้คำสั่งรีจิสทรีย์ Run

ถ้า Startup แบบชั่วคราว ใช้คำสั่งรีจิสทรีย์ RunOnce

3
ลองเขียนด้วยคำสั่ง Strings.InStr ดูครับ เป็นการใช้คำบางคำในข้อความนั้นๆ

4
ถ้าชื่อโปรแกรมมีการเปลี่ยนแปลง ก็ต้องจับโปรเซสที่สกุลของไฟล์คือ *.exe

คล้ายกับคนที่ชอบเปลี่ยนชื่อตัวเอง แต่ยังไม่ได้เปลี่ยนนามสกุล

แต่พอที่จะเดาได้ว่า..เขาคือใคร? เพราะพฤติกรรมไม่ได้เปลี่ยน

อันนี้เป็นข้อเปรียบเทียบให้เห็นภาพชัดขึ้นนะครับ

จะได้มีไอเดียแก้ปัญหาได้ถูกจุด

5
General Programming / Re: HotTips : Delphi XE4
« เมื่อ: 18 พฤษภาคม 2013, 04:44:39 »
Animation Window (FadeIn - FadeOut)

เป็นการใสู่ลูกเล่นตอนปิด-เปิดโปรแกรม
จริงๆแล้วมีลูกเล่นมากกว่านี้ เอาไว้เขียนเป็นไฟล์ DLL จะใช้งานได้สดวกกว่า

โค๊ด: [Select]
unit Unit1;
  interface
  uses
    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    Dialogs, StdCtrls;
  type
    TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
    procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
  private
   { Private declarations }
  public
   { Public declarations }
  end;
  var
    Form1: TForm1;
    const AW_FADE_IN = 524288; //effects constant.
    const AW_FADE_OUT = 589824;
  implementation
    {$R *.dfm}
  function AnimateWindow
    (hWnd: HWND; dwTime: DWORD; dwFlags: DWORD): bool; // Created ImportDll Function
     stdcall; external 'user32.dll' name 'AnimateWindow';
  procedure TForm1.FormCreate(Sender: TObject);
    begin
      try
        AnimateWindow(self.Handle, 1000, AW_FADE_IN); //Animation FadeIn to Run.
      except
        self.Free;
      end;
    end;
  procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
    begin
      try
        AnimateWindow(self.Handle, 1000, AW_FADE_OUT); //Animation FadeOut to Run.
      except
        self.Free;
      end;
    end;
end.

คำชี้แจง : Delphi 2010 กับ Delphi XE4 หมดอายุ ใช้งานไม่ได้แล้ว
              เจ้าของโปรแกรมค่อนข้างฉลาด บันทึกข้อมูลการใช้งานของเราไว้
              ถ้าจะใช้งานต่อ ต้องขอ.. อีแมว เอ๊ยยย! อีเมล์ใหม่ = เป็นผู้ใช้คนใหม่
              ตอนนี้เลยใช้ Delphi 7 ไปพลางๆก่อน Interfade เหมือน VB 6 ยังไงยังงั้น.
-------------------------------------------------------------------------------------------
AnimationWindow.dll : Dinamic Link Library SourceCode
โค๊ด: [Select]
library AnimationWindow;
  uses Windows, Classes;
function AnimateWindow(hWnd: HWND; dwTime: DWORD; dwFlags: DWORD): bool; stdcall; external 'user32.dll' name 'AnimateWindow';
procedure AnimateWindow_AW_DIAG_SLIDE_IN_BOTTOMLEFT(hWnd: HWND); stdcall; export;
  begin
    AnimateWindow(hWnd, 1000, 262153);
  end;
  exports AnimateWindow_AW_DIAG_SLIDE_IN_BOTTOMLEFT;
procedure AnimateWindow_AW_DIAG_SLIDE_IN_BOTTOMRIGHT(hWnd: HWND); stdcall; export;
  begin
    AnimateWindow(hWnd, 1000, 262154);
  end;
  exports AnimateWindow_AW_DIAG_SLIDE_IN_BOTTOMRIGHT;
procedure AnimateWindow_AW_DIAG_SLIDE_IN_TOPLEFT(hWnd: HWND); stdcall; export;
  begin
    AnimateWindow(hWnd, 1000, 262149);
  end;
  exports AnimateWindow_AW_DIAG_SLIDE_IN_TOPLEFT;
procedure AnimateWindow_AW_DIAG_SLIDE_IN_TOPRIGHT(hWnd: HWND); stdcall; export;
  begin
    AnimateWindow(hWnd, 1000, 262150);
  end;
  exports AnimateWindow_AW_DIAG_SLIDE_IN_TOPRIGHT;
procedure AnimateWindow_AW_DIAG_SLIDE_OUT_BOTTOMLEFT(hWnd: HWND); stdcall; export;
  begin
    AnimateWindow(hWnd, 1000, 327686);
  end;
  exports AnimateWindow_AW_DIAG_SLIDE_OUT_BOTTOMLEFT;
procedure AnimateWindow_AW_DIAG_SLIDE_OUT_BOTTOMRIGHT(hWnd: HWND); stdcall; export;
  begin
    AnimateWindow(hWnd, 1000, 327685);
  end;
  exports AnimateWindow_AW_DIAG_SLIDE_OUT_BOTTOMRIGHT;
procedure AnimateWindow_AW_DIAG_SLIDE_OUT_TOPLEFT(hWnd: HWND); stdcall; export;
  begin
    AnimateWindow(hWnd, 1000, 327690);
  end;
  exports AnimateWindow_AW_DIAG_SLIDE_OUT_TOPLEFT;
procedure AnimateWindow_AW_DIAG_SLIDE_OUT_TOPRIGHT(hWnd: HWND); stdcall; export;
  begin
    AnimateWindow(hWnd, 1000, 327689);
  end;
  exports AnimateWindow_AW_DIAG_SLIDE_OUT_TOPRIGHT;
procedure AnimateWindow_AW_EXPLODE(hWnd: HWND); stdcall; export;
  begin
    AnimateWindow(hWnd, 1000, 262160);
  end;
  exports AnimateWindow_AW_EXPLODE;
procedure AnimateWindow_AW_FADE_IN(hWnd: HWND); stdcall; export;
  begin
    AnimateWindow(hWnd, 1000, 524288);
  end;
  exports AnimateWindow_AW_FADE_IN;

procedure AnimateWindow_AW_FADE_OUT(hWnd: HWND); stdcall; export;
  begin
    AnimateWindow(hWnd, 1000, 589824);
  end;
  exports AnimateWindow_AW_FADE_OUT;
procedure AnimateWindow_AW_IMPLODE(hWnd: HWND); stdcall; export;
  begin
    AnimateWindow(hWnd, 1000, 327696);
  end;
  exports AnimateWindow_AW_IMPLODE;
procedure AnimateWindow_AW_SLIDE_IN_BOTTOM(hWnd: HWND); stdcall; export;
  begin
    AnimateWindow(hWnd, 1000, 262152);
  end;
  exports AnimateWindow_AW_SLIDE_IN_BOTTOM;
procedure AnimateWindow_AW_SLIDE_IN_LEFT(hWnd: HWND); stdcall; export;
  begin
    AnimateWindow(hWnd, 1000, 262145);
  end;
  exports AnimateWindow_AW_SLIDE_IN_LEFT;
procedure AnimateWindow_AW_SLIDE_IN_RIGHT(hWnd: HWND); stdcall; export;
  begin
    AnimateWindow(hWnd, 1000, 262146);
  end;
  exports AnimateWindow_AW_SLIDE_IN_RIGHT;
procedure AnimateWindow_AW_SLIDE_IN_TOP(hWnd: HWND); stdcall; export;
  begin
    AnimateWindow(hWnd, 1000, 262148);
  end;
  exports AnimateWindow_AW_SLIDE_IN_TOP;
procedure AnimateWindow_AW_SLIDE_OUT_BOTTOM(hWnd: HWND); stdcall; export;
  begin
    AnimateWindow(hWnd, 1000, 327684);
  end;
  exports AnimateWindow_AW_SLIDE_OUT_BOTTOM;
procedure AnimateWindow_AW_SLIDE_OUT_LEFT(hWnd: HWND); stdcall; export;
  begin
    AnimateWindow(hWnd, 1000, 327682);
  end;
  exports AnimateWindow_AW_SLIDE_OUT_LEFT;
procedure AnimateWindow_AW_SLIDE_OUT_RIGHT(hWnd: HWND); stdcall; export;
  begin
    AnimateWindow(hWnd, 1000, 327681);
  end;
  exports AnimateWindow_AW_SLIDE_OUT_RIGHT;
procedure AnimateWindow_AW_SLIDE_OUT_TOP(hWnd: HWND); stdcall; export;
  begin
    AnimateWindow(hWnd, 1000, 327688);
  end;
  exports AnimateWindow_AW_SLIDE_OUT_TOP;
  begin
end.
-----------------------------------------------------------------------------------------------
Example:
โค๊ด: [Select]
unit Unit1;
  interface
  uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;
  type
  TForm1 = class(TForm)
  Button1: TButton;
    Button2: TButton;
  procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
  var
  Form1: TForm1;
  implementation
  uses Unit2;
  {$R *.dfm}
  procedure AnimateWindow_AW_FADE_IN(hWnd: HWND); stdcall; external 'AnimationWindow.dll';
  procedure AnimateWindow_AW_FADE_OUT(hWnd: HWND); stdcall; external 'AnimationWindow.dll';
  procedure AnimateWindow_AW_SLIDE_IN_TOP(hWnd: HWND); stdcall; external 'AnimationWindow.dll';
  procedure AnimateWindow_AW_SLIDE_OUT_TOP(hWnd: HWND); stdcall; external 'AnimationWindow.dll';
  procedure TForm1.Button1Click(Sender: TObject);
  begin
    AnimateWindow_AW_FADE_IN(Form2.Handle);
    If Form2.Visible = False Then
       Sleep(1000);
       AnimateWindow_AW_FADE_OUT(Form2.Handle);
    end;
  procedure TForm1.Button2Click(Sender: TObject);
  begin
    AnimateWindow_AW_SLIDE_IN_TOP(Form2.Handle);
      If Form2.Visible = False Then
      Sleep(500);
      AnimateWindow_AW_SLIDE_OUT_TOP(Form2.Handle);
  end;
end.

6
General Programming / Re: HotTips : Delphi XE4
« เมื่อ: 16 พฤษภาคม 2013, 17:52:57 »
คำสั่ง : SizeMode

เป็นการทำให้ไม่สามารถลดหรือเพิ่มขนาดของฟอร์มได้
 
โค๊ด: [Select]
procedure TForm1.FormCreate(Sender: TObject);
  begin
  self.BorderIcons := self.BorderIcons - [biMaximize]; //Disable Maximize button.
  self.BorderStyle := bsSingle; // Fix size of the form.
  end;
end.
OR
โค๊ด: [Select]
procedure TForm1.FormCreate(Sender: TObject);
  begin
    with self do
    BorderIcons := BorderIcons - [biMaximize]; //Disable Maximize button.
    BorderStyle := bsSingle; // Fix size of the form.
   end;
end.

OR ใช้วิธีเขียนฟังก์ชั่น SizeMode
โค๊ด: [Select]
function SizeMode:variant; //กำหนดชื่อฟังก์ชั่นและชนิดของตัวแปรรีเทิร์น
  begin //สร้างขอบเขตคำสั่ง (ถ้าคำสั่งมีเงื่อนไข จะต้องสร้างขอบเขตเพิ่ม)
    Form1.BorderIcons:=Form1.BorderIcons - [biMaximize]; //คำสั่งระงับการใช้งานปุ่มย่อ-ขยายหน้าต่าง
    Form1.BorderStyle:=bsSingle; //คำสั่งระงับเม๊าท์ย่อ-ขยายหน้าต่าง
  end; //ปิดฟังก์ชั่นเมื่อคำสั่งสิ้นสุด
procedure TForm1.FormCreate(Sender: TObject); //Event FormLoad
  begin
    SizeMode; //ใช้งานฟังก์ชั่นคำสั่ง
  end;
end.

7
General Programming / Re: HotTips : Delphi XE4
« เมื่อ: 10 พฤษภาคม 2013, 15:20:08 »
ตัวอย่างการเขียนโปรแกรม Task Manager ..ใช้ DLLs & ObjectCom ..เป็นการสอดแทรกความรู้เกี่ยวกับคำสั่งต่างๆไว้ให้ศึกษากัน

แนะนำให้ใช้ DelPhi 2010 ในการ Programming นะครับ จะสดวกกว่า Delphi XE4

Download : TaskManager.dll Click here (ออกแบบโดย : sak2005)

ความสามารถของโปรแกรม :

1. Hide Desktop Icons

2. Hide Start Menu Button

3. Hide TaskBar

4. Hide Task View Icons
------------------------------------------------------------------------------
Library Code : TaskManager.dll
โค๊ด: [Select]
library TaskManager;
  uses
  SysUtils, Classes, Forms, ComObj, Windows;
  {$R *.res}
   var
   SomeBuffer : Pointer;
   oAutoIt:Variant;
  procedure MyDLLProc(Reason: Integer);
  begin
  if Reason = DLL_PROCESS_DETACH then
  FreeMem(SomeBuffer);
  end;
 procedure HideDesktopIcons; stdcall;
  begin
     oAutoIt := CreateOleObject('AutoItX3.Control');
     oAutoIt.ControlHide('[CLASS:Progman]', '', '[CLASS:SysListView32; INSTANCE:1]');
  end;
     exports
     HideDesktopIcons;
procedure ShowDesktopIcons; stdcall;
  begin
     oAutoIt := CreateOleObject('AutoItX3.Control');
     oAutoIt.ControlShow('[CLASS:Progman]', '', '[CLASS:SysListView32; INSTANCE:1]');
  end;
     exports
     ShowDesktopIcons;
procedure HideTaskBar; stdcall;
  begin
     oAutoIt := CreateOleObject('AutoItX3.Control');
     oAutoIt.ControlHide('[Class:Shell_TrayWnd]', '', '');
  end;
     exports
     HideTaskBar;
procedure ShowTaskBar; stdcall;
  begin
     oAutoIt := CreateOleObject('AutoItX3.Control');
     oAutoIt.ControlShow('[Class:Shell_TrayWnd]', '', '');
  end;
     exports
     ShowTaskBar;

 procedure HideTaskViewIcons; stdcall;
  begin
     oAutoIt := CreateOleObject('AutoItX3.Control');
     oAutoIt.ControlHide('[Class:Shell_TrayWnd]', '', '[CLASS:ToolbarWindow32; INSTANCE:2]');
  end;
     exports
     HideTaskViewIcons;
procedure ShowTaskViewIcons; stdcall;
  begin
     oAutoIt := CreateOleObject('AutoItX3.Control');
     oAutoIt.ControlShow('[Class:Shell_TrayWnd]', '', '[CLASS:ToolbarWindow32; INSTANCE:2]');
  end;
     exports
     ShowTaskViewIcons;
procedure HideStartMenuButton; stdcall;
  begin
     oAutoIt := CreateOleObject('AutoItX3.Control');
     oAutoIt.ControlHide('[Class:Shell_TrayWnd]', '', 304);
  end;
     exports
     HideStartMenuButton;
procedure ShowStartMenuButton; stdcall;
  begin
     oAutoIt := CreateOleObject('AutoItX3.Control');
     oAutoIt.ControlShow('[Class:Shell_TrayWnd]', '', 304);
  end;
     exports
     ShowStartMenuButton;
begin
  DLLProc := @MyDLLProc;
  SomeBuffer := AllocMem(1024);
  end.
--------------------------------------------------------------------
Example:
โค๊ด: [Select]
unit TaskUnit;
interface
  uses
  Windows, Messages,
  SysUtils, Variants,
  Classes, Graphics,
  Controls, Forms,
  Dialogs, StdCtrls;
  type
TForm3 = class(TForm)
  Button1: TButton;
  Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    Button5: TButton;
    Button6: TButton;
    Button7: TButton;
    Button8: TButton;
  procedure Button1Click(Sender: TObject);
  procedure Button2Click(Sender: TObject);
  procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure Button6Click(Sender: TObject);
    procedure Button7Click(Sender: TObject);
    procedure Button8Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
  var
  Form3: TForm3;
implementation
  {$R *.dfm}
procedure TForm3.Button1Click(Sender: TObject);
  type
  THideDesktopIcons = procedure();
  var
  DLLInstance : THandle;
  HideDesktopIcons : THideDesktopIcons;
  begin
    DLLInstance := LoadLibrary('TaskManager.dll');
    if DLLInstance = 0 then
      begin
        MessageDlg('Unable to load DLL.', mtError, [mbOK], 0);
        Exit;
      end;
        @HideDesktopIcons := GetProcAddress(DLLInstance, 'HideDesktopIcons');
        if @HideDesktopIcons <> nil then
        begin
          HideDesktopIcons;
        end
        else
          MessageDlg('Unable to locate procedure.', mtError, [mbOK], 0);
          FreeLibrary(DLLInstance);
      end;
procedure TForm3.Button2Click(Sender: TObject);
  type
  TShowDesktopIcons = procedure();
  var
  DLLInstance : THandle;
  ShowDesktopIcons : TShowDesktopIcons;
  begin
    DLLInstance := LoadLibrary('TaskManager.dll');
    if DLLInstance = 0 then
    begin
      MessageDlg('Unable to load DLL.', mtError, [mbOK], 0);
      Exit;
    end;
    @ShowDesktopIcons := GetProcAddress(DLLInstance, 'ShowDesktopIcons');
    if @ShowDesktopIcons <> nil then
    begin
       ShowDesktopIcons;
    end
    else
      MessageDlg('Unable to locate procedure.', mtError, [mbOK], 0);
      FreeLibrary(DLLInstance);
  end;
procedure TForm3.Button3Click(Sender: TObject);
  type
  THideTaskBar = procedure();
  var
  DLLInstance : THandle;
  HideTaskBar : THideTaskBar;
  begin
    DLLInstance := LoadLibrary('TaskManager.dll');
    if DLLInstance = 0 then
      begin
        MessageDlg('Unable to load DLL.', mtError, [mbOK], 0);
        Exit;
      end;
        @HideTaskBar := GetProcAddress(DLLInstance, 'HideTaskBar');
        if @HideTaskBar <> nil then
        begin
          HideTaskBar;
        end
        else
          MessageDlg('Unable to locate procedure.', mtError, [mbOK], 0);
          FreeLibrary(DLLInstance);
      end;
procedure TForm3.Button4Click(Sender: TObject);
  type
  TShowTaskBar = procedure();
  var
  DLLInstance : THandle;
  ShowTaskBar : TShowTaskBar;
  begin
    DLLInstance := LoadLibrary('TaskManager.dll');
    if DLLInstance = 0 then
      begin
        MessageDlg('Unable to load DLL.', mtError, [mbOK], 0);
        Exit;
      end;
        @ShowTaskBar := GetProcAddress(DLLInstance, 'ShowTaskBar');
        if @ShowTaskBar <> nil then
        begin
          ShowTaskBar;
        end
        else
          MessageDlg('Unable to locate procedure.', mtError, [mbOK], 0);
          FreeLibrary(DLLInstance);
      end;
procedure TForm3.Button5Click(Sender: TObject);
  type
  THideTaskViewIcons = procedure();
  var
  DLLInstance : THandle;
  HideTaskViewIcons : THideTaskViewIcons;
  begin
    DLLInstance := LoadLibrary('TaskManager.dll');
    if DLLInstance = 0 then
      begin
        MessageDlg('Unable to load DLL.', mtError, [mbOK], 0);
        Exit;
      end;
        @HideTaskViewIcons := GetProcAddress(DLLInstance, 'HideTaskViewIcons');
        if @HideTaskViewIcons <> nil then
        begin
          HideTaskViewIcons;
        end
        else
          MessageDlg('Unable to locate procedure.', mtError, [mbOK], 0);
          FreeLibrary(DLLInstance);
      end;
procedure TForm3.Button6Click(Sender: TObject);
  type
  TShowTaskViewIcons = procedure();
  var
  DLLInstance : THandle;
  ShowTaskViewIcons : TShowTaskViewIcons;
  begin
    DLLInstance := LoadLibrary('TaskManager.dll');
    if DLLInstance = 0 then
      begin
        MessageDlg('Unable to load DLL.', mtError, [mbOK], 0);
        Exit;
      end;
        @ShowTaskViewIcons := GetProcAddress(DLLInstance, 'ShowTaskViewIcons');
        if @ShowTaskViewIcons <> nil then
        begin
          ShowTaskViewIcons;
        end
        else
          MessageDlg('Unable to locate procedure.', mtError, [mbOK], 0);
          FreeLibrary(DLLInstance);
      end;
procedure TForm3.Button7Click(Sender: TObject);
  type
  THideStartMenuButton = procedure();
  var
  DLLInstance : THandle;
  HideStartMenuButton : THideStartMenuButton;
  begin
    DLLInstance := LoadLibrary('TaskManager.dll');
    if DLLInstance = 0 then
      begin
        MessageDlg('Unable to load DLL.', mtError, [mbOK], 0);
        Exit;
      end;
        @HideStartMenuButton := GetProcAddress(DLLInstance, 'HideStartMenuButton');
        if @HideStartMenuButton <> nil then
        begin
          HideStartMenuButton;
        end
        else
          MessageDlg('Unable to locate procedure.', mtError, [mbOK], 0);
          FreeLibrary(DLLInstance);
      end;
procedure TForm3.Button8Click(Sender: TObject);
  type
  TShowStartMenuButton = procedure();
  var
  DLLInstance : THandle;
  ShowStartMenuButton : TShowStartMenuButton;
  begin
    DLLInstance := LoadLibrary('TaskManager.dll');
    if DLLInstance = 0 then
      begin
        MessageDlg('Unable to load DLL.', mtError, [mbOK], 0);
        Exit;
      end;
        @ShowStartMenuButton := GetProcAddress(DLLInstance, 'ShowStartMenuButton');
        if @ShowStartMenuButton <> nil then
        begin
          ShowStartMenuButton;
        end
        else
          MessageDlg('Unable to locate procedure.', mtError, [mbOK], 0);
          FreeLibrary(DLLInstance);
      end;
procedure TForm3.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
  begin
    Button2.Click;
    Button4.Click;
    Button6.Click;
    Button8.Click;
  end;
procedure TForm3.FormCreate(Sender: TObject);
  begin
    self.Caption := 'TaskManager';
    Button1.Caption := 'HideDesktopIcons';
    Button2.Caption := 'ShowDesktopIcons';
    Button3.Caption := 'HideTaskBar';
    Button4.Caption := 'ShowTaskBar';
    Button5.Caption := 'HideTaskViewIcons';
    Button6.Caption := 'ShowTaskViewIcons';
    Button7.Caption := 'HideStartMenuButton';
    Button8.Caption := 'ShowStartMenuButton';
  end;
end.


-------------------------------------------------------------------
เปิดให้รูปแบบฟังก์ชั่นคำสั่งของไฟล์DLLที่สร้าง จะเห็นได้ว่า สร้างได้ไม่ต่างจากภาษา C++

ถ้าเป็นไฟล์DLLที่สร้างจาก VB.net จะไม่สามารถมองเห็นฟังก์ชั่นคำสั่งได้

ต้องใช้วิธี Decompiler เท่าันั้นถึงจะมองเห็น


8
General Programming / Re: HotTips : Delphi XE4
« เมื่อ: 10 พฤษภาคม 2013, 06:47:53 »
วิธีเขียนคำสั่ง : LoadLibrary ใน Memory

โดยปกติเราจะคำสั่ง external ซึ่งเป็น static lib เพื่อเรียกใช้งานฟังก์ชั่นคำสั่งในไฟล์ dll
แต่ในบางครั้งอาจพบว่าไฟล์ dll บางอย่าง ไม่สามารถใช้คำสั่ง external ได้ พบว่ามี error! เกิดขึ้น
ต้องเรียกใช้งานผ่านทางเมโมรี่ หรือ process address ใช้คำสั่ง LoadLibrary ซึ่งเป็น dinamic lib

Library Code : AutoItX ObjectCom. Created  AU3_ToolTip Dll.
โค๊ด: [Select]
library DllTest;
  uses
  SysUtils, Classes, Forms, ComObj, Windows;
  var
  SomeBuffer : Pointer;
procedure MyDLLProc(Reason: Integer);
  begin
  if Reason = DLL_PROCESS_DETACH then
  { DLL is unloading. Cleanup code here. }
  FreeMem(SomeBuffer);
  end;
procedure ToolTip(strTip : string; x : integer; y : integer);
  var oAutoIt : variant;
  begin
    oAutoIt := CreateOleObject('AutoItX3.Control');
    oAutoIt.ToolTip(strTip, x, y);
  end;
  { More DLL code here that uses SomeBuffer. }
  exports
  ToolTip;
begin
  { Assign our DLLProc to the DLLProc global variable. }
  DLLProc := @MyDLLProc;
  SomeBuffer := AllocMem(1024);
end.
------------------------------------------------------------------
SimpleTest : Load Library Dll
โค๊ด: [Select]
procedure TForm1.Button1Click(Sender: TObject);
  type
  TToolTip = procedure(strTip : string; x : integer; y : integer);
  var
  DLLInstance : THandle;
  ToolTip : TToolTip;
  begin
    DLLInstance := LoadLibrary('DllTest.dll');
    if DLLInstance = 0 then begin
    MessageDlg('Unable to load DLL.', mtError, [mbOK], 0);
    Exit;
  end;
  @ToolTip := GetProcAddress(DLLInstance, 'ToolTip');
  if @ToolTip <> nil then
    ToolTip('Hello World!', 0, 0)
  else
    MessageDlg('Unable to locate procedure.', mtError, [mbOK], 0);
    FreeLibrary(DLLInstance);
  end;
end.

-----------------------------------------------------------------------------
คำแนะนำ : การที่จะเป็นโปรแกรมเมอร์ที่ดีได้ ต้องรู้จักศึกษาค้นคว้าเพิ่มเติมจากตัวอย่างโค๊ดที่ลงไว้

9
General Programming / Re: HotTips : Delphi XE4
« เมื่อ: 08 พฤษภาคม 2013, 21:45:29 »
วิธีเขียนคำสั่ง procedure และ function

ถ้าเขียนคำสั่งแบบ function ..ไม่ว่าจะภาษาไหนๆ จะต้องรีเทิร์น(return type) ชนิดของข้อมูลคำสั่งที่ใช้ด้วย
Examlpe1:
โค๊ด: [Select]
unit Unit1;
interface
  uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls,
  ComObj; //import namespace for CreateOleObject.
  type
TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
  var
  Form1: TForm1;
implementation
  {$R *.dfm}
function ToolTip(strTip : string; x : integer; y : integer): string; export;
  var
  oAutoIt : variant;
  begin
    oAutoIt := CreateOleObject('AutoItX3.Control');
    oAutoIt.ToolTip(strTip, x, y);
  end;
procedure TForm1.Button1Click(Sender: TObject);
  begin
    ToolTip('Hello World!', 0, 0);
  end;
end.
--------------------------------------------------------------------------------------------------------------
ถ้าเขียนคำสั่งแบบ Sub หรือ  procedure ไม่ต้องรีเทิร์น(return type) ชนิดของข้อมูลคำสั่ง
Example2:
โค๊ด: [Select]
unit Unit1;
interface
  uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls,
  ComObj; //import namespace for CreateOleObject.
  type
TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
  var
  Form1: TForm1;
implementation
  {$R *.dfm}
procedure ToolTip(strTip : string; x : integer; y : integer)export;
  var
  oAutoIt : variant;
  begin
    oAutoIt := CreateOleObject('AutoItX3.Control');
    oAutoIt.ToolTip(strTip, x, y);
  end;
procedure TForm1.Button1Click(Sender: TObject);
  begin
    ToolTip('Hello World!', 0, 0);
  end;
end.

10
อ้างถึง
ต้องนำไปใส่ยังไงครับ Media player ถึงจะเล่นอ่ะครับ

ปัจุบัน media stream จะถูกจัดให้อยู่ในรูปแบบ media flash ซะเป็นส่วนมาก
โดยการ convert ไฟล์ เช่นจาก avi to flash หรือ wma to flash เป็นต้น
ฉนั้น..ท่านต้องสร้างโปรแกรมสำหรับเปิดไฟล์แฟลช สำหรับ audio หรือ video stream ต่างๆ
เืมื่อท่านลงโปรแกรม macro media flash แล้ว จะเกิด flash control component ขึ้นใน vb.net ให้ท่านได้ใช้งาน

11
"Real Time Streaming Protocol"

คำว่า Streaming  หมายถึง การเปิดไฟล์วิีโอและเสียงโดยไม่ต้องมีการดาวน์โหลดมาเก็บไว้ที่เครื่อง
เนื่องจากการดาวน์โหลดไฟล์วิดีโอทั้งไฟล์จะใช้เวลานานมาก ดังนั้นการเล่นไฟล์วิดีโอ จากเครือข่ายด้วยเทคนิค Streaming จะทำให้สามารถแสดงผลข้อมูลได้ก่อนที่ไฟล์ทั้งหมดจะถูกส่งผ่านเข้ามายังเครื่องคอมพิวเตอร์นั่นเอง

ตัวอย่างการใช้เทคนิค Streaming เช่นในเว็บไซต์ฟังวิทยุสด หรือชมคลิปวิดีโอ พวกyoutubeก็เป็นระบบสตรีมมิ่งเช่นกัน

ตอบ=rtsp เป็นรุปแบบการเชื่อมต่อครับ ดูได้ทั้งวิดีโอปัจจุบันและวีดีโอที่บันทึกไว้แล้ว

ในการ Streaming สามารถเล่นไฟล์วิดีโอได้อย่างสมบูรณ์นั้น เครื่องบันทึกที่ใช้จะต้องมีความเร็วในการทำงานพอเพียงเนื่องจาก ข้อมูลที่ถูกส่งเข้ามายังเครื่องจะถูกจัดเก็บไว้ในหน่วยความจำ และยังต้องมีการแปลงข้อมูลเหล่านั้น เพี่อนำไปแสดงผลในรูปแบบของเสียงหรือวิดีโอ  อีกอย่างที่สำคัญ ต้องมีความเร็วในการเชื่อมต่อเครือข่ายที่เร็วพอที่จะส่งไฟล์ให้กับผู้ดูด้วย

หากส่วนใดล่าช้า ถ้าจะสังเกตเห็นได้ทันทีว่าภาพวิดีโอที่ดูอยู่จะมีอาการกระตุกหรือค้างไปเลย

โค๊ด: [Select]
Dim swftoload As String
swftoload = "C:player.swf?file=rtmp://sc-e1.streamcyclone.com:1935/ctvch_live/ctvch&autostart=true"
AxShockwaveFlash1.LoadMovie(0, swftoload)
--------------------------------------------------------------------------
ShockwaveFlashObject : Load Flash Movie on the internet

Example:
โค๊ด: [Select]
'Add Com components : Shockwave Flash Object
Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.MaximizeBox = False : Me.AutoSizeMode = Windows.Forms.AutoSizeMode.GrowAndShrink : Me.CenterToScreen()
        Me.Size = New Size(200, 200)
        AxShockwaveFlash1.LoadMovie(0, "http://flash-clocks.com/free-flash-clocks-blog-topics/free-flash-clock-150.swf")
        AxShockwaveFlash1.Dock = DockStyle.Fill
    End Sub
    Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        e.Cancel = True : Dim btn As String = MsgBox("Do you wanted to Exit?", 36, "") : If btn = vbYes Then e.Cancel = False
    End Sub
End Class

12
ตามหัวข้อเลยอ่ะครับ

อยากให้มันเล่น streaming โค้ด rtmpe://

ต้องเขียนโค้ดยังไงครับ เพราะ ผมเขียนให้เล่นได้แต่ mms:// ตอนนนี้ mms:// มันหายากแล้วอ่ะครับ


 :c8: :c8: :c8:

ช่วยอธิบายรายละเอียดที่ต้องการให้ช่วยเหลือ ให้มากกว่านี้หน่อย

เป็นการสร้า้งโปรแกรม Media Player เพื่อ ดูหนัง ฟังเพลง แบบ ออนไลน์ ใช่หรือไม่? (คล้ายกับโปรแกรม QuickTime)

13
General Programming / Re: HotTips : Delphi XE4
« เมื่อ: 06 พฤษภาคม 2013, 16:02:36 »
วิธีเขียนและใช้งานคำสั่ง ObjectCom ใน Delphi

สามารถใช้งานคำสั่ง ObjCom ในการเขียนไฟล์ Dll ได้

อันนี้เป็นการนำฟังก์ชั่นคำสั่งจาก AutoItx3.dll เข้ามาใช้ใน delphi

Example: คำสั่ง รัน โปรแกรม เครื่องคิดเลข
โค๊ด: [Select]
unit ShelObjectComUnit; //change unit name.
interface
  uses
  Classes, Controls, Forms, StdCtrls,
  ComObj; //import ObjectCom namespace.
  type
TForm4 = class(TForm)
  Button1: TButton;
  procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
  var
  Form4: TForm4;
implementation
  {$R *.dfm}
procedure TForm4.Button1Click(Sender: TObject);
  var
  oAutoIt : variant;  //type var.
  begin
  oAutoIt := CreateoleObject('AutoItX3.Control'); //create objectcom function.
  oAutoIt.Run ('Calc.exe'); //statement.
  end;
end.

14
General Programming / Re: HotTips : Delphi XE4
« เมื่อ: 06 พฤษภาคม 2013, 07:00:08 »
วิธีเขียนคำสั่งสร้างไฟล์ DLL ด้วยภาษา Delphi เพื่อให้สามารถนำไปใช้กับภาษา VB.net หรือภาษาอื่นๆได้

อันนี้เป็นการเขียนคำสั่งสร้าง ฟอร์มโมเดล ขึ้นมา แล้วแปลงเป็นไฟล์ DLL  แล้วใช้ VB.net ในการทดสอบแสดงผล


Delphi DLL Source Code : MyDialog.dll
โค๊ด: [Select]
library MyForm;
  uses
  StdCtrls,
  SysUtils,
  Classes,
  Forms;
{$R *.res}
function MyDialog : integer; stdcall;
  var Frm : TForm;
  var Lbl : TLabel;
  begin
    Frm := TForm.Create(nil);
    Frm.Caption := 'AboutBox Sample';
    Frm.BorderIcons := Frm.BorderIcons - [biMaximize];
    Frm.Position := poDesktopCenter;
    Lbl := TLabel.Create(Frm);
    Lbl.Caption := 'www.zone-it.com'+sLineBreak+'create by : sak2005';
    Lbl.Left := 100;
    Lbl.Top := 100;
    Lbl.Parent := Frm;
    Result := Frm.ShowModal;
  end;
  exports
    MyDialog;
begin
end.

---------------------------------------------------------------------
เมื่อสร้างไฟล์ DLL ขึ้นมาเรียบร้อยแล้ว
ให้ก๊อบปี้ไฟล์ Dll มาไว้ในโฟลเดอร์ debug ของ vb.net form project ที่จะใช้รันทดสอบ
จากนั้นเขียนคำสั่งเพื่อ Import Dll ไฟล์ และรันทดสอบ ดังนี้

Example: VB.net Code Run Dll
โค๊ด: [Select]
Public Class Form1
    Private Declare Function MyDialog Lib "MyForm.dll" Alias "MyDialog" () As Integer
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        MyDialog()
    End Sub
End Class

15
General Programming / Re: HotTips : Delphi XE4
« เมื่อ: 05 พฤษภาคม 2013, 21:21:16 »
EventHandler : การเขียนคำสั่งสร้าง event function เพื่อนำไปใช้กับ parent form object ที่สร้าง

Example: create event new button on the form.
โค๊ด: [Select]
unit Unit1;
interface
  uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
  type
TForm1 = class(TForm)
  procedure FormCreate(Sender: TObject);
  procedure ClickMe(Sender : TObject); //create eventhandle function.
  private
  { Private declarations }
  public
    { Public declarations }
  end;
  var
  Form1: TForm1;
implementation
  {$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
  var
  btn : TButton; //type var
  begin
  btn := TButton.Create(form1); //create new button on the form.
  btn.OnClick := ClickMe; //name of event function.
  btn.Caption := 'Press Me';
  btn.Parent := Form1; //Add button on the form.
  end;
procedure TForm1.ClickMe(Sender : TObject); //create event function on the form.
  begin
  ShowMessage('You clicked me'); //show dialog message. when..clicked.
  end;
end.
------------------------------------------------------------------------------------
Example2 : events parent form object.
โค๊ด: [Select]
unit Unit1;
interface
  uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
  type
TForm1 = class(TForm)
  Button1: TButton;
  procedure Button1Click(Sender: TObject);
  procedure ClickMe(Sender : TObject);
  procedure ClickClose(Sender : TObject);
  procedure FormCreate(Sender: TObject);
  private
  { Private declarations }
  public
  { Public declarations }
  end;
  var
  Form1: TForm1;
implementation
  {$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
  begin
  Button1.Caption := 'OpenNewForm';
  Button1.Width := 100;
  end;
procedure TForm1.Button1Click(Sender: TObject);
  var
  frm : TForm;
  btn1 : TButton; //type var
  btn2 : TButton;
  begin
  frm := TForm.Create(self);
  frm.Caption := 'Form2';
  frm.Position := poDesktopCenter;
  btn1 := TButton.Create(frm);
  btn1.OnClick := ClickMe;
  btn1.Caption := 'ClickMe';
  btn1.Parent := frm;
  btn2 := TButton.Create(frm);
  btn2.OnClick := ClickClose;
  btn2.Caption := 'ExitApp';
  btn2.Left := 100;
  btn2.Parent := frm;
  frm.ShowModal;
  end;
procedure TForm1.ClickMe(Sender : TObject);
  begin
  ShowMessage('You clicked me');
  end;
procedure TForm1.ClickClose(Sender : TObject);
  begin
  If Application.MessageBox('Do you wanted to Exit?', '', 36)= ID_YES Then
  Form1.Close;
  end;
end.

16
General Programming / Re: HotTips : Delphi XE4
« เมื่อ: 05 พฤษภาคม 2013, 05:39:10 »
MultiForm : เป็นการสร้างฟอร์ม ตั้งแต่ 2 ฟอร์มขึ้นไปให้สามารถทำงานร่วมกันได้
                 มีเทคนิคอยู่นิดเดียว คือ การอ้างยูนิตของฟอร์ม (Uses Unit Namespace) ต่างๆที่ใช้
                 
                 ถ้าต้องการจะกระทำการใดๆ? กับฟอร์มใดๆ ก็อ้าง unit namespace ของฟอร์มนั้นๆลงไป
                 ก็จะเกิดเป็นคำสั่งของฟอร์มนั้นๆให้ใช้งาน

Example:
โค๊ด: [Select]
unit Unit1;
interface
  uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
  type
TForm1 = class(TForm)
  Button1: TButton;
  Button2: TButton;
  Button3: TButton;
  Label1: TLabel;
  Button4: TButton;
  procedure Button1Click(Sender: TObject);
  procedure Button2Click(Sender: TObject);
  procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
  var
  Form1: TForm1;
implementation
  {$R *.dfm}
  uses
  Unit2, Unit3, Unit4; //Import unit namespace
procedure TForm1.Button1Click(Sender: TObject);
  begin
    Form2.Show;
  end;
procedure TForm1.Button2Click(Sender: TObject);
  begin
    Form3.Show;
  end;
procedure TForm1.Button3Click(Sender: TObject);
  begin
    Form4.Show;
  end;
procedure TForm1.Button4Click(Sender: TObject);
  begin
    Form2.Show;
    Form3.Show;
    Form4.Show;
  end;
end.

17
General Programming / Re: HotTips : Delphi XE4
« เมื่อ: 04 พฤษภาคม 2013, 18:47:42 »
Add new object on the new form (parent form object)

Example:
โค๊ด: [Select]
procedure TForm4.Button1Click(Sender: TObject); //event button function
  var frm: TForm; //type var
  var btn: TButton;
  begin
    frm := TForm.Create(self); //create new form
    frm.Caption := 'New Form'; //form name
    btn := TButton.Create(frm); //create new button on the new form
    btn.Caption := 'New Button'; //button name
    btn.parent := frm; //add new button on the new form
    frm.ShowModal; //show new parent form
  end;
end.

18
General Programming / Re: HotTips : Delphi XE4
« เมื่อ: 04 พฤษภาคม 2013, 13:00:32 »
การสร้างและการใช้งานไฟล์ Dinamic Link Library (DLL)

ผมจะเขียนข้อความโดยย่อๆพอเข้าใจกันนะครับ จะได้ไม่ต้องอ่านแบบ..ลากยาว
ข้อดีที่ใช้ delphi สร้างไฟล์ dll เพราะการเจาะรหัส dll นั้น ทำได้ยากกว่า vb.net

1. คลิ๊กที่.. New Project บนหน้าต่าง New Items คลิ๊กที่.. Dinamic-Link Library ..คลิ๊ก OK และเขียนคำสั่งลงไปดังนี้
    เปลี่ยนชื่อโปรเจ็กต์ที่สร้าง นิดนึงนะครับเป็น.. MessageTest

โค๊ด: [Select]
library MessageTest; //project name. Apply at project group
  uses
  System.SysUtils,
  Vcl.Dialogs, //<---namespace of ShowMessage
  System.Classes;
  {$R *.res}
procedure DllMessage; export; //create dll function
  begin
    ShowMessage('Hello world from a Delphi DLL') ; //statement
  end;
    exports DllMessage; //export function name
begin
end.
-----------------------------------------------------------------------------
2. คลิ๊ก Save All ..เป็นขั้นตอนที่ใช้ในทุกภาษา เมื่อเเขียนคำสั่งเสร็จสิ้น (ห้ามลืม!)

3. Build หรือ สร้างไฟล์ DLL ..ไปที่เมนู Project ..เลือก Build Project หรือกดปุ่ม Shift + F9
--------------------------------------------------------------------------------------------------
ทดสอบใช้งานไฟล์ Dll ที่สร้าง

ไม่ว่าเราจะสร้างสิ่งใดไว้ สิ่งนั้นๆจะถูกกองรวมไว้ที่เดียวกันที่ My Documents\RAD Studio\Projects
เมื่อเราสร้างไฟล์ Dll เรียบร้อยพร้อมใช้งานแล้ว เราสามารถเขียนโปรแกรมขึ้นมาเพื่อรันทดสอบได้เลย

Example:
โค๊ด: [Select]
unit Unit3;
interface
  uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
  type
TForm3 = class(TForm)
  Button1: TButton;
  procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
  var
  Form3: TForm3;
  procedure DllMessage; external 'MessageTest.dll'; //DllImport
implementation
  {$R *.dfm}
  procedure TForm3.Button1Click(Sender: TObject);
  begin
    DllMessage; //Call Dll Function name
  end;
end.
 

19
General Programming / Re: HotTips : Delphi XE4
« เมื่อ: 04 พฤษภาคม 2013, 01:45:58 »
Convert Type

DelPhi เป็นภาษาที่เขียนยากพอๆกันกับภาษา C++ หรือ C#
เราจะไม่สามารถใช้ ข้อมูลที่เป็นตัวเลขกับ Label Object ได้โดยตรง  ถ้าไม่ใส่เครื่องหมาย ' ' (ฟันหนู 2 ซี่)
ต้องประกาศตัวแปรและ Convert ชนิดของข้อมูลก่อน ดังตัวอย่าง

โค๊ด: [Select]
procedure TForm3.Button1Click(Sender: TObject);
   var a, b, c : integer; //types var
begin
   a := 1; //operate var
   b := 2;
   c := a + b; //Addtion
 Label1.Caption := c.ToString; //convert integer to string. Or used.. IntToStr(c)
end;
end.

20
ถ้า Publish แล้ว การ Decompiler (แกะโค๊ด) จะทำได้ยาก
vb.net เวอร์ชั่นเต็มเท่านั้น ที่สามารถทำการ Publish ได้

หน้า: [1] 2 3 ... 63