Using SaveSetting in 16 Bit Environment

Using SaveSetting in 16 Bit Environment

I have problem with the statement “SaveSetting” in VB 4.0 16 bit.

SaveSetting writes entries to the Registry, which is a Win95 32-bit feature. Under 16-bit VB and Window 3.x, SaveSetting’s first argument can be replaced with the name of the INI file you wish to write to.In the case of a 16-bit app (especially if it’s targeted at Win3.x) I would strongly recommend using a private ini file rather than writing to WIN.INI file. All too many Win3.x programs blithely write to WIN.INI with no way for the user to know it is being done. In the case of ShareWare that you’ve tried and then uninstalled, this leaves lots of extra baggage in WIN.INI, which slows the loading of Windows quite a bit and can eventually bog it down to the point that it won’t load at all. Polite coding practice is to use a private ini file that lives in the same directory as the program itself.If you code something in VB3.0 you can use the following to read and write private ini files. Make sure that the two declares go on a single line for each of them:

‘first declareDeclare Function GetPrivateProfileString% Lib “Kernel” (ByVal lpAppName$, ByVal lpKeyName$, ByVal lpDefault$, ByVal lpReturnedString$, ByVal nSize%, ByVal lpFileName$)’second declareDeclare Function WritePrivateProfileString% Lib “Kernel” (ByVal lpAppName$, ByVal lpKeyName$, ByVal lpString$, ByVal lpFileName$)Function GetPrivIni (AppName As String, KeyWord As String, IniFile As String)Dim Returned$Returned$ = Space$(128)Valid% = GetPrivateProfileString(AppName, KeyWord, “”, Returned$, Len(Returned$), IniFile)GetPrivIni = Left$(Returned$, Valid%)End FunctionSub SetPrivIni (AppName As String, KeyWord As String, KeyVal As String, IniFile As String)Valid% = WritePrivateProfileString(AppName, KeyWord, KeyVal, IniFile)If Valid% = False Then MsgBox “Can’t Write to IniFile”End Sub

Share the Post:
XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes

ransomware cyber attack

Why Is Ransomware Such a Major Threat?

One of the most significant cyber threats faced by modern organizations is a ransomware attack. Ransomware attacks have grown in both sophistication and frequency over the past few years, forcing

data dictionary

Tools You Need to Make a Data Dictionary

Data dictionaries are crucial for organizations of all sizes that deal with large amounts of data. they are centralized repositories of all the data in organizations, including metadata such as