He estado buscando y buscando y no he podido encontrar algún ejemplo de generar un QR sin utilizar una librería, alguien sabe de alguna clase o código que me pueda servir?
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes Menú
Private Declare Auto Function CreateFile _
Lib "kernel32" Alias "CreateFileA" (
ByVal lpFileName As String,
ByVal dwDesiredAccess As Integer,
ByVal dwShareMode As Integer,
ByVal lpSecurityAttributes As Integer,
ByVal dwCreationDisposition As Integer,
ByVal dwFlagsAndAttributes As Integer,
ByVal hTemplateFile As IntPtr
) As Integer
Private Declare Auto Function CloseHandle _
Lib "kernel32" (
ByVal hObject As IntPtr
) As Integer
Private Declare Auto Function DeviceIoControl _
Lib "kernel32" (
ByVal hDevice As IntPtr,
ByVal dwIoControlCode As Integer,
<MarshalAs(UnmanagedType.AsAny)>
lpInBuffer As Object,
ByVal nInBufferSize As Integer,
<MarshalAs(UnmanagedType.AsAny)>
lpOutBuffer As Object,
ByVal nOutBufferSize As Integer,
lpBytesReturned As Integer,
ByVal lpOverlapped As Integer
) As Integer
Private Declare Auto Sub ZeroMemory _
Lib "kernel32" Alias "RtlZeroMemory" (
<MarshalAs(UnmanagedType.AsAny)>
dest As Object,
ByVal numBytes As Integer)
'Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Object, Source As Object, ByVal Length As Integer)
Private Declare Auto Function GetLastError Lib "kernel32" () As Integer
Private Const DFP_RECEIVE_DRIVE_DATA = &H7C088
Private Const FILE_SHARE_READ = &H1
Private Const FILE_SHARE_WRITE = &H2
Private Const GENERIC_READ = &H80000000
Private Const GENERIC_WRITE = &H40000000
Private Const OPEN_EXISTING = 3
Private Const CREATE_NEW = 1
Private Enum HDInfo
HD_MODEL_NUMBER = 0
HD_SERIAL_NUMBER = 1
HD_FIRMWARE_REVISION = 2
End Enum
Private Structure IDEREGS
Public bFeaturesReg As Byte
Public bSectorCountReg As Byte
Public bSectorNumberReg As Byte
Public bCylLowReg As Byte
Public bCylHighReg As Byte
Public bDriveHeadReg As Byte
Public bCommandReg As Byte
Public bReserved As Byte
End Structure
Private Structure SENDCMDINPARAMS
Public cBufferSize As Integer
Public irDriveRegs As IDEREGS
Public bDriveNumber As Byte
<VBFixedArray(1, 3)>
Public bReserved() As Byte
<VBFixedArray(1, 4)>
Public dwReserved() As Integer
End Structure
Private Structure DRIVERSTATUS
Public bDriveError As Byte
Public bIDEStatus As Byte
<VBFixedArray(1, 2)>
Public bReserved() As Byte
<VBFixedArray(1, 2)>
Public dwReserved() As Integer
End Structure
Private Structure SENDCMDOUTPARAMS
Public cBufferSize As Integer
Public DStatus As DRIVERSTATUS
<VBFixedArray(1, 512)>
Public bBuffer() As Byte
End Structure
Private mvarCurrentDrive As Byte
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
MsgBox(GetHDDInfo(0, "serial"))
End
End Sub
Public Function GetHDDInfo(ByVal Number As Byte, ByVal Cmd As String) As String
mvarCurrentDrive = Number
Select Case LCase(Cmd)
Case "model" : GetHDDInfo = CmnGetHDData(HDInfo.HD_MODEL_NUMBER)
Case "serial" : GetHDDInfo = CmnGetHDData(HDInfo.HD_SERIAL_NUMBER)
Case "firmware" : GetHDDInfo = CmnGetHDData(HDInfo.HD_FIRMWARE_REVISION)
Case Else : GetHDDInfo = ""
End Select
End Function
Private Function CmnGetHDData(hdi As HDInfo) As String
Dim Bin As SENDCMDINPARAMS
Dim Bout As SENDCMDOUTPARAMS
Dim hdh As Long
Dim br As Long
Dim Ix As Long
Dim hddfr As Long
Dim hddln As Long
Dim S As String
Select Case hdi
Case HDInfo.HD_MODEL_NUMBER
hddfr = 55
hddln = 40
Case HDInfo.HD_SERIAL_NUMBER
hddfr = 21
hddln = 20
Case HDInfo.HD_FIRMWARE_REVISION
hddfr = 47
hddln = 8
Case Else : Err.Raise(10001, "Illegal HD Data type")
End Select
hdh = CreateFile("\\.\PhysicalDrive" & mvarCurrentDrive, GENERIC_READ + GENERIC_WRITE, FILE_SHARE_READ + FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0)
If hdh = 0 Then Err.Raise(10003, , "Error on CreateFile")
ZeroMemory(Bin, Len(Bin))
ZeroMemory(Bout, Len(Bout))
With Bin
.bDriveNumber = mvarCurrentDrive
.cBufferSize = 512
With .irDriveRegs
If (mvarCurrentDrive And 1) Then
.bDriveHeadReg = &HB0
Else
.bDriveHeadReg = &HA0
End If
.bCommandReg = &HEC
.bSectorCountReg = 1
.bSectorNumberReg = 1
End With
End With
DeviceIoControl(hdh, DFP_RECEIVE_DRIVE_DATA, Bin, Len(Bin), Bout, Len(Bout), br, 0)
S = ""
For Ix = hddfr To hddfr + hddln - 1 Step 2
If Bout.bBuffer(Ix + 1) = 0 Then Exit For
S &= Chr(Bout.bBuffer(Ix + 1))
If Bout.bBuffer(Ix) = 0 Then Exit For
S &= Chr(Bout.bBuffer(Ix))
Next Ix
CloseHandle(hdh)
CmnGetHDData = Trim(S)
End Function