Hi paul,
1.) Where do I place the GLOBAL variabels in my project?
It give me the next error if I placed this globals in the form code.
Global g_Address As Integer : g_Address = &HFEE8
Global g_Baudrate As Integer
Global g_Init As Long : g_Init = %FALSE
Function FORM1_BTNCONNECT_BN_CLICKED ( _
ControlIndex As Long, _ ' index in Control Array
hWndForm As Dword, _ ' handle of Form
hWndControl As Dword, _ ' handle of Control
idButtonControl As Long _ ' identifier of button
) As Long
.......
Error: Error 484
(https://www.planetsquires.com/protect/forum/proxy.php?request=http%3A%2F%2Fimg856.imageshack.us%2Fimg856%2F3862%2Fimage2yv.jpg&hash=93fe9a32ef27c98c4e7d2674378f1d3f8edcfc1d) (http://imageshack.us/photo/my-images/856/image2yv.jpg/)
Uploaded with ImageShack.us (http://imageshack.us)
Best regards
You obviously cannot initialize a variable outside of a sub/function.
Your "Global g_Address As Integer" is correct where it is.
You need to move the "g_Address = &HFEE8" to a place inside a sub or function.
Hi Stephane,
Here is what I usualy do:
1) add a new module to your project named 'globals.bas' or 'main.bas' ...
2) Add all globals to the top of the module
3) add a sub named 'InitApp'
4) declare your values in the sub.
You should have something like this:
Global g_Address As Integer
Global g_Baudrate As Integer
Global g_Init As Long
sub InitApp
g_Address = &HFEE8
g_Init = %FALSE
end sub
5) Go to the FF_WINMAIN function of your project and add 'call InitApp'
Function FF_WINMAIN( ByVal hInstance As Dword, _
ByVal hPrevInstance As Dword, _
ByVal lpCmdLine As Asciiz Ptr, _
ByVal iCmdShow As Long ) As Long
' If this function returns TRUE (non-zero) then the actual WinMain will exit
' thus ending the program. You can do program initialization in this function.
call InitApp
Function = %FALSE 'return %TRUE if you want the program to end.
End Function