Link to home
Start Free TrialLog in
Avatar of kGenius
kGeniusFlag for Belgium

asked on

CreateObject alike for WIA

Hi,

This is a code-snippet from a VB.NET print module

Dim dialog As Object = CreateObject("WIA.CommonDialog")
dialog.ShowPhotoPrintingWizard(vector)

I've tried this in C# as follows:
Type t = Type.GetTypeFromProgID("WIA.CommonDialog");
object dialog=Activator.CreateInstance(t);

But then I cannot access dialog.ShowPhotoPrintingWizard();

I've referenced the waauit.dll now and add using WIA at top.
But still I want to get the other way(without referencing WIA).

kGenius
Avatar of Brian Mulder
Brian Mulder
Flag of Netherlands image

Hi kGenius,
----------

you could try
object dialog = CreateObject("WIA.CommonDialog");
dialog.ShowPhotoPrintingWizard(vector);

----------
bruintje
share what you know, learn what you don't
ASKER CERTIFIED SOLUTION
Avatar of Brian Mulder
Brian Mulder
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Bob Learned
Is it possible to add a reference, and use early-binding, instead of the late-bound Activator call?

Bob
Avatar of kGenius

ASKER

It is possible in my app. I've done it that way (add the reference)
But I was so curious how C# could handle this one.

Thanks bruintje for sharing...
kGenius
Avatar of olecb
olecb

tmp is like this..: "c:/users/me/pictures/abc.jpg"...

What the compiler says is "argument can not be converted from string to "ref object"
If've refered to http://msdn.microsoft.com/en-us/library/ms630492(VS.85).aspx
where is said that also could used a path to afile....
WIA.CommonDialog myprintDialog = new WIA.CommonDialogClass();
String tmp = theBasisPfad + currentDateiname;
theDruckListe.SetFromString(tmp,false,true);
myprintDialog.ShowPhotoPrintingWizard( tmp );

Open in new window