Can someone tell my why it keeps saying SendMessage "Sub or Function not defined"?
VB Code:
Call SetDefaultPrinter(Simplex, DriverName, PortName)
VB Code:
Declare Function WriteProfileString Lib "KERNEL32" _ Alias "WriteProfileStringA" _ (ByVal lpszSection As String, _ ByVal lpszKeyName As String, _ ByVal lpszString As String) As Long Public Const HWND_BROADCAST = &HFFFF Public Const WM_WININICHANGE = &H1A Public Sub SetDefaultPrinter(ByVal PrinterName As String, _ ByVal DriverName As String, ByVal PrinterPort As String) Dim DeviceLine As String Dim r As Long Dim l As Long DeviceLine = PrinterName & "," & DriverName & "," & PrinterPort ' Store the new printer information in the [WINDOWS] section of ' the WIN.INI file for the DEVICE= item r = WriteProfileString("windows", "Device", DeviceLine) ' Cause all applications to reload the INI file: l = SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0, "windows") End Sub




Reply With Quote