PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Stephane Fonteyne on April 03, 2005, 07:15:55 AM

Title: My first FireFly SDK Application with big troubles
Post by: Stephane Fonteyne on April 03, 2005, 07:15:55 AM
Dear FF Developers

I have written an program but the original code come from VB background but I have questions about how it translated into FF code statments because PB is procedural I know but I would like that some one help me the first steps to build my first application

Here is my example that used the COMM ports

This are my questions:

1. I try to translated the comment part of VB code into FF but I don't know how I can do that. I think with sendmessage but I don't sure how that can in FF. Can please somebody help me for translated this into FF code

2. How works that in FF? Can you explean in witch sections in FF put this
code?

I have this part of code:

Sub Command1_Click()
     Timer1.Interval = HScroll1.Value + 10
     Timer1.Enabled = True
End Sub

You are very thanks if you me help with my first troubles

I haven't Visual BASIC but I learn it in the college and I hate VB but most code for electronics written in VB or Delphi not in PBWin and I would to try all this applications translated into PB code with used FireFly and put this as freeware source, what do you think?



Global lOutPut As Long
'------------------------------------------------------------------------------------------------------------------------
Function FORM1_COMMAND1_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

'Timer1.Interval = HScroll.Value + 10
'Timer1.Enabled = True

End Function


'------------------------------------------------------------------------------------------------------------------------
Function FORM1_COMMAND2_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
'Timer1.Enabled = False

End Function


'------------------------------------------------------------------------------------------------------------------------
Function FORM1_HSCROLL1_WM_HSCROLL ( _
                                  ControlIndex  As Long,  _  ' index in Control Array
                                  hWndForm      As Dword, _  ' handle of Form
                                  hWndControl   As Dword, _  ' handle of Control
                                  nScrollCode   As Long,  _  ' scroll bar value
                                  nPosition     As Long   _  ' current scroll bar position
                                  ) As Long
'Is that the same "HScroll1_Change?
'Timer1.Interval = HScroll.Value + 10

End Function


'------------------------------------------------------------------------------------------------------------------------
Function FORM1_TIMER1_WM_TIMER ( _
                              hWndForm      As Dword, _  ' handle of Form
                              wTimerID      As Dword  _  ' the timer identifier
                              ) As Long  


' If lOutPut = 1 Then
' lOutput = 0
' Else
' lOutput = 1
' End If
'
' If lOutput = 1 Then
' DTR 1
' Else
' DTR 0
' End If

End Function


Title: Why don't somebody help me?
Post by: Stephane Fonteyne on April 04, 2005, 03:51:21 AM
Dear Support

Can you please help me how I can this translated and give me sugestions about me first FF project?

When come's the user manual with using FF for beginners???

Thank you
Title: Re: Why don't somebody help me?
Post by: Anonymous on April 04, 2005, 05:18:59 AM
Quote from: Stephane FonteyneCan you please help me how I can this translated and give me sugestions about me first FF project?

I am happy to charge $80 US per hour and I will be delighted to assist you with this rewrite. Could you please advise where I send my invoice to?

I also require an up-front payment of $250 from people I have not previously dealt with. That will be held on account for work that is carried out.

QuoteWhen come's the user manual with using FF for beginners???

There is no need for such a publication. Real developers have no problem at all learning how to use PB, FireFly and other development tools. Anyone who is struggling to learn these fine products is in the wrong job.

Andrew
Title: Kazz you are an money monomaniac !!!
Post by: Stephane Fonteyne on April 04, 2005, 05:42:00 AM
KazzMax

I want don't an answer of you. I'm student and I haven't money to much.
The others can answer me

I have bought that product and one gets no support, even almost no examples are that only support?. One had post more examples on forums and no activeX but examples of the use of controls it a step would be dense.

Thank you

I'm very angry. I would like support not money maniacs
Title: Re: Kazz you are an money monomaniac !!!
Post by: Anonymous on April 04, 2005, 06:14:24 AM
Quote from: Stephane FonteyneI have bought that product and one gets no support

