MFC help : code error 0000007B
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: MFC help : code error 0000007B

  1. #1
    Join Date
    Jan 2012
    Posts
    13

    MFC help : code error 0000007B

    hi,
    i'm developing GUI using MFC in vs2008. i have developed code and it builds fine but when i debug my code, it gives system error 0000007B. part of the code that gives this error is given below + variable initialization.


    int COMportNum= 3;
    portstream_fd COMstream;
    portstream_fd pstream;
    char COMportPrefix[10] = "COM";
    char COMportName[256];

    sprintf(COMportName, "%s%d", COMportPrefix, COMportNum); // initialize serial port COM3

    strng = CString(COMportName);
    strng.Format(_T("%0.9s"), strng);
    SetDlgItemText(IDC_STAT, strng);

    set_baud_rate(BaudRate);
    COMstream = open_host_port(COMportName); //opens serial port COM3

    if ( COMstream == PORT_NOT_OPENED ) //conditional check if COM3 is opened
    {
    stw.Format(_T("%08X"), GetLastError()); //generates error if any
    SetDlgItemText(IDC_PTUPORT, stw);
    }
    else
    SetDlgItemText(IDC_PTUPORT, (LPCTSTR) L"Ok");


    can anyone please help me with this error.
    Regards
    Jawad

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,011

    Re: MFC help : code error 0000007B

    Quote Originally Posted by jawadali477 View Post
    hi,
    i'm developing GUI using MFC in vs2008. i have developed code and it builds fine but when i debug my code, it gives system error 0000007B.
    Look at the MSDN article http://msdn.microsoft.com/en-us/libr...=prot.10).aspx and search it for this error code.

    Quote Originally Posted by jawadali477 View Post
    part of the code that gives this error is given below + variable initialization.


    Code:
    int COMportNum= 3;
    portstream_fd COMstream;
    portstream_fd pstream;
    char COMportPrefix[10] = "COM";
    char COMportName[256];
     
    sprintf(COMportName, "%s%d", COMportPrefix, COMportNum); // initialize serial port COM3
     
    strng = CString(COMportName);
    strng.Format(_T("%0.9s"), strng);
    What is string? Is it a CString?
    Then have a look at the CStringT::Format article, Remark section!
    Victor Nijegorodov

  3. #3
    Join Date
    Jan 2012
    Posts
    13

    Re: MFC help : code error 0000007B

    yes strng is CString. sorry for not mentioning it here. but it doesn't effect the code since it is used for displaying name of serial port.

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,011

    Re: MFC help : code error 0000007B

    Quote Originally Posted by jawadali477 View Post
    yes strng is CString. sorry for not mentioning it here. but it doesn't effect the code since it is used for displaying name of serial port.
    It does affect the whole application used such a code.

    Besides, the format of the serial port "COMx" only works for port numbers from 1 to 9. See HOWTO: Specify Serial Ports Larger than COM9

    PS: BTW, have you found out the error reason, or at least its description?
    Victor Nijegorodov

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center