vb.net help

87 views
Skip to first unread message

Mark Hansen

unread,
Jun 23, 2011, 2:23:32 PM6/23/11
to WinSparkle
I am having difficulty implimenting WinSparkle into my vb.net
application (VS 2010 professional,
Window 7 Enterprise on a 64bit Dell).

I have created a WinSparkle class to expose the WinSparkle.dll (see
below).
Then, call the WinSparkle functions in the main_load subroutine (see
below).
When the "WinSparkle.win_sparkle_set_appcast_url(<url name>) is
executed,
a "PInvokeStackImbalance was detected" error occurs.

I have exausted all my ideas to solve the problem and am guessing it
is a very simple
solution.

Thank you
Mark Hansen

------------------------------------- WinSparkle Class
---------------------------
Imports System
Imports System.Runtime.InteropServices
Public Class WinSparkle
<DllImport("WinSparkle.dll")> _
Public Shared Function win_sparkle_init() As Boolean
End Function
<DllImport("WinSparkle.dll")> _
Public Shared Function win_sparkle_cleanup() As Boolean
End Function
<DllImport("WinSparkle.dll")> _
Public Shared Function win_sparkle_set_appcast_url(ByVal url As
String) As Boolean
End Function
<DllImport("WinSparkle.dll")> _
Public Shared Function win_sparkle_set_app_details(ByVal
company_name As String, ByVal app_name As String) As Boolean
End Function
<DllImport("WinSparkle.dll")> _
Public Shared Function win_sparkle_set_registry_path(ByVal path As
String) As Boolean
End Function
<DllImport("WinSparkle.dll")> _
Public Shared Function win_sparkle_check_update_with_ui() As
Boolean
End Function
End Class
---------------------------------------------------------------------------------


----------------------------
MAIN_Load--------------------------------------
Option Strict Off
Option Explicit On
Imports System.IO.Ports
Imports System.IO.Ports.SerialPort
Imports VB = Microsoft.VisualBasic
Friend Class CO2calcMain
Inherits System.Windows.Forms.Form
Public comm As New CommManager()
Dim frmM As frmMain
Dim bDMS, BtPAdjust As Boolean
Dim GGAs As String

Private Sub CO2AppMain_Load(ByVal eventSender As System.Object,
ByVal eventArgs As System.EventArgs) Handles MyBase.Load
Try
Dim SparkUrl As String = "http://coastal.er.usgs.gov/
appcast/CO2calc_win_appcast.xml"
Dim bTF As Boolean
bTF = WinSparkle.win_sparkle_set_appcast_url(SparkUrl)
bTF = WinSparkle.win_sparkle_init()
bTF = WinSparkle.win_sparkle_check_update_with_ui()
' ... more code would go here...
' ... somewhere as you leave your app
bTF = WinSparkle.win_sparkle_cleanup()
...
-------------------------------------------------------------

and...@t-online.de

unread,
Aug 12, 2013, 9:30:21 AM8/12/13
to winsp...@googlegroups.com
When Importing the DLLs in the WinSparkle Class you need to set the Parameters as described in the Documentation section

Create a wrapper for the WinSparkle methods you are going to call


http://winsparkle.org/wiki/Doc/BasicSetup#Managedcode.NetCapplications

------------------------------
------- WinSparkle Class
---------------------------
Imports System
Imports System.Runtime.InteropServices
Public Class WinSparkle
    <DllImport("WinSparkle.dll", CallingConvention:=CallingConvention.Cdecl)> _
    Public Shared Function win_sparkle_init() As Boolean
    End Function
    <DllImport("WinSparkle.dll", CallingConvention:=CallingConvention.Cdecl)> _
    Public Shared Function win_sparkle_cleanup() As Boolean
    End Function
    <DllImport("WinSparkle.dll", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.Cdecl)> _
    Public Shared Function win_sparkle_set_appcast_url(ByVal url As
String) As Boolean
    End Function
    <DllImport("WinSparkle.dll", CharSet:=CharSet.Unicode, CallingConvention:=CallingConvention.Cdecl)> _
    Public Shared Function win_sparkle_set_app_details(ByVal
company_name As String, ByVal app_name As String) As Boolean
    End Function
    <DllImport("WinSparkle.dll", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.Cdecl)> _
    Public Shared Function win_sparkle_set_registry_path(ByVal path As
String) As Boolean
    End Function
    <DllImport("WinSparkle.dll", CallingConvention:=CallingConvention.Cdecl)> _
    Public Shared Function win_sparkle_check_update_with_ui() As
Boolean
    End Function
End Class
---------------------------------------------------------------------------------

Two years too late but at least an answer for Users with the same problem.
Reply all
Reply to author
Forward
0 new messages