Stephane,
It really is a pity that you feel obliged to insult Paul and other product authors like this. In my experience Paul has provided an outstanding level of support for all of his products and has never given me cause for concern that his products are lacking in support. He is in fact one of the better software authors - there are others I could name (but won't) who grab your money and then never respond.

If you are experiencing difficulty using this product, and particularly as you insist on posting similar comments and cries for help in the PB forums and elsewhere to my certain knowledge, then I strongly suggest that you consider where the real problem might be.

No-one owes you an improved level of support and that's a fact. If you are having problems getting to grips with FireFly (and this is a trend I have seen with you over several months), for Christs sake give it up and go find something else which will be more rewarding to you.

Now let us look at the situation in real terms. A senior developer such as Paul should be able to command up to $100 per hour at least for his time. FireFly is $99 per copy. Just how many "free" hours do you expect Paul to give to you in your quest for better support?

Basically, if you can't cook then I suggest you stay out of the kitchen, and stop criticising the chef.

QuoteI'm very angry. I would like support not money maniacs

Put your anger to one side, and just for once consider the commercial implications of what you are suggesting.

You are a student. Fine. When you leave college/university/primary school or whatever you will go out to work to earn a living. Do you consider it will be acceptable for you to work for $1 per hour - or less? Because that's exactly what you are requesting Paul and others to provide you with, with your moronic pleas for help.

You need to get a life and understand that you are the one who has limitations, not other people that you are so quick to criticise.

Andrew
Title: My first FireFly SDK Application with big troubles
Post by: TechSupport on April 04, 2005, 11:36:40 AM
Stephane,

You will need to learn how to use SetTimer and KillTimer functions, as well as learn how to retrieve and set the HScroll position. I have included the code below. You should download and search POFFS (from Borje Hagsten) for more information. There are plenty of examples there.

FireFly is not VB so don't expect it to work like VB.

Also, although I am grateful that you purchased FireFly, please do not have the expectation that I will convert all of your programs. I have noticed that you have asked Dominic (Phoenix) and Chris (EZGUI) to do the exact the same thing that you asked here. My advice: If you can not learn any one of these products then maybe you should stick with VB. I don't mean that in a bad way. You should use the programming tools that get the job done. It has been 5 years so you obviously can not get the job done with PowerBASIC so you may be better off continuing to use the higher level VB tools.


Global lOutPut As Long
Global TimerID As Long

'------------------------------------------------------------------------------------------------------------------------
Function FORM1_COMMAND1_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

  Local SI As SCROLLINFO
  Local Interval As Long
   
  'Get the current scroll information
  SI.fMask = %SIF_ALL
  SendMessage HWND_FORM1_HSCROLL1, %SBM_GETSCROLLINFO, 0, VarPtr(SI)

  Interval = SI.nPos
  TimerID = SetTimer( %Null, %Null, Interval * 1000, CodePtr(TimerProc) )

End Function


'------------------------------------------------------------------------------------------------------------------------
Function FORM1_COMMAND2_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

  If TimerID Then KillTimer %Null, TimerID
   
End Function


'------------------------------------------------------------------------------------------------------------------------
Function FORM1_HSCROLL1_WM_HSCROLL ( _
                                  ControlIndex  As Long,  _  ' index in Control Array
                                  hWndForm      As Dword, _  ' handle of Form
                                  hWndControl   As Dword, _  ' handle of Control
                                  nScrollCode   As Long,  _  ' scroll bar value
                                  nPosition     As Long   _  ' current scroll bar position
                                  ) As Long

   Local SI As SCROLLINFO
   Local Interval As Long
   
   'Get the current scroll information
   SI.fMask = %SIF_ALL
   SendMessage HWND_FORM1_HSCROLL1, %SBM_GETSCROLLINFO, 0, VarPtr(SI)
   
   'Calculate the new position based on the action
   Select Case nScrollCode
   Case %SB_LINEDOWN
       Incr SI.nPos
   Case %SB_PAGEDOWN
       SI.nPos = SI.nPos + Si.nPage
   Case %SB_LINEUP
       Decr SI.nPos
   Case %SB_PAGEUP
       SI.nPos = SI.nPos - Si.nPage
   Case %SB_THUMBPOSITION, %SB_THUMBTRACK
       SI.nPos = nPosition
   Case Else
       Exit Function
End Select

  ' Ensure range is correct
  SI.nPos = Max&(Si.nMin, Min&(SI.nPos, Si.nMax - Si.nPage + 1))

  ' Update the scroll bar
  Si.fMask = %SIF_POS
  SendMessage HWND_FORM1_HSCROLL1, %SBM_SETSCROLLINFO, %TRUE, VarPtr(Si)
             
             
  'kill the current timer and create a new one based on the new interval
  If TimerID Then KillTimer %Null, TimerID
 
  Interval = SI.nPos
 
  'Create the new timer. If the HScroll is not set in milliseconds then you
  'will need to multiple the Interval value by 1000.
  TimerID = SetTimer( %Null, %Null, Interval * 1000, CodePtr(TimerProc) )

End Function


'------------------------------------------------------------------------------------------------------------------------
Function TimerProc( ByVal hWnd As Dword, _
                   ByVal uMsg As Long, _
                   ByVal idEvent As Long, _
                   ByVal dwTime As Long _
                   ) As Long
                   
  If lOutPut = 1 Then
     lOutput = 0
  Else
     lOutput = 1
  End If
   
  If lOutput = 1 Then
     DTR 1
  Else
     DTR 0
  End If

End Function



'------------------------------------------------------------------------------------------------------------------------
Function FORM1_WM_DESTROY ( _
                         hWndForm      As Dword _  ' handle of Form
                         ) As Long
                         
                         
  'ensure that the timer is killed                      
  If TimerID Then KillTimer %Null, TimerID

End Function
Title: My first FireFly SDK Application with big troubles
Post by: Elias Montoya on April 04, 2005, 09:40:09 PM
Ok here is my shot...

Hello Stephane :), PB/Firefly Is not and does not works as VB
Althoug Firefly provides certain environment alikeness for those
that comes from VB environments, Firefly works quite different.

