INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

ActiveX html control not calling code

ActiveX html control not calling code

(OP)
I have an ActiveX HTML Object as defined here:
<object id="HSMBTPrintX1" width="350" height="350"    classid="CLSID:68d05400-18a6-4b39-b3ff-a17d77c1eddf" codebase=".\HSMBTPrintX.ocx">

------------------------------------------------------------

And a button:
<input type="button" name="Print" value="Print" onclick="PassParameter()" />

------------------------------------------------------------

This button calls some javascript defined above the button and control:
<script language="javascript" type="text/javascript">     function PassParameter() {
    if (StringInput.value != " ") {
        alert('1 - ' + HSMBTPrintX1);
        HSMBTPrintX1.InputParameter = StringInput.value;
        alert('2 - ' + StringInput.value);
        var temp = HSMBTPrintX1.PrintLabel();
        alert('3 -' + temp);
    }
}
</script>

------------------------------------------------------------

My PrintLabel C++ code method, here:
char* CHSMBTPrintXCtrl::PrintLabel(void)
{
    return "temp";
    //AFX_MANAGE_STATE(AfxGetStaticModuleState());
 
    // TODO: Add your dispatch handler code here
    TCHAR g_szComPort[16];
    char szout[512];
    HANDLE hCom;
    TCHAR comPort[16];
    unsigned long bytesWritten;
    int counter;
    AFX_MANAGE_STATE(AfxGetStaticModuleState());
    if (!FindBluetoothPort(g_szComPort))
    return "minus two";
    hCom = CreateFile(comPort,GENERIC_READ|GENERIC_WRITE,0,0,OPEN_EXISTING,0,0);
    if (hCom == NULL)
    return "minus one";
    CStringA charstr(m_InputParameter);
    // Create text to send to printer
    strcpy(szout, "^XA\n");
    strcat(szout, "^PRC ^LH0,0 ^LL203 ^PW406 ^MD5 ^MFF,F ^MMT ^MNM ^CF0,20,12 ^XB\n");
    strcat(szout, "^FO20,05 ^AFN ^FV MASTER PACK ^FS\n");
    strcat(szout, "^XZ");
 
    // Write file to Bluetooth COM port
    if(WriteFile(hCom,szout,256,&bytesWritten,NULL)==0)
    {
        return "one";
    }
    return "two";
    FireLabelPrinted();
}

------------------------------------------------------------

And as you can see, (just for testing), as soon as the function is called it returns some text. I attempt to output this text in a javascript alert.

The issue is, the "temp" javascript variable outputs as "undefined"... so i'm assuming the PrintLabel function never even gets called.


For some background information (which may or may not help in a conclusion), i am using VS2008, creating a Visual C++ Smart Device project. The solution also has a Smart Device CAB Project added on. The entire solution is then built; I copy the .CAB, .INF, .OCX and .HTML files to a single folder on a handheld device running Windows CE.

Additionally, I am not very familiar with C++... nor ActiveX. Any help is appreciated!!

If i need to provide more information, just point me in a direction.

Thanks!
 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close