tags:

views:

178

answers:

2

We are developing a software that will automate many crucial activities in Photoshop.

This application is targeted for newbies.

In this application I want to embed Photoshop's window in my applications window. Currently Photoshop runs separately in its own window.

How can I get it to run in a particular location in given space in my application window?

+3  A: 

I don't know of any API to let you embed Photoshop into another application, and I don't think that API exists. However, why can't you accomplish what you want using ActionScript or a native plug-in inside Photoshop? This is accomplishing almost the same thing, just from a different direction.

Kristopher Ives
Yogi Yang 007
+5  A: 

How about this: find Photoshop's window handle using FindWindow, and after that use SetParent to embed it into your form/panel. You might also need to maximize and remove borders from Photoshop's window, see Windows API for more details on how to do this.

Frantic
Yeah, good luck with that :)
Kristopher Ives
Have already tried that but works only after Photoshop has loaded itself completely.So what happens is that when our software starts Photoshop its windows gets created outsize our software and then all of a sudden it vanishes from there and appears in our software. This is not a desirable effect.We want that the software should get started in our software directly just like MS Office apps.
Yogi Yang 007
Ok, you can try adding SW_HIDE parameter (I suppose you use ShellExecute or something similar) to make Photoshop's window invisible, then wait until it finishes initialization and make it visible using ShowWindow API function.
Frantic
Have tried that already but it is hassle to try and first locate Photoshop's executable and then execute. Instead we use a simpler approach which is guaranteed to work "Set objApp = CreateObject("Photoshop.Application")". This approach is easier and works without failing on all PCs that we have tried our software on!
Yogi Yang 007
Why finding Photoshop's executable is hard? You like COM way (I'm talking about CreateObject) of starting Photoshop, but have you ever thought about how Windows know about "Photoshop.Application"? I'll give you a hint - see HKEY_CLASSES_ROOT\Photoshop.Application\CLSID (using regedit), there is GUID of Photoshop's automation object, now navigate to HKEY_CLASSES_ROOT\CLSID\{*HERE YOUR GUID*}\LocalServer32 and see executable path. I don't think it's too hard, do you?
Frantic