VB has a lot of internal "wrappers" that are not yet available in firefly,
paul is making a great job but most likely adding all the stuff from VB
would be like re-inventing the weel.

I suggest you to focus in one single programming environment, if
you like PB go ahead and learn it, it wont be easy, you have to read a
lot, repeating the questions will not make the answer you expect to exist. The quality of the answers you receive can be hardly improved,
you wont get a 2 line answer.

I saw your post in the EZGUI forum and i am sincerely surprised by how patient chris is... he gave you fine answers and you still kept asking the
same question. that is not very polite. You know i dont hate you, and you
know i am vert patient :). but ignoring the effort of some developers to
help you is not nice... you should at least try the answers you get.

If you are reading this far, its good, this means you are interested in reading the answers you get, if you dont, then 897uieyifsgha gkadh gfkhagds kf kj kuyt e oiyp oier ernmw,rgjwegr ew rejrqe.  :D

I suggest you that if you like PB focus in pb and drop any other
language, this will help you in learning SDK and all the win api.

Cheers stephane!!! :)

Elias :)
Title: Elias I hope that you can answer to my questions
Post by: Stephane Fonteyne on April 05, 2005, 03:33:54 AM
Elias

Thank you for your responding
I post almost my worked code but I not sure if all the code works.
Can someone look at my code?



Global lOutPut As Long
Global TimerID As Long
Global hComm As Long
'------------------------------------------------------------------------------------------------------------------------
Function FORM1_COMMAND1_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

'Benodigde variabeken voor de schuifbalk
Local SI As SCROLLINFO
  Local Interval As Long
   
  'Get the current scroll information
  SI.fMask = %SIF_ALL
  SendMessage HWND_FORM1_HSCROLL1, %SBM_GETSCROLLINFO, 0, VarPtr(SI)

  Interval = SI.nPos
  TimerID = SetTimer(%Null, %Null, Interval * 1000, CodePtr(TimerProc))

End Function


'------------------------------------------------------------------------------------------------------------------------
Function FORM1_COMMAND2_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
                                 
 If TimerID Then
  KillTimer %Null, TimerID
 End If

End Function

'------------------------------------------------------------------------------------------------------------------------
Function FORM1_HSCROLL1_WM_HSCROLL ( _
                                  ControlIndex  As Long,  _  ' index in Control Array
                                  hWndForm      As Dword, _  ' handle of Form
                                  hWndControl   As Dword, _  ' handle of Control
                                  nScrollCode   As Long,  _  ' scroll bar value
                                  nPosition     As Long   _  ' current scroll bar position
                                  ) As Long

