Solved

PicHandle cast as unsigned char handle

Posted on 1998-06-27
4
321 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 1

Accepted Solution

by:
agolan earned 100 total points
ID: 1291469
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
ID: 1291470
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
ID: 1291471
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
ID: 1291472
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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Importing Special Characters in Dynamics GP Through Integration Manager 3 96
centeredAverage challenge 8 186
MaxSpan challenge 9 138
Use of condition with 'serial' in ansible 2 101
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 …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.

734 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