1. the error occurs on line 32
Code: Select all
res = XC_MessageBox(0, "Hello", "pCaption", 1)
2. the warning is on line 48
Code: Select all
@OnClick
Code: Select all
XC_API BOOL WINAPI XEle_RegEventC(HELE hEle, int nEvent, void *pFun);
Code: Select all
Dim As Any Ptr library = DyLibLoad("xcgui")
#define XE_BNCLICK 34
Dim XInitXCGUI As Function (ByVal pText As String) As Boolean
XInitXCGUI = DyLibSymbol(library, "XInitXCGUI")
Dim XWnd_Create As Function (ByVal x As Long,ByVal y As Long,ByVal cx As Long,ByVal cy As Long,ByVal pTitle As String,ByVal hWndParent As Long,ByVal XCStyle As Long) As Long
XWnd_Create = DyLibSymbol(library, "XWnd_Create")
Dim XBtn_Create As Function (ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal pName As String, ByVal hParent As Long) As Long
XBtn_Create = DyLibSymbol(library, "XBtn_Create")
Dim XEle_RegEventC As Function (ByVal hEle As Long, ByVal nEvent As Long, ByVal pFun As Long) As Boolean
XEle_RegEventC = DyLibSymbol(library, "XEle_RegEventC")
Dim XWnd_ShowWindow As Function (ByVal hWindow As Long,ByVal nCmdShow As Long) As Boolean
XWnd_ShowWindow = DyLibSymbol(library, "XWnd_ShowWindow")
Dim XC_MessageBox As Function(ByVal hWindow As Long, ByVal pText As String, ByVal pCaption As String, ByVal nFlags As Long) As Long
XC_MessageBox = DyLibSymbol(library, "XC_MessageBox")
Dim XRunXCGUI As Sub ()
XRunXCGUI = DyLibSymbol(library, "XRunXCGUI")
Dim XExitXCGUI As Sub ()
XExitXCGUI = DyLibSymbol(library, "XExitXCGUI")
Function OnClick(ByRef bHandle As Long) As Long
Dim as Long res
' ~ res = XC_MessageBox(0, "Hello", "pCaption", 1)
print "in OnClick"
bHandle = True
OnClick = 0
End Function
dim as Boolean bOk, bTmp
dim as LONG hWindow
dim as LONG hBtn
bOk = XInitXCGUI("")
If bOk Then
hWindow = XWnd_Create(0, 0, 300, 200, ("demo"), 0, 3)
hBtn = XBtn_Create( 8, 30, 100, 20, "button", hWindow )
bTmp = XEle_RegEventC(hBtn, XE_BNCLICK, @OnClick)
If hWindow <> 0 Then
XWnd_ShowWindow( hWindow, 5 )
XRunXCGUI()
End If
XExitXCGUI()
End If
DyLibFree(library)