Local SI As SCROLLINFO
   Local Interval As Long
   
   'Get the current scroll information
   SI.fMask = %SIF_ALL
   SendMessage HWND_FORM1_HSCROLL1, %SBM_GETSCROLLINFO, 0, VarPtr(SI)
   
   'Calculate the new position based on the action
   Select Case nScrollCode
      Case %SB_LINEDOWN
          Incr SI.nPos
      Case %SB_PAGEDOWN
          SI.nPos = SI.nPos + Si.nPage
      Case %SB_LINEUP
          Decr SI.nPos
      Case %SB_PAGEUP
          SI.nPos = SI.nPos - Si.nPage
      Case %SB_THUMBPOSITION, %SB_THUMBTRACK
          SI.nPos = nPosition
      Case Else
          Exit Function
  End Select

  ' Ensure range is correct
  SI.nPos = Max&(Si.nMin, Min&(SI.nPos, Si.nMax - Si.nPage + 1))

  ' Update the scroll bar
  Si.fMask = %SIF_POS
  SendMessage HWND_FORM1_HSCROLL1, %SBM_SETSCROLLINFO, %TRUE, VarPtr(Si)
               
  'kill the current timer and create a new one based on the new interval
  If TimerID Then
  KillTimer %Null, TimerID
  End If
     
  Interval = SI.nPos
   
  'Create the new timer. If the HScroll is not set in milliseconds then you
  'will need to multiple the Interval value by 1000.
  TimerID = SetTimer( %Null, %Null, Interval * 1000, CodePtr(TimerProc) )

End Function

Function TimerProc( ByVal hWnd As Dword, _
                   ByVal uMsg As Long, _
                   ByVal idEvent As Long, _
                   ByVal dwTime As Long _
                   ) As Long
                   
  If lOutPut = 1 Then
     lOutput = 0
  Else
     lOutput = 1
  End If
   
  If lOutput = 1 Then
  Comm Set #hComm, DtrFlow  = 1  ' Enable DTR
  Else
  Comm Set #hComm, DtrFlow  = 0  ' Disable DTR
  End If

End Function

'------------------------------------------------------------------------------------------------------------------------
Function FORM1_WM_DESTROY ( _
                         hWndForm      As Dword _  ' handle of Form
                         ) As Long
                         
'ensure that the timer is killed                        
  If TimerID Then
  KillTimer %Null, TimerID
  End If    
 
  'CloseComm Port
  Comm Close #hComm

End Function


'------------------------------------------------------------------------------------------------------------------------
Function FORM1_WM_CREATE ( _
                        hWndForm As Dword _  ' handle of Form
                        ) As Long
 
   Local Interval As Long

Comm Open "COM2" As #hComm
Comm Set #hComm, Baud = 1200   ' 9600 baud
Comm Set #hComm, Parity = 0   ' No parity
Comm Set #hComm, Byte   = 8    ' 8 bits
Comm Set #hComm, Stop   = 0    ' 1 stop bit

If hComm = 0 Then
MsgBox "Comport not found"
End If

'Timer1.Interval = 250
'Timer1.Enabled = True

'I try this:
TimerID = SetTimer(%Null, %Null, Interval * 1000, CodePtr(TimerProc))
End Function



Paul

Thank you for your help because if you like in the future not code translated again can you please give me the steps how I can current VB programs translated into FF/PBWin code but PB used only procedures, functions and VB used properties, methods

I would like that you explain me the difference of VB and PB how I can build in the future and without any problems to translated this VB code in this book that I have bought last three weeks its about "PC Ports under Windows - measurement, controlled and drive through the standard ports in your PC

The most applications has written in Visual BASIC 5.0 and Delphi and I'm not interested in this program environment. I very like PowerBASIC and I would like written there applications

I have plans to bought an Win32 API book I look this in your website thanks

My question is that you explain in theory and with this short example how I cant step by step translated this from VB into PBWin/FF?

Example:

'// Properties

Timer1.Interval = 250
Timer1.Enabled = True

I want that you help me and simply explain how I must convert properties and methods from VB background into functions and procedures can will program this way I at least one project.

Please do my an pleasure and help me on the right road

Can you checked in my code if that correct?

Kind regards
Stephane
Title: My first FireFly SDK Application with big troubles
Post by: Elias Montoya on April 05, 2005, 04:49:10 AM
Hello Stephane,

Firefly has a Timer control wich makes things easier. Just add it
as any other control and modify the properties of it to set the Interval.

Then, add your code in the Timer procedure, it looks like this:


Function FORM1_TIMER1_WM_TIMER ( _
                              hWndForm      As Dword, _  ' handle of Form
                              wTimerID      As Dword  _  ' the timer identifier
                              ) As Long

'Add your code here.


End Function


Cheers!!

