Solved

PicHandle cast as unsigned char handle

Posted on 1998-06-27
4
307 Views
Last Modified: 2013-12-26
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
Comment
Question by:sowen
  • 2
4 Comments
 
LVL 1

Accepted Solution

by:
agolan earned 100 total points
Comment Utility
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
 

Expert Comment

by:paulsat
Comment Utility
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
 

Author Comment

by:sowen
Comment Utility
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
 

Expert Comment

by:paulsat
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
I made this because I wanted to get e-mail with a attached csv file so I'd would be able to import user input into a MS Excel template, but I also wanted to register/save all inputs from each day in a file on the server. 1st - It creates a temp C…
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now