Can a Windows application interop with a WinBatch program?

Started by blint, September 24, 2021, 09:47:33 AM

Previous topic - Next topic

blint

I am trying to find a way to prevent a Windows .NET application from running if it detects that it is running on a Citrix virtual desktop. (Licensing issues, nothing against Citrix.) I was directed to WinBatch Terminal Extender wtsIsCitrixEnabled() as a possible solution to this problem but I'm completely unfamiliar with WinBatch. If I were to use WinBatch, could I produce a DLL with  functions that could be invoked by the .NET Windows Application, and could the WinBatch function return values to that Windows application? A simple integer or boolean would suffice. 

td

Guessing that you can't modify your .Net application. If that is the case then your options are limited. You could possibly create a compiled WinBatch script that launches your app after checking for Citrix. The WinBatch script could use the extender and function you mention to determine whether or not to start the app.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

kdmoyers

If you *can* add some code to your application, then I do this kind of thing all the time --  I compile together a winbatch program to do a certain crazy thing, then call that exe from within my ancient ERP system, and then collect the simple integer return value.  ( using intcontrol(1000,p1,0,0,0)  )  Almost any platform will let you execute a command line and collect the return value.

If I need a more complex return values, the simple solution is a text file in the TEMP folder.  Klunky, but if you are not doing it very often, is there much difference between a 1000th of a second and a 10th of a second?
The mind is everything; What you think, you become.