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
A

Aby Philip

@Aby Philip
About
Posts
7
Topics
6
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • BSTR returns invalid characters when multiple event sinks are used
    A Aby Philip

    Hi I have a component implementing a proprietary protocol (say, Protocol.dll)and does the communciation over serial port. I have defined ATL objects for each type of packet, and nearly all has a property called "description" which returns a BSTR. One ATL object encapsulates the serial communication. So I can set the baud rate, port number etc. A connection point event is defined corresponding to each packet that may arrive to the PC (from the device). Say ProtocolPkt1, ProtocolPkt2, ProtocolPkt3 etc. Now we typically use 2 serial ports. One that does proper protocol communciation and another that dumps trace staements. To take care of the trace statements I have one event defined (LogData) in the same event interface described above. I have an application (say Mainwindow.exe) that uses the above component, connects to both the ports and has separate event sinks to handle the 2 ports separately. The protocol data and the log data coming from the 2 ports are to be shown in separate windows. Whenever an event notifies that log data is received it is simply dumped in a window. Whenever any event notifying any of the protocol packets is received, the corresponding packet is created from the bytes received in the event, interpreted and displayed. Now onto the problem. When some protocol packets are received, the description property has to be called. When both the ports are connected the log data comes fine. But when the description property of say ProtocolPkt1 event is called, the BSTR returned is prefixed with some log string that came in the LogData event. Further the application displays a crash when it is closed. Some more observations. 1. This does not happen when the BSTR returned is very short. Typically only when the string returned is long and computed in some for loop, does this corruption occur. 2. This does not happen when I use the debug version of Protocol.dll. I hope I have made myself clear. If any information is required please let me know. Any pointers that can help me proceed would be greatly appreaciated Thanks aby

    ATL / WTL / STL debugging help c++ announcement

  • Passing variants in Fire_xxx methods
    A Aby Philip

    Hi, I am working on this ATL dll, which has one object that implements connection points. I added some methods in the event interface that take VARIANT as parameters, so that I may receive the variants in events when I use the same from VB. In IDL file it is like //////////////////////////////////////////////////// [id(3), helpstring("method SampleRecordPkt")] HRESULT SampleRecordPkt([in] VARIANT vBytes); //////////////////////////////////////////////////// Now, I am trying to fire this from my code as follows - (All the hard coded stuff I did for debug only.) //////////////////////////////////////////////////// BYTE bytes[] = {5, 123, 9, 0, 5, 0, 0, 191, 157}; COleSafeArray saBytes1; saBytes1.CreateOneDim(VT_UI1,sizeof(bytes)); for(long i = 0; i < sizeof(bytes);i++) { BYTE val = bytes[i]; saBytes1.PutElement(&i,&val); } file://fire off the appropriate event VARIANT var = saBytes1.Detach(); Fire_SampleRecordPkt(var); ///////////////////////////////////////////////////// However, inside "Fire_SampleRecordPkt(var)", the application crashes. The crash occurs at the line given below (wizard generated code, when "implement connection point" is chosen.) //////////////////////////////////////////////////// DISPPARAMS disp = { pvars, NULL, 1, 0 }; pDispatch->Invoke(0x3, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL); //////////////////////////////////////////////////// Can some body help me identify where I am wrong? Any help is appreciated. Thank you aby

    COM c++ debugging help question

  • Receiving binary data with MSCOMM32.ocx
    A Aby Philip

    I am trying to use MSCOMM32.ocx to receive binary data. MSDN provides two sample code for text data. (Q194922- INFO:Receiving Data using teh MSComm Control's OnComm Event) (for Send / Receive each). I used them as the basis and then did the following changes - - changed input mode to binary in both - To send binary data passed a Variant containing an array of bytes - On the receive side inspects the "Input" property. //////////////////////////////////////////////////// Dim data As String For i = 0 To MSComm1.InputLen - 1 data = data + "0x" + CByte(MSComm1.Input(i)) + " " Next i //////////////////////////////////////////////////// However on the receive side i am facing the following problems - - I am not sure how to get the number of bytes received. InputLen and InBufferCount gives 0 - Input is empty. - InBuff gives some 3 junk characters when i had passed (10,11,12,13,14) as bytes. Can some body help out on how to properly receive binary data? Any help is very much appreciated. thank you aby

    Visual Basic data-structures help tutorial question

  • Examining bytes returned from an ATL component
    A Aby Philip

    Hi, I am kind of a newbie in VB. The following is the problem description. I have an ATL component which has the following interface method. HRESULT GetBytes([out,retval] VARIANT* pvByteArray); As the name suggest the variant contains a byte array only. Now, I am trying to use this from VB, so that I may be able to examine the bytes returned. I have tried the folowing VB code - ///////////////////////////// Dim pkt As New SPGet Dim bytes As Variant Set bytes = pkt.GetBytes ///////////////////////////// But I get a Type Mismatch error. Can somebody show me how I may do this. Thank you Aby

    Visual Basic help c++ data-structures

  • Using VC++ DLL from VB
    A Aby Philip

    Hi, i need to export some classes in DLL created in VC++, which is fine. I understand how to use exported functions in VC++ dll from VB, but how is it (if) possible to use exported classes from VB? I could not find any articles in MSDN / web regarding this. I would greatly appreaciate if somebody can direct me, where to get more information on this. many thanks Aby Philip

    C / C++ / MFC c++ tutorial question

  • GetLastError returns invalid number
    A Aby Philip

    Thanks. I did not get any output in the Error Lookup with Embedded VC++ but did get when i used the one with VC++. Thanks again.

    Mobile help c++ hardware tutorial

  • GetLastError returns invalid number
    A Aby Philip

    My code fails on "HttpSendRequest". But GetLastError returns like "-2146893051" and I am not sure how to proceed. Details - Developed on Embedded VC++ WinCE 4.2. (Pocket PC 2003) I am mainly stumped by the GetLastError() return value. Any idea how I can get a proper error code. Note: we are actually trying HTTPS here.. Any help is very much appreciated. thank you aby

    Mobile help c++ hardware tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups