Get/Set Filename using COMDLG32.OCX

Hi Programmers, I developed a small Codeunit which uses COMDLG32.OCX and allows users to select a filename using the common Windows File Open/Save dialog. If you are interested, I can send it to you for free. please send an e-mail to m.fabian@thenet.ch Marcus Fabian m.fabian@thenet.ch

… P.S.: I posted the codeunit to www.mynavision.net. You’ll find it there in the download area.

Hello, why all Navision Crack only use OCX ??? I do this by the way of create dll’s. Okay the Solution is the same, where are the difference ?! P.S: Do you programm the ocx in C++ or in VB, fabian ?! ------------ Best regards Alejandro Schubert schubert@dolphinct.de

Nice to see how the same idea comes out at different places at (almost) the same moment :slight_smile: Last week, I had to create a setup table with a lookup to set directories to know where to save dataport output files to from automatic runs. I used the Common Dialog control for that too, but in a slightly different way. It is not common knowledge that the Common Dialog will show directories (folders in Window-speak) only when there are no matching filenames to the filespec. But if you want to offer a “browse for folder” function, this comes in very handy! Sample Browse for Folder function: Create variables: ComDialog = vartype OCX to comdlg32.ocx (note: you must have a 6.0 version OCX with a developers license to create the function) FakeFileName = text 30 DirFilter = text 30 FileNameFromDialog = text 200 DirectoryName = text 200 Code: ComDialog.DialogTitle := ‘Select a directory’; FakeFileName := ‘Select a directory’; ComDialog.FileName := FakeFileName; DirFilter := ‘Directories/*.#!$’; ComDialog.Filter := DirFilter; ComDialog.ShowSave; FileNameFromDialog := ComDialog.FileName; DirectoryName := COPYSTR(TfileName,1,STRPOS(TfileName,FakeFileName)-1); Use as you like! (but without warranty from me) Oh, Alex, using an OCX that everybody has on its system already is more elegant than creating your own DLL. John

Okay in this case it is true, but i think of third party produkts like Navision Pad ! (I have made it myself, and it works fine) But not alle User have all used ocx Modual on the worksation e.g. the standard ocx the call the mapi funktions. ------------ Best regards Alejandro Schubert schubert@dolphinct.de

Hi all Just a comment on the dll and ocx issue. A file with the extension dll registered using the ocx data type from within Navision will be a OCX. The extension is not enough to call a file a dll or an ocx. It’s the structure of the control that shows its behavior. Regards Andreas Lundin

Hi Alex, >>Do you programm the ocx in C++ or in VB, fabian ?!<< In Delphi! But COMDLG32.OCX comes from Microschrott (sorry: Micro$oft) and therefore it might be programmed in C++ Marcus Fabian ---------------------------------- fabian@ddag.ch m.fabian@thenet.ch 079 439 78 72 ----------------------------------

Hi Guys I did use Johns solution some time ago, I Created the DataPort on an NT Workstation but the Customer had Windows Clients, so it worked fine at the office but not on the clients site both Microsoft but different Common Dialog Controls. Mr David Cox MindSource (UK) Limited Navision Solutions Partner Email: david@mindsource.co.uk Web: www.mindsource.co.uk

To Fabian: I only programm it on VB 6.0 bescause we have von C++ :wink: If you want a dokument about the Programm you can send me an Email ! ------------ Best regards Alejandro Schubert schubert@dolphinct.de

David, one of things to keep an eye on when using “standard” Windows controls is version-dependency. That’s why Windows programs come with an installer to set things right. In your case, it means you have to make sure that comdlg32.ocx at every workstation is the same version you used… sigh. John