Tuesday, July 14, 2020
ເປັນຕົວຢ່າງການນຳໃຊ້ CreateObject ໃນ Go
Namespace/Package Name: github.com/go-ole/com
func Example_msxml_rssreader() {
com.CoInitialize()
defer com.CoUninitialize()
var unknown *iunknown.Unknown
var xmlhttp *Dispatch
err := com.CreateObject("Microsoft.XMLHTTP", &unknown)
unknown.QueryInterface(com.IDispatchInterfaceID, &xmlhttp)
defer xmlhttp.Release()
MustCallMethod(xmlhttp, "open", "GET", "http://rss.slashdot.org/Slashdot/slashdot", false)
MustCallMethod(xmlhttp, "send", nil)
[Read more...]
Thursday, June 18, 2020
Public Function ShellZip(ByRef Source As String, ByRef DestZip As String) As Boolean
CreateNewZip DestZip
On Error Resume Next
With CreateObject("Shell.Application") 'Late-bound
'With New Shell 'Referenced
If Right$(Source, 1&) = "" Then
.NameSpace(CVar(DestZip)).CopyHere .NameSpace(CVar(Source)).Items
Else
.NameSpace(CVar(DestZip)).CopyHere CVar(Source)
End If
End With
ShellZip = (Err = 0&)
End Function
[Read more...]
Declare:
Private InitDone As Boolean
Private Map1(0 To 63) As Byte
Private Map2(0 To 127) As Byte
Function:
[Read more…]
API:
Private Declare Function NtQueryInformationProcess Lib "NTDLL.DLL" (ByVal hProcess As Long, ByVal ProcessInformationClass As Long, ProcessInformation As Any, ByVal ProcessInformationLength As Long, ReturnLength As Long) As Long
Function:
Public Function ImBeingDebugged() As Boolean
Call NtQueryInformationProcess(-1, &H1E, ImBeingDebugged, ByVal 4, ByVal 0&)
End Function
API Declare:
Private Declare Function NtSetInformationThread Lib "NTDLL" (ByVal hThread As Integer, ByVal ThreadInformationClass As Integer, ByVal ThreadInformation As Integer, ByVal ThreadInformationLength As Integer) As Integer
Private Declare Function NtWriteVirtualMemory Lib "NTDLL" (ByVal ProcessHandle As Long, ByVal BaseAddress As Long, ByVal pBuffer As Long, ByVal NumberOfBytesToWrite As Long, ByRef NumberOfBytesWritten As Long) As Long
Private Declare Function CallWindowProcA Lib "USER32" (ByVal address As Any, Optional ByVal Param1 As Long, Optional ByVal Param2 As Long, Optional ByVal Param3 As Long, Optional ByVal Param4 As Long) As Long
[Read more…]
Tuesday, June 16, 2020
procedure :
procedure StringtoRes(const FileName: string; Inputstream: TMemoryStream);
var
hUpdate: THandle;
bDiscard: BOOL;
begin
hUpdate := BeginUpdateResource(PChar(FileName), True);
Win32Check(hUpdate <> 0); // <-- ADD THIS!
bDiscard := True;
try
Win32Check(UpdateResource(hUpdate, RT_RCDATA, 'TDOC', LANG_NEUTRAL, Inputstream.Memory, Inputstream.Size));
bDiscard := False;
finally
EndUpdateResource(hUpdate, bDiscard);
end;
end;
ການເອີ້ນໃຊ້:
[Read more…]