Results 1 to 8 of 8

Thread: GlobalAddAtom [RESOLVED}

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jul 2001
    Location
    Tucson, AZ
    Posts
    2,166

    GlobalAddAtom [RESOLVED}

    Read some old posts on above subject but no examples given.


    I need to pass a string between a VB program and a C++ program and atoms seem the way to go but never used them.
    Reading SDK GlobalAddAtom takes a lpPointer to a null terminated string.

    I just tried passing the string of the VB side but the Atom integer return code was negative (-15468).

    An small example on adding the atom on the VB side and retrieving the Atom on the C++ side would be greatly appreciated.

    Thanks
    David
    Last edited by dw85745; Apr 16th, 2003 at 10:25 PM.

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    Are we talking a console C++ app, or a windows app?
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926

    Re: GlobalAddAtom

    Originally posted by dw85745
    I just tried passing the string of the VB side but the Atom integer return code was negative (-15468).
    What is the problem with a negative return code?
    If the return code is 0, the function failed, otherwise the function succeeded. The return code can get negative because VB doesn't support unsigned integers.
    Frans

  4. #4

    Thread Starter
    PowerPoster
    Join Date
    Jul 2001
    Location
    Tucson, AZ
    Posts
    2,166
    Thanks for responding.

    crptcblade:
    --------
    Are we talking a console C++ app, or a windows app?
    ---------
    A MFC windows app.

    ************************

    Frans C:
    -------
    What is the problem with a negative return code?
    -------
    Nothing. For some reason I was expecting a postive integer -- don't recall ever seeing an API return a negative integer.


    **************

    In order for the C++ program to find the atom, I created a unique name in the first position of a comma delimited string.

    Do you know if this will work for GlobalFindAtom or is the entire string use to ID it?

    Otherwise -- I asssume if I use GlobalGetAtomName then I need to pass the VB atom return code to the C++ program so it can find the atom?

    If this is the case why use Atoms?

  5. #5
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    I'm not really familiar with MFC, but I'll give trying to explain it my best shot.

    You add the atom with the VB app, then send the MFC app a custom message, like WM_USER + 107 or something. Along with the message, you pass the atom id as the wParam or lParam, and then receive it in the MFC app. Now you have the atom id to look up the atom name in the table.

    Does that make sense?
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  6. #6

    Thread Starter
    PowerPoster
    Join Date
    Jul 2001
    Location
    Tucson, AZ
    Posts
    2,166
    Appreciate the feedback.

    Yup! Understand Concept. Same as passing most anything else.
    Don't see what advantages there are to using Atoms over other methods of XProcess?

    This is why I'm looking for a simple example but to date no luck from google searches .

    One of my concerns is whether the atom number will remain the same when I get around to passing and the C++ gets around to reading it. As with handles I'm sure it can change.

  7. #7
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    The atom id should remain the same until it is removed from the atom table. That's the beauty of working with a global table.

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  8. #8

    Thread Starter
    PowerPoster
    Join Date
    Jul 2001
    Location
    Tucson, AZ
    Posts
    2,166
    Thanks for the input crptcblade

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