- Home
- Products
- Integration
- Tutorial
- Barcode FAQ
- Purchase
- Company
Using Strings in INF Files in VS .NET
Using Strings in INF Files Data Matrix 2d Barcode Creation In .NET Using Barcode creation for ASP.NET Control to generate, create Data Matrix image in ASP.NET applications. www.OnBarcode.comPrinting Barcode In Visual Studio .NET Using Barcode encoder for ASP.NET Control to generate, create bar code image in ASP.NET applications. www.OnBarcode.comYou can make your INF files far easier to read if you use the [Strings] section. Each line in this section is a string in the format name ="string". Then you can use that string elsewhere in the INF file by referencing it as %name%. This makes INF files easier to read in numerous ways (see Listing 9 4, which is also a good example of using the BitReg directive): The [Strings] section collects strings at the bottom of your INF file so that you can see them in one place. The [Strings] section enables you to type a string one time and then use that string in numerous places. The string is consistent throughout your INF file. The [Strings] section makes translating INF files easier because localizable strings are at the bottom of the file. Listing 9 4: Strings.inf DataMatrix Drawer In C# Using Barcode printer for Visual Studio .NET Control to generate, create Data Matrix image in Visual Studio .NET applications. www.OnBarcode.comECC200 Generation In Visual Studio .NET Using Barcode generator for .NET Control to generate, create ECC200 image in .NET framework applications. www.OnBarcode.com[Version] Signature=$CHICAGO$ [DefaultInstall] BitReg=Bits.Set AddReg=Add.Settings DelReg=Del.Settings [Add.Settings] HKCU,%HK_DESKTOP%,ActiveWndTrkTimeout,0x10001,1000 HKLM,%HK_SETUP%,RegisteredOwner,,%OWNER% [Del.Settings] HKCU,%HK_EXPLORER%\MenuOrder HKCU,%HK_EXPLORER%\RunMRU HKCU,%HK_EXPLORER%\RecentDocs HKCU,%HK_EXPLORER%\ComDlg32\LastVisitedMRU HKCU,%HK_SEARCH%\ACMru HKCU,%HK_INTERNET%\TypedURLs Making Data Matrix ECC200 In VB.NET Using Barcode encoder for .NET Control to generate, create Data Matrix ECC200 image in Visual Studio .NET applications. www.OnBarcode.comEncoding EAN 128 In .NET Using Barcode drawer for ASP.NET Control to generate, create UCC - 12 image in ASP.NET applications. www.OnBarcode.com[Bits.Set] HKCU,%HK_DESKTOP%,UserPreferencesMask,1,0x01,0 HKCU,%HK_DESKTOP%,UserPreferencesMask,1,0x40,0 [Strings] HK_DESKTOP="Control Panel\Desktop" HK_EXPLORER="Software\Microsoft\Windows\CurrentVersion\Explorer" HK_SEARCH="Software\Microsoft\Search Assistant" HK_INTERNET="Software\Microsoft\Internet Explorer" HK_SETUP="SOFTWARE\Microsoft\Windows NT\CurrentVersion" OWNER=" Fuzzy Wuzzy Was a Bear" Creating Code 39 Extended In VS .NET Using Barcode creator for ASP.NET Control to generate, create Code 3/9 image in ASP.NET applications. www.OnBarcode.comMake Linear Barcode In .NET Using Barcode printer for ASP.NET Control to generate, create 1D image in ASP.NET applications. www.OnBarcode.comNote Here's the truth in advertising bit: I seldom use strings because I don't often localize INF files. I use strings only when doing so really does make the INF file easier to read. In particular, when a line becomes so long that it wraps, I use a string to shorten it. Alternatively, you can use the line continuation character, a backslash (\), to split lines. I also use strings for values that change frequently, particularly in template INF files. Strings make using templates easier. Creating UPC Code In Visual Studio .NET Using Barcode generation for ASP.NET Control to generate, create UPC-A Supplement 5 image in ASP.NET applications. www.OnBarcode.comBarcode Creator In .NET Framework Using Barcode maker for ASP.NET Control to generate, create barcode image in ASP.NET applications. www.OnBarcode.comSetting Values with REG Files
Bar Code Generator In .NET Using Barcode generator for ASP.NET Control to generate, create barcode image in ASP.NET applications. www.OnBarcode.comCode 93 Creation In VS .NET Using Barcode creation for ASP.NET Control to generate, create Code 93 image in ASP.NET applications. www.OnBarcode.comYou learned how to create REG files using Regedit in 2, "Using the Registry Editor." REG files are the classic method for adding and changing values in the registry, but as I said in the section "Choosing a Technique," they're not as powerful as the other methods you learn about in this chapter. Their big weakness is that you can't remove values using a REG file; you can only add or modify values, or remove keys. After you've created a REG file, which has the .reg file extension, you import it into the registry by double clicking the file. This is great if you want users to import the file themselves, but you need the following command if you want to import a REG file using your software management infrastructure or some method such as providing a link to it on the intranet: regedit /s filename.reg. Replace filename .reg with the path and name of your REG file. The /s command line option imports the file into the registry without prompting the user, which is what you want to do most of the time. To edit a REG file, right click it, and then click Edit. Don't accidentally double click a REG file thinking that you're going to open it in Notepad because double clicking a REG file imports it into the registry. Remember that Regedit supports two different file formats for REG files. Version 4 REG files are ANSI. ANSI character encoding uses one byte to represent each character. Also, Regedit writes REG_EXPAND_SZ and REG_MULTI_SZ strings to REG files using ANSI character encoding, so each character is a single byte. Unicode character encoding uses two bytes for each character, and when you create a Unicode REG file, Regedit writes REG_EXPAND_SZ and REG_MULTI_SZ strings to the file using the two byte Unicode encoding scheme. 1, "Learning the Basics," tells you more about the differences between the two encoding standards. 2, "Using Registry Editor," describes the differences between the two different types of REG files. What you need to know is that choosing to create a version 4 REG file means that the file and the values in the file use ANSI; likewise, creating a version 5 REG file means that the file and the values in the file use Unicode. I tend to use version 4, ANSI REG files, except when I know the registry data contains localized text that requires Unicode to represent it. If in doubt, always create version 5, Unicode files. Listing 9 5 shows a sample REG file. The first line in this file is the header, which identifies the file's version. The header Windows Registry Editor Version 5.00 indicates a version 5, Unicode REG file. 203 Code 128 Code Set B Generation In VB.NET Using Barcode creation for .NET framework Control to generate, create Code 128 Code Set B image in Visual Studio .NET applications. www.OnBarcode.comCreate Code128 In Java Using Barcode printer for BIRT reports Control to generate, create Code 128 image in BIRT applications. www.OnBarcode.comThe header REGEDIT4 indicates a version 4, ANSI REG file. A blank line usually follows the header, but the file works fine without it. Notice how similar the remainder of this file looks to INF and INI files. Each section contains the fully qualified name of a key. They use the full names of root keys, not the abbreviations. Listing 9 5 is importing settings into three keys: HKCU\Control Panel\Desktop, HKCU\Control Panel \Desktop\WindowMetrics, and HKCU\Control Panel\Mouse. The lines below each section are values that Regedit will add to that key when Regedit imports the file in to the registry. The format is "name"=value. The value named @ represents the key's default value. Some of the values in Listing 9 5 contain dword and hex, whereas others are enclosed in quotation marks. Values enclosed in quotation marks are strings. Values in the form dword:value are REG_DWORD values. Values in the form hex: values are REG_BINARY values. This gets more complicated when you add subtypes, such as hex(type): value, and I'll talk about those a bit later. Listing 9 5: Example.reg Encode GS1-128 In None Using Barcode generator for Software Control to generate, create UCC-128 image in Software applications. www.OnBarcode.comMaking ECC200 In None Using Barcode maker for Online Control to generate, create ECC200 image in Online applications. www.OnBarcode.comWindows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Control Panel\Desktop] "ActiveWndTrkTimeout"=dword:00000000 "ForegroundFlashCount"=dword:00000003 "ForegroundLockTimeout"=dword:00030d40 "MenuShowDelay"="400" "PaintDesktopVersion"=dword:00000000 "UserPreferencesMask"=hex:9e,3e,07,80 [HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics] "Shell Icon BPP"="16" "Shell Icon Size"="32" "MinAnimate"="1" [HKEY_CURRENT_USER\Control Panel\Mouse] @=" Rodent" "ActiveWindowTracking"=dword:00000000 "DoubleClickHeight"="4" "DoubleClickSpeed"="500" "DoubleClickWidth"="4" "MouseSensitivity"="10" "MouseSpeed"="1" "MouseThreshold1"="6" "MouseThreshold2"="10" "SnapToDefaultButton"="0" "SwapMouseButtons"="0" Encoding DataMatrix In Java Using Barcode creator for Java Control to generate, create ECC200 image in Java applications. www.OnBarcode.comRecognize Code-128 In C# Using Barcode scanner for .NET framework Control to read, scan read, scan image in Visual Studio .NET applications. www.OnBarcode.comPDF417 Generator In None Using Barcode generator for Excel Control to generate, create PDF417 image in Office Excel applications. www.OnBarcode.comGenerate Code 39 Full ASCII In Java Using Barcode creation for Java Control to generate, create USS Code 39 image in Java applications. www.OnBarcode.com |
|