Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • 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!

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

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I really enjoy your site. You have a lot of helpful and friendly experts who contribute so willingly. Thank you for past (and future) technical advice..."

Geography

Where in the world do Tek-Tips members come from?
adamstemper (Programmer)
28 Jul 11 15:45
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!
 

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!

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