CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10
  1. #1
    Join Date
    Feb 2004
    Posts
    5

    Modem Configuration

    I need some help in using the struktures MODEMSETTINGS and MODEMDEVCAPS, for switching off the flow-controll... Is there anyone, who has experiences with this?

  2. #2
    Join Date
    Nov 2003
    Posts
    1,902

  3. #3
    Join Date
    Sep 2002
    Location
    Maryland - Fear The Turtle!
    Posts
    7,537

  4. #4
    Join Date
    Feb 2004
    Posts
    5
    i have read already a lot in the msdn sites. I wanted to use the SetComConfig - Function. This Function needs a pointer to a COMMCONFIG-stucture. In this sturucture there is a item that is called wcProviderData[1] and of type WCHAR. And in the description is written, that "If the provider subtype is PST_MODEM, the wcProviderData member contains a MODEMSETTINGS structure." But how can a WCHAR contain a MODEMSETTINGS structure... ?

  5. #5
    Join Date
    Sep 2002
    Location
    Maryland - Fear The Turtle!
    Posts
    7,537
    Originally posted by Nioc
    i have read already a lot in the msdn sites. I wanted to use the SetComConfig - Function. This Function needs a pointer to a COMMCONFIG-stucture. In this sturucture there is a item that is called wcProviderData[1] and of type WCHAR. And in the description is written, that "If the provider subtype is PST_MODEM, the wcProviderData member contains a MODEMSETTINGS structure." But how can a WCHAR contain a MODEMSETTINGS structure... ?
    it's just a memory location. Farily standard way of exposing variable struct definintions, or variable records. That is why you have a offset member and a size member, you can just cast the address location into the type of provider defined struct/specific data, or memcpy it. And use pointer arithmetic to continue moving down each record via the offset.

  6. #6
    Join Date
    Feb 2004
    Posts
    5
    Is it possible, that you send me some example-Code, it is still not clear to me, how i can read and than set the modem-properties...
    That would be very nice

  7. #7
    Join Date
    Jan 2004
    Location
    Earth
    Posts
    567
    Hi,

    If your modem has an AT command set you can use the AT commands to set the registers on the modem. On my modem to disable flow control I can send AT&K0. This command will write 0 to register S39. You could also write directly to the register by using ATS39=0. The commands I have listed are for the Rockwell chipset and may differ for your modem (which may not even have an AT command set). See if your modem has an AT command set list.

    TDM

  8. #8
    Join Date
    Feb 2004
    Posts
    5
    The problem is, that the modem i use is an RAS serial Cable. So i have to switch of flow-controll for "modem" the in the Windows-Configuration.

  9. #9
    Join Date
    Sep 2002
    Location
    Maryland - Fear The Turtle!
    Posts
    7,537
    Originally posted by Nioc
    The problem is, that the modem i use is an RAS serial Cable. So i have to switch of flow-controll for "modem" the in the Windows-Configuration.
    Been one of those dayz Back to your question, if you haven't found the answer already. But would you not just call GetCommConfig(...) passing a large enough buffer as indicated by the return value of the third parameter (I would just call it with size zero and call again after allocating what size is needed by the returned value).

    Then modify whatever you need to in that structure, and then call
    SetCommConfig(...)

  10. #10
    Join Date
    Feb 2004
    Posts
    5
    nice to hear of you i was just about giving up hope...

    i will try to explain a little bit more detailed. it's perhps a little difficult because i'm not that good in english, and i've my source not here. But i will try


    first i fetch a handle to the port, the modem is installed at with CreateFile(..) ;

    (or is this already wrong ?!? can i fatch a handle of the modem?)

    then i call
    GetCommConfig(..);

    now i have the COMMCONFIG-Structe filled with the parameters of the com-port

    Now i change the item
    dwProviderSubType = PST_MODEM ;

    now i'm not sure...
    must i change the item
    dwProviderOffset to the differenz of the adresses of the first item of the structure and wcProviderData

    and
    dwProviderSize = sizeof(MODEMSETTINGS);

    and now ...

    i just cant memcpy the MODEMSETTINGS-Sturctre behind the COMMCONFIG-Stucture...

    hope you understand my description
    thanks a lot,
    nioc

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured