Help with Macintosh programming

macintosh programming, mac programming, mac os programming, mac os x programming, mac programming language, mac programing

Archive for September, 2011

Need AppleEvent Guru help!

Please help!
How to convert the following to AppleEvent:
Process("Finder").SendAE "fndr,fupd,’—-’:obj {form:indx,
want:type(file), seld:abso(Ç616C6C20È), from:obj {form:name,
want:type(cfol), seld:"MacOs92:Test2:Reports:", from:’null’()}}"

This code is Apple Script
tell application "Finder"
      update every file in folder "MacOs92:Test2:Reports:"
end tell

Is there anything from AppleEvent to convert the list to AEDesc? or do
i have to parse and build the list myself?
char szDesc= ":obj {form:indx, want:type(file), seld:abso(Ç616C6C20È),
from:obj {form:name, want:type(cfol), seld:"MacOs92:Test2:Reports:",
from:’null’()}}"
//Ç616C6C20È is ‘all ‘
AECreateAppleEvent (‘fndr’, ‘fupd’,….., &aeEvent)
AECoercePtr( ????, szDesc, strlen(szDesc), ????, &Result);
AEPutParamDesc(&aeEvent,keyDirectObject, &Result);
AESend(&aeEvent, …)
For the AECoercePtr:
Does anyone know what AEDesc to use in the ‘from’ and ‘to’ parameter?
Any help would be appreciated.

p.s. I can’t use AEBuildAppleEvent since I’m using MFC 4.0

.
posted by admin in Uncategorized and have Comment (1)

Problem of length after converting from Quicktime to Mpeg2

Hi!

I’ve converted an Quicktime Movie (8,6 GB   40 minutes) to mpeg2 using
the built in encoder of the Quicktime Player.
The problem is that audio stream has corect length but the video
stream is 7 minutes shorter – which means that it is nut CUT at the
end – it is (as I think) played faster.

Any clues?

BeAsT

posted by admin in Uncategorized and have Comment (1)

CoreFoundation function help

hi, all

  i am a beginner of developing on MacOS X, please tell me where i can
find the help information about CoreFoundation function. such as
CFRunLoopGetCurrent, CFRunLoopAddSource, CFDictionarySetValue….
  i have tried to search them in the Developer Help Center. but i find
less information about them.

Thanks for your time

Henrry

posted by admin in Uncategorized and have Comments (3)

Cocoa or Carbon?

Hi, I am sure this has been discussed before, and probably there is no clear
cut answer to this, but I was just wondering…

This is my situation.  I used to program for Mac OS 8/9 using
C++/PowerPlant.  I’ve been away from  Mac programming for about two years,
but now I am thinking of coming back to Mac to program for OS X.

I now have to decide between Cocoa and Carbon.  It seems that if I choose
Carbon, I can use C++ and a lot of toolbox calls I know, but requires more
coding than Cocoa.  On the other hand, choosing Cocoa would mean I have to
learn a new language and end up with a non-portable code (What other
platform could you program in Obj-C?).

So what I want to ask is…
1. What is the current trend in Mac industry?  Which path are more OS X
developers taking?  Cocoa or Carbon?  Will most of the future applications
written in Cocoa?
2. Will Carbon be supported by Apple for a long time?

I just want to know whether it’s worth investing my time in learning Obj-C.

Thanks.

posted by admin in Uncategorized and have Comments (6)

CGPostMouseEvent side-effects?

Hi Folks,

We have a device that we’re using to manipulate the mouse via the
CGPostMouseEvent function.  Our device is connected via USB and we’re
making use of ReadPipeAsync to read in the data coming from it.  After
we collect our data from the board we call CGPostMouseEvent to post
the proper event.  The data is sent periodically, about every 8ms, and
so ReadPipeAsync should execute the completion callback at the same
rate.

Anyway, I’ve noticed that due to CGPostMouseEvent, we are unable to
read the data at the preferred rate of 8ms.  Instead, the read rate
jumps around from 8ms all the way up to 20ms, or even higher in rare
instances.  Once I remove the CGPostMouseEvent call, however, the rate
of 8ms between reads is maintained.

Our routine to read the data in from the USB port and post the mouse
event is less than 1ms, so that isn’t what’s keeping the app from
keeping pace.  Also, if I replace the CGPostMouseEvent call with just
a delay of the same time (the function takes about 350us on my
system), it doesn’t affect the read rate as the normal function call
would.

Obviously, all of this leads me to believe that CGPostMouseEvent is
interfering with the ReadPipeAsync call.  Is this what’s supposed to
happen?  And is there any way around it?  I’m very new to OS X
programming, but I do know now that both functions make use of
CFRunLoop, so I’m thinking that somehow CGPostMouseEvent has some
side-effects that block ReadPipeAsync from executing on time.

posted by admin in Uncategorized and have No Comments

QuickTime Still Image antialiasing

I am using the TIFF image converter in QuickTime. Specifically, I am
opening a TIFF file and then calling "GraphicsImportGetAsPicture" to get
a PicHandle.

Under QT5, this PicHandle contained an image that had been fully
anti-aliased. When I used "DrawPicture" with this PicHandle, the image
looked nice on screen, and for some reason, still came out very crisp if
I was printing (I’m not sure why).

Under QT6, the PicHandle looks the same on screen, but it is now fully
anti-aliased when I print it as well – resulting in fuzzy looking images.

My question is this: how do I get QT to *not* perform anti-aliasing when
I use "GraphicsImportGetAsPicture" on a TIFF file?

I’ve searched all the docs I can find and I only see references to
antialiasing at it pertains to text tracks.

Help is greatly appreciated.

Cliff

posted by admin in Uncategorized and have Comment (1)

Carbon help

Newbie help:

Can anyone post or direct me to an example where I can create a window (without
the use of a .nib or WIND resource) and then DrawString to that same window.

I tried hacking some lines of code from several sources (KJ Bricknell’s Carbon
book, and the tutorials on Mac OS X). I can only seem to get the window to pop
up, but I am unable to make any changes.

— thanks
vee (very new to mac programming (Carbon)

posted by admin in Uncategorized and have Comment (1)

Which Charset Best for Web pages Exported from Mac?

Is there a Unicode set that incorporates all the Mac characters?

According to WC3, Central European Mac (x-mac-ce) is the most
compatible Mac charset (sort of odd). See:
http://www.w3.org/International/O-charset-list.html

I can’t find anything Mac-like supported in Opera.

posted by admin in Uncategorized and have Comments (24)

developing composite device driver on MacOS X

hi, all

  I am now going to develop a composite device driver on MacOS X, it
is a multimedia keyboard with build-in 2 programmable buttons pointing
device, where can I get more useful information on it, or some sample
code for such device.

thanks for your time

henrry

posted by admin in Uncategorized and have Comments (2)

[cocoa] Programmatically create a GUI

Assuming it’s even possible to built a GUI using nothing but code (no
InterfaceBuilder at all) in Cocoa, can anyone here point me to any
documentation/pointers/etc., on how to accomplish this?

Basically, the program I’m trying to write involves dynamically adding
tabs to a tab view.  It’s a chat program, and each tab would represent a
different person, chat root, etc., you’re currently chatting with.  The
actual controls in the tab would differ slightly depending on who/what
you’re talking to.

If there is a way to accomplish this with InterfaceBuilder, I’d
certainly consider it if suggested. :) However, I’m also curious if
there is a way I can build up a GUI at run-time because I can see some
situations where a static, pre-defined IB GUI may not be appropriate.
Also, if Cocoa has anything along the lines of the Java layout managers
(GridBagLayout, etc.), that would be very, very convenient.

Thanks!

——————– http://www.techhouse.org/lou ———————-
"Dragonmaster Lou"    | "Searching for a distant star, heading off to  
lou at techhouse org  | Iscandar, leaving all we love behind, who knows
Tech House Alum       | what dangers we’ll find…"                    
———————————————————————–

posted by admin in Uncategorized and have Comments (10)