Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 326
  • Last Modified:

PicHandle cast as unsigned char handle

I have to cast a PicHandle as an unsigned char handle to work with a callback function for an application. I am writing a plugin for the application. I don't think I'm working with the pointers correctly. How would one accomplish this task? I have to copy the Picture record to the unsigned char handle. Help, please.

Thanks.
0
sowen
Asked:
sowen
  • 2
1 Solution
 
agolanCommented:
It depends if you need also to copy the data (case 2) or just
pas the handle (case 1), your problem might be that the handle
is released before your callback function is active.

case1()
{
      PicHandle mypict;
      unsigned char **mypictaschar;
      mypictaschar = (unsigned char **) mypict ;
}

case2()
{
      PicHandle mypict;
      char **mypictaschar;
      mypictaschar = (unsigned char **)
                  HandToHand( (Handle) mypict);
      /* remember to release mypictaschar when done */                   
}

Do you undertstand clearly what a handle is ?
0
 
paulsatCommented:
More details please, you start with a pic handle you want to pass to a code module (plugin) that is prototyped to accept an unsigned char handle, right?  Is the problem in the plugin, is that the code you are writing that does not work?  If so, you need to get the handle size in the plugin, then create the unsigned char handle big enough to hold it, then BlockDataMove the passed in handle to the newly created handle.  However it is not clear from the few words in you question exactly what you are doing. Like 'agolan', I would like to know if you fully understand what a Macintosh handle is and how you use them?  How about showing us the specific code you got that don't work?  What's the callback typedef and what routine are you calling that needs that callback.  I don't see what a plugin has to do with it.  If you are calling a Macintosh API that accepts a callback proc, what's that got to do with a plugin, or is all your code in a plugin you are writing?  In any event, what is the api call that takes the callback proc ptr (or UPP) and show us the callback proc code you have and the line of code that passes that supplies the handle to the callback.
0
 
sowenAuthor Commented:
It is a FileMaker Pro Plugin. I have a feeling that FileMaker Pro refuses to coerce the data the plugin returns, which is a handle to and unsigned char, back to a picHandle. The calculation in FileMaker that activates the plugin attempts to set a container field, which should accept a Picture Handle (works find from the Clipboard). I get a bunch of garbage, though, that looks like what a picHandle might look like as text. The problem is I don't know for sure. I finally had the plugin put the picHandle on the clipboard. It works fine that way. And yes, I fully understand what a Macintosh Handle is. I think FileMaker plugins will only work for text or numeric (converted to text) calculations.

If you have any suggestions, though, about the the unsigned char handle in FileMaker, I'd love to work it out without using the clipboard.

Thanks
0
 
paulsatCommented:
Maybe it wants a pointer to a pic handle or a handle to pic handle, dunno.  Don't think I can help without more details about the plugin calling conventions and what in Filemaker gets the data from the plugin you wrote.   What is the prototype for the routine in your plugin look like and what parameter in it is supposed to contain the pic handle or some kind of reference to it?
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now