Microstation launching into a blank window (no menus or anything) - vb6

We have a VB6 application here that automates the process of opening drawings and printing them with a specific printer that turns them into TIFF files.
I'm in the process of testing the application as we upgrade from V8 to V8i and I'm running into some problems just launching the application.
If I open the Microstation normally via the exe file everything works ok. But when I do:
Set msApp = CreateObject("MicrostationDGN.Application")
It opens a blank microstation window with no menus or anything (basically what the window looks like behind the file open dialog)
And then I do
msApp.OpenDesignFile ("dummy.dgn")
that looks like this: imgur.com/A5rc4.png
Is there something new with v8i where it doesn't bother loading the gui when opened as an object?

Did your application depends on some user preference of Microstation? I think you can debug your aplication step by step.

You can call the ustation.exe with the parameter -debug. This creates a file called debug.txt in the current working directory.
There you might find some helpful info.

Related

Managing windows when local SAS session starts

When a SAS session starts, there are 5 windows. (Result Viewer, Explorer, Log, Editor, Output).
My desired state is when the session starts:
No result viewer
No output window
No default explorer window
The useable explorer window default open(to clarify this i attached a picture)
Good/Bad explorer window
Enchanced editor open
Log window open
So there will be 3 windows opened at session start, and i would like to resize them into 3 columns.
What i got so far:
I know the task can be done, because i was able to do this on my working computer. Unfortunately they reinstalled my windows without a word, and i lost my setup. And i did not have my autoexec/sasv9cfg file backuped. :(
I can close the output window with dm listing off command in my autoexec.
I can resize the 3 windows if i have them, with dm wdef command as well.
My biggest issue is i cant find again a DM/ODS or any kind of command, which closes the Result Viewer, and the original Explorer, and opens the normal/usable Explorer. In my faded memories i needed only 1 DM/ODS/sth command to achieve these 3 steps at once. Of course, if we can find a solution in more steps, thats also completely fine.
Big thx for any kind of help
You do not want the DMSEXP docked windows (which includes ODS Results tab) at session start up. The only way to do this programmatically is to specify the SAS system option -nodmsexp in the sas.exe command line or config.sys.
So, on my system, I set the target command on my SAS icon to be:
"C:\Program Files\SASHome\SASFoundation\9.4\sas.exe"
-CONFIG "C:\Program Files\SASHome\SASFoundation\9.4\nls\en\sasv9.cfg"
-NODMSEXP
Tweak the SAS DM session window states by placing this code in your autoexec.sas
dm 'dmsexp;tree on;next;listing off;tile vert' ;
You can also fiddle around with your session start up using the system options:
initstmt=
initcmd

How can I open a Microsoft Access Database file with an .exe?

I have been working on creating a pretty advanced GUI enabled database in Microsoft Access and am now in the implementation phase of my project.
My dream is to make an .exe file that will point to the actual .accdb database file (which will be hidden) as I cannot change the icon of the .accdb but will be able to modify the .exe's icon thus giving my implementation a more professional feel.
I'd prefer not to just create a shortcut to the .accdb and change that icon.
Through some quick digging, my plan was to create a .bat file that opens the .accdb and then use some online ".bat to .exe" converter to then add an icon to the .exe.
I can't figure out how to create a .bat file that opens my .accdb. I've tried a variety of different things like:
start "" C:\Program Files (x86)\CompassTrack "Science Department.accdb"
and other things that dont work.
It occurred to me that a .bat to .exe approach may not be the best way to do this. I don't particularily like the brief command prompt window appearance and would be open to any suggestions as to how to get a nice looking .exe file to open my .accdb.
If the best way really is a .bat file, I'd appreciate some help with the .bat file. The path to the file is C:\Program Files (x86)\CompassTrack\Science Department.accdb but for some reason every time, command prompt would return "Cannot find C:\Program "
Thanks in advance!
to change icon of an exe file using batch, look here
and to start your file use:
cd "C:\Program Files (x86)\CompassTrack"
start "" "Science Departement.accdb"
I believe you can just change the icon of your Access database. Go to Current Database (in recent versions under Office Button > Access Options) and the option is in there.
Here's a really simple C# program that you can compile into an exe very easily to if you have .NET 3.5 installed. it uses a utility called the command line compiler. You'll have to change the file path obviously.
using System;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO;
public class App
{
public static void Main(string[] args)
{
Process myProcess = new Process();
myProcess.StartInfo.FileName = #"c:/your_file_path_goes_here/YourDB.accdb";
myProcess.Start();
}
}
You'll write the above to a text file with the extension .cs. Then create a batch file (a text file with the extension .bat) with this code.
#echo OFF
echo Compiling A File . . .
C:\WINDOWS\Microsoft.NET\Framework\v3.5\csc.exe /win32icon:_.ico /target:winexe /recurse:*.cs
echo.
#pause
Put these in the same dir as whatever icon you want to use, but make sure the icon is an iso file named _, as seen in the batch program. When you run the bat file, it will create the exe with the icon of your choice and it will simply launch the access database.
The feature and ability is part of the Access development system. Attempting to modify some .exe file etc. will not work.
I do suggest that you set the icon under file->options current database. It not clear why this is not working (perhaps start a new question to resolve that issue).
Keep in mind that if you deploy or change the resulting location, then you have to change the above “options” setting (manually, or by code – this much explain why your icon is not displaying – the path name cannot be relative – must be absolute.
ALSO select the box that says to use the icon for all forms and reports (this will give your application a MUCH more polished look. Since the .exe that actually runs your file is msacces.exe, then you can’t really change the application icon any other way. You see icons for the application AND ALSO forms like this "when" you set the application icon as per above:
So you WILL want to set the application icon. You then create a shortcut on your desktop. And again set the icon for that windows shortcut (it will nicely show up in the task bar with that icon).
The actual shortcut will look much like this:
"C:\Program Files (x86)\Microsoft Office\Office14\MSACCESS.EXE"
"c:\RidesDev\SkiRides\ RidesXP.accde" /runtime
The above shortcut will be on a single line (space between the two lines). The above is for Access 2010, so for 2013, then the folder is office15, and for 2016, it is office16 in above.
Also NOTE very important is the /runtime. This will ensure that the access icon NEVER shows during start-up.
Also, during start-up you will often see the MS Access splash logo during start-up. E.g. this:
You can replace this splash screen by placing a .bmp (picture) file in the SAME folder as the accDE with the same name.
So in above, if I place a RidesXMP.bmp picture file, then during start-up in place of the access splash screen, you see this:
Since you likely want the forms + reports icon to be custom, then the above makes the most sense. Your approach would ONLY give you a desktop icon, not one for the task bar, forms etc.
The above will result in hiding the access splash logo during start-up, and also apply an icon to all forms etc. I don’t suggest some approach that attempts to modify some .exe or some such – that’s likely to cause issues on customers computers. And using some .exe will not give you the icon for forms and repots.

Windows: tell app to open file

On Windows, how do I get my app to tell another app to open a file that I just generated. For example, "WordPad, please open 'foo.rtf' that I just made." Or Word, or other big apps that may already be open with other files. I have to assume that the app may or may not be open already.
Alternatively, if I could only do the equivalent of double-clicking the file, so as to open it with its default application, that would still be all right.
Depends on how your application handles opening other files.
One would think that assuming filetype associations are configured properly in Windows, it should know what application to open .rtf files with (per your example).
In powershell, you could use gc if you're only looking at plaintext data.
http://www.ats.ucla.edu/stat/mult_pkg/faq/general/powershell_examples.htm
In Python, you would handle the file as an object, per the example here:
https://docs.python.org/2/tutorial/inputoutput.html#reading-and-writing-files
But if you wanted to launch a specific secondary application to open the file, you might try running an outside program (executable) in python?

Do executable files always open a terminal window on MacOS?

I'm on MacOS X, and I'm pretty new to app-bundle-type things. I am writing a program that opens a window and registers mouse input -- not a command line tool. When I compile my code (written in C, if that is important) into an executable file (a "unix executable file") and then run that file directly (by double clicking it, for example), a terminal window pops up, and then the program's window pops up. Likewise, if I navigate to the directory of the executable and open it from the command line, it pops open /another/ terminal window and then the program's window.
However, if I wrap the executable in a bundle (thus, I suppose, turning it into a proper "app"), then when I run the app, either by double clicking or from the command line, the program's window opens and no new terminal window is created. Is this merely a property of the "app bundle"'s architecture? Or is there a way that I can run the raw executable without incurring another terminal window? I suspect that I'm misunderstanding something fundamental. Thanks in advance!
I believe what you're seeing is correct. In order for a separate window to not pop-up, you'd need to encapsulate it into a bundle.
Launching by double-clicking a bundle, or using the 'open' command from Terminal uses Apple's Launch Services, which maintains a list of known (registered) applications. When an application (bundle) is introduced to the system, it is registered with Launch Services and associated with its URI (e.g. com.apple.calculator), which is present in the bundle's Info.plist
Other items in the Info.plist tell launch services how to handle the application, such as checking if the minimum or maximum version of the OS has been exceeded, or whether or not to display a dock item.
A lone binary doesn't have an associated Info.plist manifest, so its behaviour can't be varied and a Terminal window is opened.
Bare executable files are essentially treated as documents by Launch Services (the framework that the Finder, Dock, and open command use when you open stuff). The application which handles such documents is Terminal. So, when you open an executable in that fashion, it launches Terminal if it's not already running and tells it to open the document. Terminal does this by opening a new shell window and auto-typing the path to the "document" as a command line.
Launch Services handles bundled apps as, well, apps. If the app is already running, it activates it and possibly has it open a new untitled window. Otherwise, it launches it.
As Rob Napier notes in the comments, if you run an executable directly from the command line (or if some already-running app launches it using NSTask or fork+exec), it will simply run. Launch Services won't be involved, so Terminal will not be asked to open the executable as a document.

Create an application and attach it on right-click on a file

I want to make an application in C# VS12 preferably, and I want to attach it on right click menu passing the filepath as an argument, it would be great if I could do that on multiple selection too. How do I make that happen?
in the installer of your application you need to add a file extension association. (for development you can test that by registering the extension manually: right click, open with...). the file name that was clicked will be passed to your app as a command line argument (those are the args[] in the main method of you app).
multiple selection is a bit trickier but certainly doable. when your app starts you need to check if you have an instance of the app already running (using a mutex for example) and send a message to that instance with the file name you received.
If you have not worked with context menu handling, you should take a look at this tutorial.
For the file path handling, you could take a look at this image editing example.

Resources