Elias :)
Title: Can you please answer to my above mail
Post by: Stephane Fonteyne on April 05, 2005, 07:04:28 AM
Elias

Thank you for this idea of the Timer
I hope that paul more added FF functions into FF.

Elias can you please answer to my questions see the previous message (above) ?

Thank you
Stephane
Title: My first FireFly SDK Application with big troubles
Post by: Elias Montoya on April 05, 2005, 08:01:42 PM
I try to translated the comment part of VB code into FF but I don't know how I can do that. I think with sendmessage but I don't sure how that can in FF. Can please somebody help me for translated this into FF code ?

Stephane, translation means something must be altered in order to be
compatible/understandable/workeable in another environment. Thats what
all the guys here have been doing. Please dont expect the same code to
work as-is. Translation involves change.

How works that in FF? Can you explean in witch sections in FF put this
code?


You have got explanations of how this works (timers)!!, do you want
some one to put together your program? thats what im :roll:  guessing you
want. I will help you this time... but this is not the way you will learn
stuff stephane,  you need to practice, fail and correct errors.

Cheers!

Link Removed....
Sorry stephane, i forgot im using the wrong format...
please be patiend few days and i will send you the file ok?

Elias :)
Title: My first FireFly SDK Application with big troubles
Post by: Stephane Fonteyne on April 06, 2005, 05:57:12 AM
Dear Support

I posted almost my worked code but I have een little problem for translated this VB code in FF/PBWin code.

Can here an developer help me how I can this translated?

Thanks for your help for this code.
If this code works with the COMM port I post this in the source forum if you like that


Global lOutPut As Long
Global TimerID As Long
Global hComm As Long
'------------------------------------------------------------------------------------------------------------------------
Function FORM1_COMMAND1_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

'Benodigde variabeken voor de schuifbalk
Local SI As SCROLLINFO
  Local Interval As Long
   
  'Get the current scroll information
  SI.fMask = %SIF_ALL
  SendMessage HWND_FORM1_HSCROLL1, %SBM_GETSCROLLINFO, 0, VarPtr(SI)

  Interval = SI.nPos
  TimerID = SetTimer(%Null, %Null, Interval * 1000, CodePtr(TimerProc))

End Function


'------------------------------------------------------------------------------------------------------------------------
Function FORM1_COMMAND2_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
                                 
 If TimerID Then
  KillTimer %Null, TimerID
 End If

End Function

'------------------------------------------------------------------------------------------------------------------------
Function FORM1_HSCROLL1_WM_HSCROLL ( _
                                  ControlIndex  As Long,  _  ' index in Control Array
                                  hWndForm      As Dword, _  ' handle of Form
                                  hWndControl   As Dword, _  ' handle of Control
                                  nScrollCode   As Long,  _  ' scroll bar value
                                  nPosition     As Long   _  ' current scroll bar position
                                  ) As Long

Local SI As SCROLLINFO
   Local Interval As Long
   
   'Get the current scroll information
   SI.fMask = %SIF_ALL
   SendMessage HWND_FORM1_HSCROLL1, %SBM_GETSCROLLINFO, 0, VarPtr(SI)
   
   'Calculate the new position based on the action
   Select Case nScrollCode
      Case %SB_LINEDOWN
          Incr SI.nPos
      Case %SB_PAGEDOWN
          SI.nPos = SI.nPos + Si.nPage
      Case %SB_LINEUP
          Decr SI.nPos
      Case %SB_PAGEUP
          SI.nPos = SI.nPos - Si.nPage
      Case %SB_THUMBPOSITION, %SB_THUMBTRACK
          SI.nPos = nPosition
      Case Else
          Exit Function
  End Select

  ' Ensure range is correct
  SI.nPos = Max&(Si.nMin, Min&(SI.nPos, Si.nMax - Si.nPage + 1))

  ' Update the scroll bar
  Si.fMask = %SIF_POS
  SendMessage HWND_FORM1_HSCROLL1, %SBM_SETSCROLLINFO, %TRUE, VarPtr(Si)
               
  'kill the current timer and create a new one based on the new interval
  If TimerID Then
  KillTimer %Null, TimerID
  End If
     
  Interval = SI.nPos
   
  'Create the new timer. If the HScroll is not set in milliseconds then you
  'will need to multiple the Interval value by 1000.
  TimerID = SetTimer( %Null, %Null, Interval * 1000, CodePtr(TimerProc) )

