bugs >> vb6 api writeprivateprofilesection

by cnBpbmNo » Fri, 27 Oct 2006 02:17:01 GMT

writeprivateprofilesection in windows 98 replaces the section. in xp it
apparently appends to the section. what's happening, and how do you fix it?
Without that, how do you delete content in a section?


bugs >> vb6 api writeprivateprofilesection

by Karl E. Peterson » Fri, 27 Oct 2006 02:30:21 GMT





Here's the SectionDelete routine from my INI class:

Public Function SectionDelete(Optional ByVal Section As String, Optional
ByVal FileName As String) As Boolean
' Update cached section and filename, if provided.
Call UpdateFileDetails(Section, FileName)
' Remove specific section from INI file.
SectionDelete = CBool(WritePrivateProfileString(m_Section,
vbNullString, vbNullString, m_FileName))
End Function

Complete work at http://vb.mvps.org/samples/kpIni
--
Working without a .NET?
http://classicvb.org/





Similar Threads

1. Upgrading VB6 API to VB.NET API calls

I have a VB6 UDT used in an API call as follows:

Type RASCONN
    hRasConn As Long
    sEntryName As String
    sDeviceType As String
    sDeviceName As String
    sPhonebook  As String
    lngSubEntry As Long
    guidEntry(15) As Byte
End Type

So converting to VB.NET structure:

Structure RASCONN
    Public hRasConn As Integer
    Public sEntryName As String
    Public sDeviceType As String
    Public sDeviceName As String
    Public sPhonebook  As String
    Public lngSubEntry As Integer
    Public guidEntry(15) As Byte **
End Stucture

** The last field, guidEntry(15) cannot be used in a VB.NET structure
because structure members cannot be declared with an intitial size.
What is the best way to work around this in VB.NET?
Any links to guidelines on making API calls from VB.NET would be greatly
appreciated.
I have looked for references on the web, but all of them were at a basic
level.


2. Problems using ODBC API in VB6

3. Starting and stopping RAS service in VB6 using APIs

Hello everybody!!
I have to write a small program which, among the other things, must allow to 
start and stop the RAS service (only the start and the stop, without any 
other configuration or behavior setting function). I was looking around but I 
only found that there are 2 functions (MprAdminInitializeDll and 
MprAdminTerminateDll) which should do what I need, but VB6 can't find the DLL 
entry point in mprapi.dll

This is my code:
Private Declare Function MprAdminInitializeDll Lib "mprapi.dll" () As Long
Private Sub Command1_Click()
Dim res As Long
    res = MprAdminInitializeDll
End Sub

Where's my mistake?
Are these the correct APIs?
Do I need anything else?
Is there another way to perform my needs?
I necessarily have to use Visual Studio 6 (I would prefer VB6, because I 
have to integrate this function into an already existing VERY complex 
software).

Thanks to everyone!!

Giulio D'Ottavio

4. API structure & function conversion [ vb6 -> c# ] - CSharp/C#

5. tfm.dll API call different results on VB6 and VB.Net

Hello There,

I'm coding an application which uses a library, "tfm.dll", to communicate 
with a finger print reader.I'm converting the communication API function 
declarations from the provided VB6 source codes to VB.Net and having a weird 
issue :

The VB6 declaration of these functions are :



Public Declare Function PTInitialize Lib "tfm.dll" (ByVal pMemoryFuncs As 
Any) As Long

Public Declare Function PTOpen Lib "tfm.dll" (ByVal pszDsn As String, ByRef 
phConnection As Long) As Long



And here's the VB.Net equvalents that I ported :



Public Declare Function PTInitialize Lib "tfm.dll" (ByVal pMemoryFuncs As 
Integer) As Integer

Public Declare Function PTOpen Lib "tfm.dll" (ByVal pszDsn As String, ByRef 
phConnection As Integer) As Integer



In VB6, these are used to call these functions :



lngResult = PTInitialize(0&)

lngResult = PTOpen(pszDsn, phConnection)



In VB.Net, I use this way :



lngResult = PTInitialize(0) ?I also used Nothing as the parameter and both 
seems to work.

lngResult = PTOpen(pszDsn, phConnection)



In VB.Net, result of PTOpen always return as communication error where in 
VB6 it works fine. The Initialize function works normally in VB.Net as I see 
that the communication led on reader gets active when the Initialize 
function is called and the return value is 0 which means everything is ok.



Does anybody has any idea why these two environments does not produce the 
same result? Maybe some of you who has experience on those kind of ports can 
point me to the right direction.



Many thanks in advance...



謟den


6. vb6 api 'filewrie' for vb.net, OR cast short array to byte array - VB.Net

7. Moving from VB6 - API Long now Integer?

I am moving from VB6 to VB .NET so please bear with me. Should I change all 
of my API declarations in VB6 that declared Longs to Integers? For example 
in VB6:

Declare Function GetClientRect Lib "user32" (ByVal hWnd as Long, ByVal 
lpRect as RECT) As Long

Should this now read:

Declare Function GetClientRect Lib "user32" (ByVal hWnd as Integer, ByVal 
lpRect as RECT) As Integer

Thanks,

JW 


8. VB6 to VB .NET Terminal Server APIs - VB.Net