Arsip: translate MoveMemory 'kernel32' VB ke Delphi

more 15 years ago
esafm
langsung az
Declare Sub MoveMemory Lib "kernel32" Alias "RtlMoveMemory" ( _
Dest As Any, _
Src As Any, _
ByVal length As Long _
)
sample input di VB
dim threshold As integer
dim data1 As Byte
call MoveMemory(threshold, data1, Len(threshold))
pas saya coba di Delphi type nya Any jadi Pointer
// windows.pas
procedure MoveMemory(Destination: Pointer; Source: Pointer; Length: DWORD);
begin
Move(Source^, Destination^, Length);
end;
var
threshold: integer;
data1: Byte;
begin
MoveMemory(threshold, data1, length(threshold));
end;
//error: incompatible types: 'Integer' and Pointer'
pertanyaan:
1. apa yg harus saya inputkan MoveMemory di delphi supaya sesuai dengan VB?
2. type Any persamaan di delphi apa?
terima kasih banyak atas bantuannya.
more 15 years ago
heriy4nt0
jika mengenai MoveMemory(destination:Pointer,source:Pointer;length:Integer), gunakan selalu jenis pointer: Cth: PByte, PChar. Biasanya passing pointer digunakan PChar, biasanya lho (kamu bisa menggunakan tipe pointer lainnya).

more 15 years ago
esafm
DelphiExpert Memang paling Expert saluuuttt.
ada satu lagi masalah nih berhubungan dengan type datanya
type RSI_DATA_LOG_FORMAT = (
RSI_DLF_BUFFER_EMPTY = 0,
RSI_DLF_USER_ENROLLED = 1,
RSI_DLF_NO_HAND_READ = 2,
RSI_DLF_IDENTITY_UNKNOWN = 3,
RSI_DLF_EXIT_GRANTED = 4,
RSI_DLF_SCORE_IS = 5
);
type RSI_DATA_LOG_ELEMENT = record // offset
datalog1: RSI_DATA_LOG_FORMAT;
datalog2: RSI_DATA_LOG_FORMAT;
end;
var
DataLog: RSI_DATA_LOG_ELEMENT;
strData: string;
begin
DataLog.datalog1:=RSI_DATA_LOG_FORMAT(RSI_DLF_EXIT_GRANTED); // vb: DataLog.datalog1 = RSI_DLF_EXIT_GRANTED ' bisa langsung
strData:=FormatFloat('00',DataLog.datalog2);
end;
Error: There is no overloaded version of 'FormatFloat' that can called with these arguments
tapi klo coding di VB:
DataLog.datalog1 = RSI_DLF_EXIT_GRANTED
strData = format(DataLog.datalog2, "#00")
bagaimana cara supaya si strData di Delphi sesuai dengan VB
terima kasih sebelumnya.
more 15 years ago
mas_kofa
@DelphiExpert:kalo aku liat mungkin hasil nya selalu '00' iya kah?strData := FormatFloat('00', Ord(DataLog.datalog2));

more 15 years ago
esafm
@mas_kofa: [quote:6af54d2cfb="DelphiExpert"]betul pak/mas ko selalu 0 ya, jadi hasil dengan VB beda, ada solusi lain?[/quote:6af54d2cfb] kalo aku liat mungkin hasil nya selalu '00' iya kah?strData := FormatFloat('00', Ord(DataLog.datalog2));

more 15 years ago
amyra
Solusinya buka help, baca FormatFloat.... apa ketik FormatFloat kemudian tekan F1 ............hi..hi..hi..

more 15 years ago
DelphiExpert
Ya tentu saja akan selalu '00', lha wong sampean tidak membuat perubahan ke DataLog.datalog2.
Pada waktu inisialisasi variable, Delphi akan set DataLog.datalog2 = RSI_DLF_BUFFER_EMPTY = 0;