End Function

Function TimerProc( ByVal hWnd As Dword, _
                   ByVal uMsg As Long, _
                   ByVal idEvent As Long, _
                   ByVal dwTime As Long _
                   ) As Long
                   
  If lOutPut = 1 Then
     lOutput = 0
  Else
     lOutput = 1
  End If
   
  If lOutput = 1 Then
  Comm Set #hComm, DtrFlow  = 1  ' Enable DTR
  Else
  Comm Set #hComm, DtrFlow  = 0  ' Disable DTR
  End If

End Function

'------------------------------------------------------------------------------------------------------------------------
Function FORM1_WM_DESTROY ( _
                         hWndForm      As Dword _  ' handle of Form
                         ) As Long
                         
'ensure that the timer is killed                        
  If TimerID Then
  KillTimer %Null, TimerID
  End If    
 
  'CloseComm Port
  Comm Close #hComm

End Function


'------------------------------------------------------------------------------------------------------------------------
Function FORM1_WM_CREATE ( _
                        hWndForm As Dword _  ' handle of Form
                        ) As Long
 
   Local Interval As Long

Comm Open "COM2" As #hComm
Comm Set #hComm, Baud = 1200   ' 9600 baud
Comm Set #hComm, Parity = 0   ' No parity
Comm Set #hComm, Byte   = 8    ' 8 bits
Comm Set #hComm, Stop   = 0    ' 1 stop bit

If hComm = 0 Then
MsgBox "Comport not found"
End If

'Timer1.Interval = 250
'Timer1.Enabled = True

'I try this:
TimerID = SetTimer(%Null, %Null, Interval * 1000, CodePtr(TimerProc))
End Function


Function FORM1_WM_CREATE ( _
                        hWndForm As Dword _  ' handle of Form
                        ) As Long
 
   Local Interval As Long

Comm Open "COM2" As #hComm
Comm Set #hComm, Baud = 1200   ' 9600 baud
Comm Set #hComm, Parity = 0   ' No parity
Comm Set #hComm, Byte   = 8    ' 8 bits
Comm Set #hComm, Stop   = 0    ' 1 stop bit

If hComm = 0 Then
MsgBox "Comport not found"
End If

'Timer1.Interval = 250
'Timer1.Enabled = True

'I try this:
TimerID = SetTimer(%Null, %Null, Interval * 1000, CodePtr(TimerProc))
End Function



Is that correct?

Thanks your help
Title: My first FireFly SDK Application with big troubles
Post by: Anonymous on April 06, 2005, 06:42:08 AM
Stephane,
I despair.

You are asking such simple questions that it is clear that you haven't even reached first base with respect to programming, and yet you have been trying for how long? Several years I believe from what I have learnt.

Plus you are asking these and similar rather silly questions on multiple support forums for this product and several other products. Why do you do this? Are you so incompetent that you don't understand any programming at all and think that the answer to your dreams is to learn multiple products rather than taking the sane approach by learning just one?

Or is it that you are just an attention-seeker?

For gods sake give it up man. You have zero chance of ever making it as a programmer. I'm sorry to be so direct about it, but it is a fact that you are wasting an awful lot of people's time with your continued whingeing about getting other people to check simple code.

My $80 an hour offer still stands.

Andrew
Title: My first FireFly SDK Application with big troubles
Post by: Stephane Fonteyne on April 06, 2005, 06:50:29 AM
it's only this lines:

'Timer1.Interval = 250
  'Timer1.Enabled = True
   
  'I try this:
  TimerID = SetTimer(%Null, %Null, Interval * 1000, CodePtr

Is that correct

Is that an payent help support?. I don't know it

I prefer an WinAPI book sure?
Title: My first FireFly SDK Application with big troubles
Post by: Anonymous on April 06, 2005, 06:54:33 AM
Stephane,
Go to the following web site:

http://msdn.microsoft.com/

In the search box at the top enter the following:

SetTimer

Click on the GO button.

MSDN responds with a list of matches. Click on the top one and the answer you need is there.

Andrew
Title: My first FireFly SDK Application with big troubles
Post by: Elias Montoya on April 07, 2005, 02:14:25 AM
Stephane, here is a working code, you need to add 2 labels and a horizontal scroll bar in a form in order to make it work. I wont be
re-explaining anything, sorry. I hope you can make this working
code work. :)

