Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
wrym
Magician


Joined: 06 Jul 2007
Posts: 349
Location: The big palace, My own lil world

PostPosted: Fri Dec 28, 2007 10:48 pm   

com calls for common dialog boxes
 
I'm trying to use microsoft's common dialog classes to get a open/save file dialog box, so i can export/import information into a database. I've searched msdn, and over the internet for a simple method of using one via com calls. So far i've come up with 2 possiblities.

First is using the getOpenFileName function, but this requires passing in a openFileName structure, with some 20 varibles in it. I'ld try this but don't really think that any of cmud's varibles would equate to a structure.

Second method is to use an showopen method that i've found as part of the common dialog control.

I have been able to link to the "useraccounts.commondialog" (only present in xp, not server 2003 or vista) com object, but everything past that has come up null or given an error.

Any help or suggestions to get this working, or another easy method that works on all 3 operating systems would be greatly appreciated.
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Sat Dec 29, 2007 4:46 pm   
 
Have a look at Vijilante toolbox in the package library I think he has some sort of hook set up to access an access database in that. As for the dialog box once you have hooked CMud to the database via com why not use the boxes that Cmud has built in?

As for objects I THINK that the Array variable type is what you are supposed to use for connecting to things via com...


Edit:
I went back and had another look at Vijilante's toolbox myself and I was right he does have everything you need to connect to an access database in the MappingWidgets class.

Of special interest to you would be the OpenMapDatabaseForQuery, SpecialMapQuery, aliases and the onExit event.

If you wanted to use a different type of database you could change the provider string in the OpenMapDatabaseForQuery alias.

Vijilante wrote:
#CALL @MapCon.Open(%concat("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=",%pref(MapFile)))


To use a different file you would change the last part of the above quote.

#CALL @MapCon.Open(%concat("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\path\mydatabase.mdb"))

Have fun...
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Fri Jan 04, 2008 2:30 pm   
 
Slim version using Local Vars and win XP only controls

$Dialog=%comcreate("useraccounts.commondialog")
#IF ($Dialog.ShowOpen) {$strFile=$Dialog.FileName} {#ECHO No File Selected. complete this code block}
_________________
Zmud Support Library
Zmud Knowledge Base

Last edited by nexela on Sun Jan 06, 2008 7:22 pm; edited 1 time in total
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Sun Jan 06, 2008 12:31 pm   
 
Actually that might work on Vista and Win 2003 but nothing Win 2000 or before. Could someone with Vista try my code and let me know if it works?
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Sun Jan 06, 2008 4:50 pm   
 
I'm using XP SP2 and it almost works...I just changed #IF ($Dialog.OpenFile) to #IF ($Dialog.ShowOpen)
$Dialog.OpenFile threw an error and then locked up CMUD.
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Sun Jan 06, 2008 7:23 pm   
 
Oops typo on my part, post aboved edited with fix.
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net