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. General Programming
  3. C / C++ / MFC
  4. need help in MFC

need help in MFC

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++comtutorial
18 Posts 6 Posters 0 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.
  • CPalliniC CPallini

    In a rather rough approach you may let the user write the full name of the serial port into an edit box (say myEditBox) and use that string as argument of open_host_port, that is as simple as (assuming a ANSI build):

    CString portname;
    myEditBox.GetWindowText(portname);
    COMstream = open_host_port(portname);

    Veni, vidi, vici.

    J Offline
    J Offline
    jawadali477
    wrote on last edited by
    #6

    but open_host_port () is defined as

    portstream_fd open_host_port(char *portname)

    CPalliniC 1 Reply Last reply
    0
    • J jawadali477

      but open_host_port () is defined as

      portstream_fd open_host_port(char *portname)

      CPalliniC Offline
      CPalliniC Offline
      CPallini
      wrote on last edited by
      #7

      Well, that is a open_host_port fault. Why - the fresh Hell - the function needs a not-const string? However

      COMstream = open_host_port((LPSTR)(LPCSTR) testCStr);

      should do the trick. BTW I ask you once again (I'm curious): what library are you using?

      Veni, vidi, vici.

      In testa che avete, signor di Ceprano?

      J 1 Reply Last reply
      0
      • L Lost User

        You would do exactly the same in the MFC program. You could make your comport handler into a class or add it to one of the existing classes. You then activate it by a menu selector or toolbar button.

        Programming is work, it isn't finger painting. Luc Pattyn

        J Offline
        J Offline
        jeron1
        wrote on last edited by
        #8

        Compensated for the unwarranted univote.

        L 1 Reply Last reply
        0
        • L Lost User

          You would do exactly the same in the MFC program. You could make your comport handler into a class or add it to one of the existing classes. You then activate it by a menu selector or toolbar button.

          Programming is work, it isn't finger painting. Luc Pattyn

          A Offline
          A Offline
          Aescleal
          wrote on last edited by
          #9

          I wish bleedin' univoters would tell people WHY they do it. Mucking Fuppets. How the hell are we supposed to learn if they won't tell us what we're doing wrong...

          P L CPalliniC 3 Replies Last reply
          0
          • A Aescleal

            I wish bleedin' univoters would tell people WHY they do it. Mucking Fuppets. How the hell are we supposed to learn if they won't tell us what we're doing wrong...

            P Offline
            P Offline
            Pete OHanlon
            wrote on last edited by
            #10

            Univoters normally include the OP when someone doesn't actually write all their code for them. For some reason, CP forums seem to be seen as the source of free software where you post up a vague problem and miraculously someone will write all your code for you. For free.

            *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

            "Mind bleach! Send me mind bleach!" - Nagy Vilmos

            CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

            1 Reply Last reply
            0
            • J jeron1

              Compensated for the unwarranted univote.

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

              :thumbsup:

              Programming is work, it isn't finger painting. Luc Pattyn

              1 Reply Last reply
              0
              • A Aescleal

                I wish bleedin' univoters would tell people WHY they do it. Mucking Fuppets. How the hell are we supposed to learn if they won't tell us what we're doing wrong...

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

                Yes, but then they wouldn't be univoters. Quite frankly, I think I'm big enough and ugly enough to take it on the chin. :(( :(( :((

                Programming is work, it isn't finger painting. Luc Pattyn

                A 1 Reply Last reply
                0
                • L Lost User

                  Yes, but then they wouldn't be univoters. Quite frankly, I think I'm big enough and ugly enough to take it on the chin. :(( :(( :((

                  Programming is work, it isn't finger painting. Luc Pattyn

                  A Offline
                  A Offline
                  Aescleal
                  wrote on last edited by
                  #13

                  I'm sure you are, still bloody irritating though...

                  P 1 Reply Last reply
                  0
                  • A Aescleal

                    I'm sure you are, still bloody irritating though...

                    P Offline
                    P Offline
                    Pete OHanlon
                    wrote on last edited by
                    #14

                    You think Richard is irritating? ;P

                    *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

                    "Mind bleach! Send me mind bleach!" - Nagy Vilmos

                    CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

                    A 1 Reply Last reply
                    0
                    • CPalliniC CPallini

                      Well, that is a open_host_port fault. Why - the fresh Hell - the function needs a not-const string? However

                      COMstream = open_host_port((LPSTR)(LPCSTR) testCStr);

                      should do the trick. BTW I ask you once again (I'm curious): what library are you using?

                      Veni, vidi, vici.

                      J Offline
                      J Offline
                      jawadali477
                      wrote on last edited by
                      #15

                      thank you CPallini. that was really helpful.

                      CPalliniC 1 Reply Last reply
                      0
                      • J jawadali477

                        thank you CPallini. that was really helpful.

                        CPalliniC Offline
                        CPalliniC Offline
                        CPallini
                        wrote on last edited by
                        #16

                        You are welcome.

                        Veni, vidi, vici.

                        In testa che avete, signor di Ceprano?

                        1 Reply Last reply
                        0
                        • A Aescleal

                          I wish bleedin' univoters would tell people WHY they do it. Mucking Fuppets. How the hell are we supposed to learn if they won't tell us what we're doing wrong...

                          CPalliniC Offline
                          CPalliniC Offline
                          CPallini
                          wrote on last edited by
                          #17

                          Ok, take my 1. I can't tell you why I can't tell you why :-D

                          Veni, vidi, vici.

                          In testa che avete, signor di Ceprano?

                          1 Reply Last reply
                          0
                          • P Pete OHanlon

                            You think Richard is irritating? ;P

                            *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

                            "Mind bleach! Send me mind bleach!" - Nagy Vilmos

                            CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

                            A Offline
                            A Offline
                            Aescleal
                            wrote on last edited by
                            #18

                            Yep, but don't tell him! :-)

                            1 Reply 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