5 Replies - 179 Views - Last Post: 06 February 2012 - 08:57 AM Rate Topic: -----

Topic Sponsor:

#1 WolvesWorld  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 04-February 12

Run external Application Problem .

Posted 04 February 2012 - 12:50 AM

It is really strange and I want to solve it :
I have 2 application built by C# ,
Scanner :
Is for scanning documents using special Dll Files built by c language .
The Second application built by C# also :
Runner Application :
is to run the Scanner application .

The Strange issue is :
IF I luanch the scanner app from the runner app an error will be generated because it doesn't find the Dll files .
So I try to copy and paste the dll files from Scanner/bin/Debug to runner/bin/debug
so the scanner runs correctly without any problems.

So I notice that the problem is Dll registration or dll link .

I tried to register the dll it fails , I tried to copy the dll to windows/system32 also it doesnot work.

I think the issue will be solved if I link the dll files while importing it>
 [DllImport("ScanDll.dll")]
        public static extern int IO_GetIDImage_File(int lImageType, int lCardType, int lCompressRet, string szFileOutPut);


Why if I start the scanner app from the runner app it search for the dll file inside runner/bin/debug not in scanner/bin/debug ????

Please need your expert to help me in that issue...

Is This A Good Question/Topic? 0
  • +

Replies To: Run external Application Problem .

#2 RexGrammer  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 152
  • View blog
  • Posts: 664
  • Joined: 27-October 11

Re: Run external Application Problem .

Posted 04 February 2012 - 03:39 AM

It's the default data directory for .NET executables. If you make a ASP.NET site you will see that the default data directory would be the App_Data folder.

NOTE: The default data directory is not the same for release and debug versions of the same program. If you make an installation for the program and install it then the default data directory would be the installation dir.
Was This Post Helpful? 0
  • +
  • -

#3 WolvesWorld  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 04-February 12

Re: Run external Application Problem .

Posted 04 February 2012 - 05:37 AM

View PostRexGrammer, on 04 February 2012 - 03:39 AM, said:

It's the default data directory for .NET executables. If you make a ASP.NET site you will see that the default data directory would be the App_Data folder.

NOTE: The default data directory is not the same for release and debug versions of the same program. If you make an installation for the program and install it then the default data directory would be the installation dir.

Thanks for your help. but that doesn't Answer my question ....
Was This Post Helpful? 0
  • +
  • -

#4 tlhIn`toq  Icon User is online

  • WillMyCodeWork = !FailedWhenYouTriedIt;
  • member icon

Reputation: 3290
  • View blog
  • Posts: 6,898
  • Joined: 02-June 10

Re: Run external Application Problem .

Posted 04 February 2012 - 06:31 AM

Yeah, actually it DOES answer the question.

The Parent app is Runner - therfore its that programs default folder being used.

Apparantly you aren't familiar with how applications look for DLL's.

First they look in their own directory.
Then they look in the system folder.

If you put the dlls in the Sytem32 or SysWOW64 directory as appropriate for your OS then they are available to ALL applications and your scanner should work fine.

When you build a proper installer/MSI for your apps just remember to copy those DLLs to the system folder.
Was This Post Helpful? 0
  • +
  • -

#5 WolvesWorld  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 04-February 12

Re: Run external Application Problem .

Posted 05 February 2012 - 02:08 AM

View PosttlhIn`toq, on 04 February 2012 - 06:31 AM, said:

Yeah, actually it DOES answer the question.

The Parent app is Runner - therfore its that programs default folder being used.

Apparantly you aren't familiar with how applications look for DLL's.

First they look in their own directory.
Then they look in the system folder.

If you put the dlls in the Sytem32 or SysWOW64 directory as appropriate for your OS then they are available to ALL applications and your scanner should work fine.

When you build a proper installer/MSI for your apps just remember to copy those DLLs to the system folder.

after my double checking < i found that the there is data.dat file must be in the parent folder ( runner folder ) .

Only On windows Xp it. fine is working fine without any copying or pasting this .dat file the scanner application working fine. but on other operating systems it will not work only if I paste the .dat file in the runner folder.

This solution is fine in case I am using the .net for executable folder , but in case of oracle forms where I should paste my .dat file ???

regards...
Was This Post Helpful? 0
  • +
  • -

#6 Curtis Rutland  Icon User is offline

  • (╯°□°)╯︵ (~ .o.)~
  • member icon

Reputation: 3134
  • View blog
  • Posts: 5,402
  • Joined: 08-June 10

Re: Run external Application Problem .

Posted 06 February 2012 - 08:57 AM

Quote

but in case of oracle forms where I should paste my .dat file ???


I suggest you try somewhere with Oracle experts...we're much more focused on .NET here.

Also, for the record, assembly resolution is much more intricate than described here. This SO thread explains a lot, and links to an online book that really goes into depth, should anyone care how assemblies (DLLs, in this case) are resolved and loaded.

http://stackoverflow...aded-by-the-clr
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1