more 15 years ago
esafm
@DelphiExpert: Ya tentu saja akan selalu '00', lha wong sampean tidak membuat perubahan ke DataLog.datalog2. Pada waktu inisialisasi variable, Delphi akan set DataLog.datalog2 = RSI_DLF_BUFFER_EMPTY = 0;betul sekali apa kata pa' expert, ternyata ga ada perubahan disana tapi di procedure lain perubhannya, maaf. oya ini ada masalah lg pa' mohon di bantu lagi.
Function rsiIDToText(var ID: byte; text: String): longint; external 'rsidll32.DLL';
type RSI_RESULT = (
RSI_SUCCESS,
RSI_ERROR_DATA,
RSI_ERROR_COM,
RSI_NO_CONNECTION
);
type RSI_USER_RECORD = record
ID: RSI_ID;
authorityLevel: RSI_AUTHORITY_LEVEL;
end;
type RSI_ID = record
b0: byte;
b1: byte;
b2: byte;
b3: byte;
b4: byte;
end;
type RSI_AUTHORITY_LEVEL = (
RSI_NONE = 0,
RSI_SERVICE = 1,
RSI_SETUP = 2,
RSI_MANAGEMENT = 3,
RSI_ENROLLMENT = 4,
RSI_SECURITY = 5
);
procedure DisplayLastUserRecord(UserRec: RSI_USER_RECORD; Result: Longint);
var
teks: string[10];
begin
if (RSI_Result(Result) = RSI_SUCCESS) Then
begin
Result:=rsiIDToText(UserRec.ID, teks); // error UserRec.ID harus nya lebih detail, klo di VB langsung az
txtAuth.text:=IntToStr(UserRec.authorityLevel); // ini juga error
end;
end;
tapi klo di VB nya langsung seperti ini
Private Sub DisplayLastUserRecord(UserRec As RSI_USER_RECORD, Result As Long)
Dim teks As String * 10
If (Result = RSI_SUCCESS) Then
Result = rsiIDToText(UserRec.ID, teks)
txtAuth.text = Str(UserRec.authorityLevel)
End If
End Sub
bagaimana pa' expert biar seperti VB,
terima kasih atas bantuannya, saya lagi di suruh translate VB ke Delphi, mohon bantuannya.more ...
- Pages:
- 1
- 2
reply |
Report Obsolete
AI Forward

🚀 We're thrilled to partner with Alibaba Cloud for "AI Forward - Alibaba Cloud Global Developer Summit 2025" in Jakarta! Join us and explore the future of AI. Register now:
https://int.alibabacloud.com/m/1000400772/
#AlibabaCloud #DeveloperSummit #Jakarta #AIFORWARD
Last Articles
Last Topic
- PascalTalk #6: (Podcast) Kuliah IT di luar negeri, susah gak sih?
by LuriDarmawan in Tutorial & Community Project more 4 years ago - PascalTalk #5: UX: Research, Design and Engineer
by LuriDarmawan in Tutorial & Community Project more 4 years ago - PascalTalk #4: Obrolan Ringan Seputar IT
by LuriDarmawan in Tutorial & Community Project more 4 years ago - PascalTalk #2: Membuat Sendiri SMART HOME
by LuriDarmawan in Tutorial & Community Project more 4 years ago - PascalTalk #3: RADically Fast and Easy Mobile Apps Development with Delphi
by LuriDarmawan in Tutorial & Community Project more 4 years ago - PascalTalk #1: Pemanfaatan Artificial Intelligence di Masa Covid-19
by LuriDarmawan in Tutorial & Community Project more 4 years ago - Tempat Latihan Posting
by LuriDarmawan in OOT more 5 years ago - Archive
- Looping lagi...
by idhiel in Hal umum tentang Pascal Indonesia more 12 years ago - [ask] koneksi ke ODBC user Dsn saat runtime dengan ado
by halimanh in FireBird more 12 years ago - Validasi menggunakan data tanggal
by mas_kofa in Hal umum tentang Pascal Indonesia more 12 years ago
Random Topic
- install komponent
by brodien in Tip n Trik Pemrograman more 18 years ago - RELASI database MySQL
by itoru in MySQL more 13 years ago - Delphi Pemrograman OOP murni apa terstruktur
by khairulfahmi in Enginering more 17 years ago - Selamat Tahun Baru Hijriyah 1 Muharam 1431 H
by LuriDarmawan in OOT more 15 years ago - blajar ZQuery
by luq_h in MySQL more 13 years ago - Disable/Enable Key Lewat registry
by Tiwul in Network, Files, I/O & System more 16 years ago - Compress image
by lela in Hal umum tentang Pascal Indonesia more 19 years ago - Tanya SQL
by milacms in Paradox more 18 years ago - kriptografi
by tara in Tip n Trik Pemrograman more 15 years ago - freeware gudang
by supik in OpenSource dan Gratis more 15 years ago