A while ago there was a posting here demonstrating how to read and write registry keys from MapBasic using Windows API functions in the ADVAPI32.DLL library. The user running the mbx would have to have superuser privileges to write into the registry, but that's simply a matter of running it as Adminstrator.
I think a .reg file is simply a text file with registry keys and their values, so I should think it wouldn't be too hard to build a registry file importer in MapBasic... On Thu, Apr 06, 2006 at 05:43:26PM -0500, David Reid wrote: > Well, as I stated in the first paragraph of my comment: > > "<<<< Is it possible >>>> to export and import a Windows registry key > using Mapbasic. > Maybe using MB to trigger a batch file to do so?" > > As I mentioned here, **if it is possible**, It would rely on Mapbasic having > the ability to run a dos batch file, a task which I've never tried. > > > Just thinking outside the box :) > Dave > > > -----Original Message----- > From: Soren Breddam [mailto:[EMAIL PROTECTED] > Sent: Thursday, April 06, 2006 5:24 PM > To: David Reid; Spencer Simpson; [EMAIL PROTECTED] > Subject: Re: [MI-L] Export and import a Windows registry key using Mapbasic > (Was: Create Menu Bar) > > > Hi Dave et al, > > Sorry for pulling this a bit askew, but I'm a batch file novice. > So could you pls tell me how do you import a .reg file with mb? > > Normally when I upgrade my users, I use a saved .reg file and a .prf file to > restore settings. The .prf part is kind of easy but the .reg part I haven' > figured out how to automate... > > Venligst/regards > > Soren Breddam > > > -----Oprindelig meddelelse----- > Fra: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] vegne af David Reid > Sendt: 6. april 2006 17:30 > Til: 'Spencer Simpson'; '[EMAIL PROTECTED]' > Emne: RE: [MI-L] Create Menu Bar (Was: Menus - swapping in and out) > > > For what it's worth. > > Is it possible to export and import a Windows registry key using Mapbasic. > Maybe using MB to trigger a batch file to do so? > > If so, you could export the user's current tools listing from the mapinfo > tree in the registry, when finished, import that branch back in. Of course, > you'd probably have to restart Mapinfo for this to actually work. > > Never the less, I allways keep a back up of that branch as it holds the > utilty name, comments and wheather the mbx autoloads or not. > > Dave > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Spencer > Simpson > Sent: Thursday, April 06, 2006 8:31 AM > To: '[EMAIL PROTECTED]' > Subject: RE: [MI-L] Create Menu Bar (Was: Menus - swapping in and out) > > > Arrgh. The menu > > > Create Menu Bar As > > "Files" as "Files", > > "Edit" as "Edit", > > "Tools" as "Tools", > > "Objects" as "Objects", > > "Query" as "Query", > > "Table" as "Table", > > "Settings" as "Settings", > > "WinSpecific" as "WinSpecific", > > "Window" as "Window", > > "Help" as "Help" > > won't work; I should have taken Lars' caveat about translating from Danish > to heart. But as I stated in a previous email, you can > open mapinfow.mnu in a text editor and copy the actual default Create Menu > Bar statement where it appears at the end of the file. > > Hope this helps > Spencer > > ________________________________ > > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Lars V. > Nielsen (Hvenegaard) > Sent: Thursday, April 06, 2006 6:40 AM > To: Terry McDonnell > Cc: [EMAIL PROTECTED] > Subject: Re: [MI-L] Menus - swapping in and out > > > Hi Terry, > > All menus are created independently of each other in the "common" area of > Pro. You can define any number of additional menus (within GDI limits) and > attach them anywhere in the current menu system: menu bar, existing standard > menus, existing shortcut menus, user defined menus etc. > > So you don't "delete" standard menus by defining your own menus or replacing > the menu bar. All defined menus incl. standard menus are still defined and > ready for use as long as Pro runs (only menu items with an attached mbx > based handler sub will be removed automatically when the app closes). > > The problem arises when several mbx's want to add menus to the singular menu > bar. The menu bar is NOT a saved GDI resource (like the menus), it only > references them. And unfortunately it's impossible to retrieve information > about its current state, so the only possible "backstep" is to recreate the > default. > > "Create Menu Bar As Default" will recreate the standard menu bar, and all > menus added by mbx's to the MENU BAR will be lost. The menus themselves are > not lost, the menu bar just doesn't reference them anymore. This is why > adding your menus to the Tools menu instead of the menu bar makes sense, > because that'll ensure that your menus are restored (along with the Tools > menu) when you recreate the standard menu bar. > > If it's a question of "minimizing" the standard menu bar, not just hiding > it, I'll recommend changing the initial menu bar this way (translated from > Danish, so the words may differ slightly): > > Create Menu "MapInfo" As > "Files" as "Files", > "Edit" as "Edit", > "Tools" as "Tools", > "Objects" as "Objects", > "Query" as "Query", > "Table" as "Table", > "Settings" as "Settings", > "WinSpecific" as "WinSpecific", > "Window" as "Window", > "Help" as "Help" > > Create Menu Bar As "MapInfo" > > > Best regards / Med venlig hilsen > Lars V. Nielsen > -------------------------------------------------------- > Hvenegaard A/S > Rugaardsvej 55, DK-5000 Odense C > Denmark > Tel. +45 6313 5050 > http://www.hvenegaard.dk > > ----- Original Message ----- > From: Terry McDonnell <mailto:[EMAIL PROTECTED]> > To: [EMAIL PROTECTED] > Sent: Wednesday, April 05, 2006 2:01 PM > Subject: [MI-L] Menus - swapping in and out > > Hi Listers > > I have my own menu bar items set up but, for testing purposes, I've allowed > the standard MI menus to stay up (so I can make GOOD use of them). Now I > want to: > > Replace the std MI menu with my own > When the user closes my app's window I want my menus to disappear and the > std. MI menu to replace it. > > This is because my users use native MI too and want to be able to simply > revert to this. > > Now I know all about usng the WinClosedHandler() to bring this about - at > the moment I just disappear all my windows. What I'd like is to know a > simple and efficient way of achieving the above. The Menu Bar Hide command > doesn't specify WHICH menu to hide/show. > > Is there some way of swapping menus in and out? > > 'ppreciate it > > Terry McDonnell > > > > > > _______________________________________________ > MapInfo-L mailing list > [email protected] > http://www.directionsmag.com/mailman/listinfo/mapinfo-l > > > > _______________________________________________ > MapInfo-L mailing list > [email protected] > http://www.directionsmag.com/mailman/listinfo/mapinfo-l > > -- > > Checked by AVG Free Edition. > Version: 7.1.385 / Virus Database: 268.3.5/302 - Release Date: 04/05/2006 > > > -- > Outgoing mail is certified Virus Free > Checked by AVG Free Edition. > Version: 7.1.385 / Virus Database: 268.3.5/302 - Release Date: 04/05/2006 > > > > _______________________________________________ > MapInfo-L mailing list > [email protected] > http://www.directionsmag.com/mailman/listinfo/mapinfo-l > > > > -- > > Checked by AVG Free Edition. > Version: 7.1.385 / Virus Database: 268.3.5/302 - Release Date: 04/05/2006 > > > -- > Outgoing mail is certified Virus Free > Checked by AVG Free Edition. > Version: 7.1.385 / Virus Database: 268.3.5/302 - Release Date: 04/05/2006 > > > > _______________________________________________ > MapInfo-L mailing list > [email protected] > http://www.directionsmag.com/mailman/listinfo/mapinfo-l > _______________________________________________ MapInfo-L mailing list [email protected] http://www.directionsmag.com/mailman/listinfo/mapinfo-l