Type Timertype
Interval as Long
ID       as Long
end type

Global Timer1 as Timertype
Global lOutPut As Long
Global TimerID As Long
Global hComm As Long
'------------------------------------------------------------------------------------------------------------------------
Function FORM1_HSCROLL1_WM_HSCROLL ( _
                                  ControlIndex  As Long,  _  ' index in Control Array
                                  hWndForm      As Dword, _  ' handle of Form
                                  hWndControl   As Dword, _  ' handle of Control
                                  nScrollCode   As Long,  _  ' scroll bar value
                                  nPosition     As Long   _  ' current scroll bar position
                                  ) As Long

  Local SI As SCROLLINFO
   Local Interval As Long
   
   'Get the current scroll information
   SI.fMask = %SIF_ALL
   SendMessage HWND_FORM1_HSCROLL1, %SBM_GETSCROLLINFO, 0, VarPtr(SI)
   
   'Calculate the new position based on the action
   Select Case nScrollCode
      Case %SB_LINEDOWN
          Incr SI.nPos
      Case %SB_PAGEDOWN
          SI.nPos = SI.nPos + Si.nPage
      Case %SB_LINEUP
          Decr SI.nPos
      Case %SB_PAGEUP
          SI.nPos = SI.nPos - Si.nPage
      Case %SB_THUMBPOSITION, %SB_THUMBTRACK
          SI.nPos = nPosition
      Case Else
          Exit Function
  End Select
 
  ' Ensure range is correct
  SI.nPos = Max&(Si.nMin, Min&(SI.nPos, Si.nMax - Si.nPage + 1))
 
  ' Update the scroll bar
  Si.fMask = %SIF_POS
  SendMessage HWND_FORM1_HSCROLL1, %SBM_SETSCROLLINFO, %TRUE, VarPtr(Si)
               
  'kill the current timer and create a new one based on the new interval
  If Timer1.ID Then KillTimer %Null, Timer1.ID        
  Timer1.Interval = SI.nPos * 50
   
  'Create the new timer. If the HScroll is not set in milliseconds then you
  'will need to multiple the Interval value by 1000.
  Timer1.ID = SetTimer( %Null, %Null, Timer1.Interval, CodePtr(TimerProc))
 
  FF_Control_SetText HWND_FORM1_LABEL2, format$(Timer1.Interval)

End Function
'------------------------------------------------------------------------------------------------------------------------
Function TimerProc( ByVal hWnd As Dword, _
                   ByVal uMsg As Long, _
                   ByVal idEvent As Long, _
                   ByVal dwTime As Long _
                   ) As Long
                   
  If lOutPut = 1 Then
     lOutput = 0
  Else
     lOutput = 1
  End If
   
  If lOutput = 1 Then
        Comm Set #hComm, DtrFlow  = 1  ' Enable DTR
  Else
        Comm Set #hComm, DtrFlow  = 0  ' Disable DTR
  End If
 
  FF_Control_SetText HWND_FORM1_LABEL1, "Timer event at : " & format$(Timer)
 
End Function

'------------------------------------------------------------------------------------------------------------------------
Function FORM1_WM_DESTROY ( _
                         hWndForm      As Dword _  ' handle of Form
                         ) As Long
                         
  'ensure that the timer is killed                        
  If Timer1.ID Then KillTimer %Null, Timer1.ID  
   
  'CloseComm Port
  Comm Close #hComm

End Function


'------------------------------------------------------------------------------------------------------------------------
Function FORM1_WM_CREATE ( _
                        hWndForm As Dword _  ' handle of Form
                        ) As Long
 
   Local Interval As Long
   
   Comm Open "COM2" As #hComm
  Comm Set #hComm, Baud = 1200   ' 9600 baud
  Comm Set #hComm, Parity = 0      ' No parity
  Comm Set #hComm, Byte   = 8    ' 8 bits
  Comm Set #hComm, Stop   = 0    ' 1 stop bit
   
  If hComm = 0 Then
   FF_Control_SetText HWND_FORM1, "Comport not found, Program stopped"
  Else
   FF_Control_SetText HWND_FORM1, "Comport found and working"  
  End If
   
  'I try this:
  Timer1.Interval = 50
  Timer1.ID = SetTimer(%Null, %Null, Timer1.Interval, CodePtr(TimerProc))
  FF_Control_SetText HWND_FORM1_LABEL2, format$(Timer1.Interval)
 
End Function