home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / code / network / ogmess / ogrtn.txt < prev    next >
Text File  |  1995-02-27  |  3KB  |  142 lines

  1.  
  2. Sub centerwnd (source As Form)
  3. 'Center form on Screen
  4.  
  5.     scrx% = screen.width
  6.     scry% = screen.height
  7.  
  8.     source.top = scry% / 2 - source.height / 2
  9.     source.left = scrx% / 2 - source.width / 2
  10.  
  11. End Sub
  12.  
  13. Sub disp_sample (font As String, size As String)
  14. On Error GoTo errorhand
  15. Dim sampletxt As String
  16. If size = "" Then
  17.     size = "4"
  18. End If
  19.  
  20. If font = "" Then
  21.     font = printer.fonts(1)
  22. End If
  23.  
  24. sampletxt = "_____Sample Text_____"
  25.  
  26. prnmsg.samplepic.Cls
  27. prnmsg.samplepic.fontname = font
  28. prnmsg.samplepic.fontsize = Val(size)
  29.  
  30. 'vertical center
  31.     prnmsg.samplepic.currenty = Int(prnmsg.samplepic.scaleheight / 2) - Int(prnmsg.samplepic.TextHeight(sampletxt) / 2)
  32. 'Horizontal center
  33.     prnmsg.samplepic.currentx = Int(prnmsg.samplepic.scalewidth / 2) - Int(prnmsg.samplepic.TextWidth(sampletxt) / 2)
  34.  
  35.     prnmsg.samplepic.Print sampletxt
  36. errorhand:
  37.    Resume theend
  38. theend:
  39.  
  40. End Sub
  41.  
  42. Function getfield$ (thisfield As Integer, delimchar As String, delimstr As String)
  43.  
  44. Dim strrtn As String
  45. Dim inc, fldcnt, curloc As Integer
  46. Dim start, fin As Integer
  47.  
  48. curloc = 1
  49.  
  50. If delimstr = "" Then
  51.     getfield$ = ""
  52.     Exit Function
  53. End If
  54.  
  55. If thisfield = 1 Then
  56.     strrtn = Left$(delimstr, InStr(delimstr, delimchar) - 1)
  57. Else
  58.     For fldcnt = 1 To thisfield
  59.         curloc = InStr(curloc + 1, delimstr, delimchar)
  60.         If fldcnt = thisfield - 1 Then
  61.             start = curloc + 1
  62.         End If
  63.  
  64.         If fldcnt = thisfield Then
  65.             fin = curloc
  66.             If curloc = 0 And start > 0 Then
  67.                 fin = Len(delimstr)
  68.             End If
  69.         End If
  70.  
  71.     Next fldcnt
  72.     If start > fin Then
  73.         strrtn = ""
  74.     Else
  75.         strrtn = Mid$(delimstr, start, (fin - start))
  76.     End If
  77.  
  78. End If
  79. getfield$ = strrtn
  80.  
  81. End Function
  82.  
  83. Sub printmsg_rtn (source As String)
  84.  
  85. Dim fontnum As Integer
  86.  
  87. If source = "" Then
  88.     MsgBox "Error Nothing to Print", 48, "Print Message"
  89.     Exit Sub
  90. End If
  91. printstring = source
  92.  
  93. fontnum = printer.fontcount
  94. fontnum = fontnum - 1
  95. For i% = 0 To fontnum
  96.     prnmsg.fntnames.AddItem printer.fonts(i%)
  97. Next i%
  98. prnmsg.fntnames.text = printer.fonts(0)
  99.  
  100. For i% = 4 To 127
  101.     prnmsg.fntsize.AddItem Str$(i%)
  102. Next i%
  103. prnmsg.fntsize.text = "12"
  104.          sam$ = printer.fonts(1)
  105.          size$ = "4"
  106. Call disp_sample(sam$, "4")
  107. prnmsg.windowstate = 0
  108. prnmsg.Show
  109. End Sub
  110.  
  111. Sub resetup ()
  112. setup.pbox.text = maildir
  113. setup.usename.text = username
  114. setup.Show
  115. End Sub
  116.  
  117. Sub setup_rtn ()
  118.  
  119.     winpath = Environ$("windir")
  120.     namefile = winpath + "\" + "OGMESS.ini"
  121.  
  122.     On Error GoTo nofile
  123.     Open namefile For Input As #1
  124.     
  125.     Input #1, username
  126.     Input #1, maildir
  127.  
  128.     Close #1
  129.     setupflag = True
  130.     Exit Sub
  131.  
  132. nofile:
  133.     If Err = 53 Then
  134.     setup.Show
  135.     End If
  136.     Exit Sub
  137.     
  138.  
  139. End Sub
  140.  
  141.  
  142.