Declare Function GetPrivateProfileString% Lib "Kernel" _
(ByVal lpAppName$, ByVal lpKeyName As Any, _ ByVal lpDefault$, ByVal lpReturnedString$, _ ByVal nSize%, ByVal lpFileName$) 'Add this code to the appropriate routine: 'String variables to store section and key AppName$ = "windows" KeyName$ = "device" ' Return string length nSize% = 81 RetStr$ = Space$(nSize%) NumChars% = GetProfileString(AppName$, KeyName$, NullStr$, RetStr$, nSize%) ' Store the string koRetStr$ = Left$(RetStr$, NumChars%) ' Parse the string for specifics ' Find the first comma CommaPos1% = InStr(1, RetStr$, ",") ' Find the next comma CommaPos2% = InStr(CommaPos1% + 1, RetStr$, ",") ' Get Windows printer type lblPrinter.Caption = Left$(RetStr$, CommaPos1% - 1) 'Get the Printer driver lblPrinterDriver.Caption = Mid$(RetStr$, CommaPos1% + 1, CommaPos2% - CommaPos1% - 1) & ".DRV" 'Get the Printer port lblPrinterPort.Caption = Mid$(RetStr$, CommaPos2% + 1) |