Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. Expletive Deleted

Expletive Deleted

Scheduled Pinned Locked Moved The Weird and The Wonderful
question
37 Posts 15 Posters 27 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Rob Grainger

    Yet another delight from the VB6 rewrite...

    ' Read a setting from XXXX.ini
    Function GetINI(heading As String, setting As String, iniPath As String)
    Dim temp As String * 120
    Dim ret As Long

    If iniPath = "Default" Then
        iniPath = gl\_DatabaseDir & "\\XXXX.ini"
    End If
    
    ret = GetPrivateProfileString(heading, setting, iniPath, temp, Len(temp), iniPath)
    
    If ret = 0 Then
        Beep            ' Really ?
    Else
        GetINI = Trim(temp)
    End If
    

    End Function

    I think this is like pre-watershed television, where expletives are covered by a beep. It's also worth considering that none of our PC's have a speaker ;-)

    "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.

    V Offline
    V Offline
    vonb
    wrote on last edited by
    #2

    If this function is called many times from different threads and by some reason the XXXX.ini cannot be found, the result will be: beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep; ctrl+Alt+Delete --> Task Manager --> End Process Imagine if it's a night over batch...

    The signature is in building process.. Please wait...

    R L 2 Replies Last reply
    0
    • V vonb

      If this function is called many times from different threads and by some reason the XXXX.ini cannot be found, the result will be: beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep; ctrl+Alt+Delete --> Task Manager --> End Process Imagine if it's a night over batch...

      The signature is in building process.. Please wait...

      R Offline
      R Offline
      Rob Grainger
      wrote on last edited by
      #3

      Luckily its in a GUI application. Although the idea of a machine in the server room going Beep repeatedly amuses me.

      "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.

      P 1 Reply Last reply
      0
      • R Rob Grainger

        Yet another delight from the VB6 rewrite...

        ' Read a setting from XXXX.ini
        Function GetINI(heading As String, setting As String, iniPath As String)
        Dim temp As String * 120
        Dim ret As Long

        If iniPath = "Default" Then
            iniPath = gl\_DatabaseDir & "\\XXXX.ini"
        End If
        
        ret = GetPrivateProfileString(heading, setting, iniPath, temp, Len(temp), iniPath)
        
        If ret = 0 Then
            Beep            ' Really ?
        Else
            GetINI = Trim(temp)
        End If
        

        End Function

        I think this is like pre-watershed television, where expletives are covered by a beep. It's also worth considering that none of our PC's have a speaker ;-)

        "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #4

        Welcome to my world. We have an application that was converted from mainframe COBOL to netCobol, i.e. the worst .Net step-child ever thought up, then converted to C# a few years later. The Brainchild behind this endeavor felt it necessary to code this into the netCobol version.

        toolStripStatusLabel1.Text = "Silly error message that by rights should be in a message box.";
        Console.Beep();

        This kind of thing exists 87 times and they're still in the new C# version. I figure if a message to the user is important enough to require a beep to get their attention, it should really be in a message box. Then again, the person coding this app also thought it would be a good idea to load the main form with 12,000+ lines of code, most of which is business logic. But what do I know, I only have an associates degree.

        Comments from work:

        • "Why can't you just do it like everybody else?"
        • "Well, we haven't had any complaints yet."
        • "I just want to get it into production."
        • "It only matters if it’s important to someone who matters."
        R 1 Reply Last reply
        0
        • L Lost User

          Welcome to my world. We have an application that was converted from mainframe COBOL to netCobol, i.e. the worst .Net step-child ever thought up, then converted to C# a few years later. The Brainchild behind this endeavor felt it necessary to code this into the netCobol version.

          toolStripStatusLabel1.Text = "Silly error message that by rights should be in a message box.";
          Console.Beep();

          This kind of thing exists 87 times and they're still in the new C# version. I figure if a message to the user is important enough to require a beep to get their attention, it should really be in a message box. Then again, the person coding this app also thought it would be a good idea to load the main form with 12,000+ lines of code, most of which is business logic. But what do I know, I only have an associates degree.

          Comments from work:

          • "Why can't you just do it like everybody else?"
          • "Well, we haven't had any complaints yet."
          • "I just want to get it into production."
          • "It only matters if it’s important to someone who matters."
          R Offline
          R Offline
          Rob Grainger
          wrote on last edited by
          #5

          I feel for you, I really do. The one redeeming factor where I am is that I'm in the position of determining the new architecture, so a lot of detritus is firmly being shown the door. PS. I knew some company must have been using one of the odd .NET COBOL variants. It could be worse, I had to port some RPG to C years ago, and there is indeed an RPG .NET compiler. Look at the (Wikipedia[^] to see how bad things could be.

          "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.

          L 1 Reply Last reply
          0
          • R Rob Grainger

            Luckily its in a GUI application. Although the idea of a machine in the server room going Beep repeatedly amuses me.

            "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.

            P Offline
            P Offline
            PIEBALDconsult
            wrote on last edited by
            #6

            Soooo... I get to roll out my story about having a server play Westminster Chimes on its speaker again? :cool:

            1 Reply Last reply
            0
            • R Rob Grainger

              I feel for you, I really do. The one redeeming factor where I am is that I'm in the position of determining the new architecture, so a lot of detritus is firmly being shown the door. PS. I knew some company must have been using one of the odd .NET COBOL variants. It could be worse, I had to port some RPG to C years ago, and there is indeed an RPG .NET compiler. Look at the (Wikipedia[^] to see how bad things could be.

              "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #7

              Thanks. It's encouraging to know there are people in the position of being able to kill code silliness and then have the sense to do it. As for RPG.NET, yuck. I think I'll avoid it as much as I do netCobol, a subject you realy don't want me to get started on.

              Comments from work:

              • "Why can't you just do it like everybody else?"
              • "Well, we haven't had any complaints yet."
              • "I just want to get it into production."
              • "It only matters if it’s important to someone who matters."
              1 Reply Last reply
              0
              • R Rob Grainger

                Yet another delight from the VB6 rewrite...

                ' Read a setting from XXXX.ini
                Function GetINI(heading As String, setting As String, iniPath As String)
                Dim temp As String * 120
                Dim ret As Long

                If iniPath = "Default" Then
                    iniPath = gl\_DatabaseDir & "\\XXXX.ini"
                End If
                
                ret = GetPrivateProfileString(heading, setting, iniPath, temp, Len(temp), iniPath)
                
                If ret = 0 Then
                    Beep            ' Really ?
                Else
                    GetINI = Trim(temp)
                End If
                

                End Function

                I think this is like pre-watershed television, where expletives are covered by a beep. It's also worth considering that none of our PC's have a speaker ;-)

                "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.

                A Offline
                A Offline
                AspDotNetDev
                wrote on last edited by
                #8

                :laugh: Perhaps they had to run lengthy jobs while they slept, and had it beep to wake them up in case anything went wrong?

                Thou mewling ill-breeding pignut!

                P R L 3 Replies Last reply
                0
                • A AspDotNetDev

                  :laugh: Perhaps they had to run lengthy jobs while they slept, and had it beep to wake them up in case anything went wrong?

                  Thou mewling ill-breeding pignut!

                  P Offline
                  P Offline
                  PIEBALDconsult
                  wrote on last edited by
                  #9

                  I've done that.

                  1 Reply Last reply
                  0
                  • A AspDotNetDev

                    :laugh: Perhaps they had to run lengthy jobs while they slept, and had it beep to wake them up in case anything went wrong?

                    Thou mewling ill-breeding pignut!

                    R Offline
                    R Offline
                    Rob Grainger
                    wrote on last edited by
                    #10

                    I always thought that was what the keyboard auto-repeat beeps were for - to notify you that you've nodded off at your keyboard.

                    "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.

                    1 Reply Last reply
                    0
                    • R Rob Grainger

                      Yet another delight from the VB6 rewrite...

                      ' Read a setting from XXXX.ini
                      Function GetINI(heading As String, setting As String, iniPath As String)
                      Dim temp As String * 120
                      Dim ret As Long

                      If iniPath = "Default" Then
                          iniPath = gl\_DatabaseDir & "\\XXXX.ini"
                      End If
                      
                      ret = GetPrivateProfileString(heading, setting, iniPath, temp, Len(temp), iniPath)
                      
                      If ret = 0 Then
                          Beep            ' Really ?
                      Else
                          GetINI = Trim(temp)
                      End If
                      

                      End Function

                      I think this is like pre-watershed television, where expletives are covered by a beep. It's also worth considering that none of our PC's have a speaker ;-)

                      "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.

                      C Offline
                      C Offline
                      Corporal Agarn
                      wrote on last edited by
                      #11

                      Back in the day a beep was a good thing to have. So what did you replace it with when you rewrote the vb6 code? :-D

                      R 1 Reply Last reply
                      0
                      • A AspDotNetDev

                        :laugh: Perhaps they had to run lengthy jobs while they slept, and had it beep to wake them up in case anything went wrong?

                        Thou mewling ill-breeding pignut!

                        L Offline
                        L Offline
                        Lost User
                        wrote on last edited by
                        #12

                        A beep wouldn't wake you up unless you're a mosquito :-)

                        R A 2 Replies Last reply
                        0
                        • L Lost User

                          A beep wouldn't wake you up unless you're a mosquito :-)

                          R Offline
                          R Offline
                          Rob Grainger
                          wrote on last edited by
                          #13

                          Especially not here, where PC speakers are disconnected by company policy.

                          "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.

                          1 Reply Last reply
                          0
                          • C Corporal Agarn

                            Back in the day a beep was a good thing to have. So what did you replace it with when you rewrote the vb6 code? :-D

                            R Offline
                            R Offline
                            Rob Grainger
                            wrote on last edited by
                            #14

                            There are two parts: 1. We now use a .config file to store these settings. Reading these is done during app startup. If errors occur, either (a) a message is shown to the user if the settings is required, or (b) an entry is made in a log if the entry is non-critical. 2. The original coding loaded the settings within a VB Form. I've migrated this to app startup code, so the errors (a) raise an exception so they can be reported back to the user in a more managed way. The old app has the business logic entirely in VB forms, in the new version almost all business logic is in C# classes, the (WPF) forms have minimal code to set the data context for the form to an appropriate view model object.

                            "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.

                            1 Reply Last reply
                            0
                            • L Lost User

                              A beep wouldn't wake you up unless you're a mosquito :-)

                              A Offline
                              A Offline
                              AspDotNetDev
                              wrote on last edited by
                              #15

                              I'd wake up if an ant farted.

                              Thou mewling ill-breeding pignut!

                              I 1 Reply Last reply
                              0
                              • R Rob Grainger

                                Yet another delight from the VB6 rewrite...

                                ' Read a setting from XXXX.ini
                                Function GetINI(heading As String, setting As String, iniPath As String)
                                Dim temp As String * 120
                                Dim ret As Long

                                If iniPath = "Default" Then
                                    iniPath = gl\_DatabaseDir & "\\XXXX.ini"
                                End If
                                
                                ret = GetPrivateProfileString(heading, setting, iniPath, temp, Len(temp), iniPath)
                                
                                If ret = 0 Then
                                    Beep            ' Really ?
                                Else
                                    GetINI = Trim(temp)
                                End If
                                

                                End Function

                                I think this is like pre-watershed television, where expletives are covered by a beep. It's also worth considering that none of our PC's have a speaker ;-)

                                "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.

                                E Offline
                                E Offline
                                ExcellentOrg
                                wrote on last edited by
                                #16

                                Don't underestimate "beeps". I know one wizard of Oz who writes batch mode applications (each averages 30 mins of run time) and over years, he has evolved this beeps thingy into the state of art. Most days, his daily task comprises of starting the comps, setting batch jobs, set them running and then loiter around in office all day. He can be at other end of room and just by hearing meaningless (to me) sequence of beeps, he can tell which batch job which started finished. For those not directly involved with his work, it is a sight to see whenever his batch jobs fail and he gets desk-bound for hours. Guess where the beeps are coming from in those days? His mouth!! (And it ain't pre-watershed telly!!!)

                                1 Reply Last reply
                                0
                                • R Rob Grainger

                                  Yet another delight from the VB6 rewrite...

                                  ' Read a setting from XXXX.ini
                                  Function GetINI(heading As String, setting As String, iniPath As String)
                                  Dim temp As String * 120
                                  Dim ret As Long

                                  If iniPath = "Default" Then
                                      iniPath = gl\_DatabaseDir & "\\XXXX.ini"
                                  End If
                                  
                                  ret = GetPrivateProfileString(heading, setting, iniPath, temp, Len(temp), iniPath)
                                  
                                  If ret = 0 Then
                                      Beep            ' Really ?
                                  Else
                                      GetINI = Trim(temp)
                                  End If
                                  

                                  End Function

                                  I think this is like pre-watershed television, where expletives are covered by a beep. It's also worth considering that none of our PC's have a speaker ;-)

                                  "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.

                                  L Offline
                                  L Offline
                                  Lee Chetwynd
                                  wrote on last edited by
                                  #17

                                  Rob Grainger wrote:

                                  It's also worth considering that none of our PC's have a speaker ;-)

                                  Surprisingly, someone asked me for an internal speaker beep to be added to a VB6 application recently, for users without speakers. I had a look into it and, ignoring the fact that there would probably not be an internal speaker, a modern Windows O/S will divert the beep to the soundcard if there is one (even if its integrated) which needs speakers. So unless you have a machine with an internal speaker running Windows 98 or something, it just won’t do anything. For some reason that made me feel sad and I briefly missed not being able to make things beep in such a simple manner!

                                  1 Reply Last reply
                                  0
                                  • V vonb

                                    If this function is called many times from different threads and by some reason the XXXX.ini cannot be found, the result will be: beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep;beep; ctrl+Alt+Delete --> Task Manager --> End Process Imagine if it's a night over batch...

                                    The signature is in building process.. Please wait...

                                    L Offline
                                    L Offline
                                    Le Poete
                                    wrote on last edited by
                                    #18

                                    vonb wrote:

                                    If this function is called many times from different threads

                                    VB6, threads! That made my day :-)

                                    M 1 Reply Last reply
                                    0
                                    • R Rob Grainger

                                      Yet another delight from the VB6 rewrite...

                                      ' Read a setting from XXXX.ini
                                      Function GetINI(heading As String, setting As String, iniPath As String)
                                      Dim temp As String * 120
                                      Dim ret As Long

                                      If iniPath = "Default" Then
                                          iniPath = gl\_DatabaseDir & "\\XXXX.ini"
                                      End If
                                      
                                      ret = GetPrivateProfileString(heading, setting, iniPath, temp, Len(temp), iniPath)
                                      
                                      If ret = 0 Then
                                          Beep            ' Really ?
                                      Else
                                          GetINI = Trim(temp)
                                      End If
                                      

                                      End Function

                                      I think this is like pre-watershed television, where expletives are covered by a beep. It's also worth considering that none of our PC's have a speaker ;-)

                                      "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.

                                      D Offline
                                      D Offline
                                      donbsc
                                      wrote on last edited by
                                      #19

                                      There must be a lot of VB6 code in those darn smoke detectors!

                                      1 Reply Last reply
                                      0
                                      • R Rob Grainger

                                        Yet another delight from the VB6 rewrite...

                                        ' Read a setting from XXXX.ini
                                        Function GetINI(heading As String, setting As String, iniPath As String)
                                        Dim temp As String * 120
                                        Dim ret As Long

                                        If iniPath = "Default" Then
                                            iniPath = gl\_DatabaseDir & "\\XXXX.ini"
                                        End If
                                        
                                        ret = GetPrivateProfileString(heading, setting, iniPath, temp, Len(temp), iniPath)
                                        
                                        If ret = 0 Then
                                            Beep            ' Really ?
                                        Else
                                            GetINI = Trim(temp)
                                        End If
                                        

                                        End Function

                                        I think this is like pre-watershed television, where expletives are covered by a beep. It's also worth considering that none of our PC's have a speaker ;-)

                                        "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.

                                        R Offline
                                        R Offline
                                        RafagaX
                                        wrote on last edited by
                                        #20

                                        The developer who made this, should be forced to wear headphones and make his/her program fail constantly for 24 hours... ;P Seriously, there was a time when computers had an internal speaker, given that this is VB6, i'm not really surprised.

                                        CEO at: - Rafaga Systems - Para Facturas - Modern Components for the moment...

                                        R 1 Reply Last reply
                                        0
                                        • L Le Poete

                                          vonb wrote:

                                          If this function is called many times from different threads

                                          VB6, threads! That made my day :-)

                                          M Offline
                                          M Offline
                                          MSBassSinger
                                          wrote on last edited by
                                          #21

                                          Back in my VB6 days, I wrote multithreaded VB6 apps. The proper use of APIs lets VB6 do a whole lot more than most developers realize. That said, I like .NET much better, which is why I shifted my primary development language from VB6 to VB.NET and C#. It is a better framework for multithreaded apps and although VB6 was OO, .NET finishes the OOA that VB6 started (not saying there was no OO before VB4/6 - obviously - just in that line of succession of VB -> .NET).

                                          A B 2 Replies Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups