สอนผมใช้ฟังค์ชั่นนี้ด้วยครับ อาจารย์สุภาพ
กระทู้เก่าบอร์ด อ.สุภาพ ไชยา

 260   2
URL.หัวข้อ / URL
สอนผมใช้ฟังค์ชั่นนี้ด้วยครับ อาจารย์สุภาพ

แบบว่า ผมผ่านเข้าไปใน Web ต่างประเทศครับ แล้วเขามีตัวอย่างให้ดู แต่ไม่รู้จะใช้ยังไง รบกวน อาจารย์ช่วย อธิบายและทำตัวอย่างประกอบให้ดูซักอันครับ มีอีกเป็นสิบน่าใช้ทั้งนั้นเลย(เหมือนหมาเห็นปลากระป๋องเลย ฮือๆๆๆ) 
 
ตัวอย่างครับ 
 
(Q) How do I retrieve the current ComputerName ? 
 
(A) Paste the following code in a new module and call the function fOSMachineName. 
 
 
'******************** Code Start ************************** 
' This code was originally written by Dev Ashish. 
' It is not to be altered or distributed, 
' except as part of an application. 
' You are free to use it in any application, 
' provided the copyright notice is left unchanged. 

' Code Courtesy of 
' Dev Ashish 

Private Declare Function apiGetComputerName Lib "kernel32" Alias _ 
    "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long 
 
Function fOSMachineName() As String 
'Returns the computername 
Dim lngLen As Long, lngX As Long 
Dim strCompName As String 
    lngLen = 16 
    strCompName = String$(lngLen, 0) 
    lngX = apiGetComputerName(strCompName, lngLen) 
    If lngX <> 0 Then 
        fOSMachineName = Left$(strCompName, lngLen) 
    Else 
        fOSMachineName = "" 
    End If 
End Function 
'******************** Code End ************************** 

2 Reply in this Topic. Dispaly 1 pages and you are on page number 1

1 @R01615
โค้ดข้างต้นเป็น API function สำหรับแสดงชื่อของเครื่องคอมพิวเตอร์เครื่องนี้ ลองใช้โค้ดนี้ดูครับ Sub Test() MsgBox "เครื่องคอมฯ เครื่องนี้ชื่อ " & fOSMachineName End Sub
2 @R01624
รบกวนอาจารย์สอนการใช้งานด้วยครับ แบบว่า ที่ Web มีตัวอย่างประเภทนี้ตรึมเลยครับ
@ ประกาศใช้งานเว็บบอร์ดใหม่ => บอร์ดเรียนรู้ Access สำหรับคนไทย
แล้วจะใส่ลิ้งอ้างอิงมาที่โพสต์เก่านี้หรือไม่ก็ตามสะดวกครับ
Time: 0.0950s