Foxite.COM Community Weblog

Foxite.COM Community Weblog - free weblog service for the Visual FoxPro Community.
Welcome to Foxite.COM Community Weblog Sign in | Join | Help
in
Home Blogs Forum Photos Forum Archives

Luis Guillermo Navas Dangel



  • The day arrived

    Yes, it's not the end of the world, it's the beginning of a new experience for me. I have started to develop in C#. I was avoiding this move to be honest I didn't want to, but since there are almost no more jobs for a Visual FoxPro Developer, I had to start. I choose  C# over VB, because there are more Jobs, it's an international standard language now and the most important to me IT'S NOT VB. :)

    I know VB it's a new and powerful language, but it was VB, and that is enough for my personal point of view.

    I choose C# over Java, because I'm sadly used to Microsoft Tools, but I will keep my eye on Java, seems impressive for me.

    Also I choose C#, because I think Microsoft it's not going to kill it soon (I hope not...)

    As for my learning, well actually I started learning last week, by reading the great book of .Net for Visual FoxPro Developers, at the same time I downloaded all the Visual Studio 2008 express editions and installed on my PC, next I started to look for videos, since it's an easier way to learn, and I found some videos from Microsoft site, to be exact the site address is http://msdn2.microsoft.com/en-us/express/aa700758.aspx I downloaded all the videos, and started to watching them. To be honest, the first videos where really boring since we as VFP developers have a great amount of knowledge and after those beginners videos I already consider my self an intermediate Developer or at least not beginner.

    The next step I took, was to start transforming my simplest VFP applications to C#, but I tried to follow the good fundamentals I had from VFP. Until now, I must say, that I love the IDE, and I can't stop thinking "Why Microsoft never gave this support to VFP", seriously why???? with the same amount of support and advertising VFP would be really popular.

    Until now, everything it's ok, the transition hasn't been as hard as I thought it would be.

    Anyway I hope to become a good C# developer, and as always keep on working and developing in my beloved VFP for as long as I can.

    If anyone has done this before has a good free source of information to make this process easier, please put it in the comments.

  • VFP9 SP2 Available

        Hurry, hurry and download the SP2 for VFP!!!

    http://www.microsoft.com/downloads/details.aspx?familyid=a28ddec6-ba3c-49d0-8176-8c0b3fca06d1&displaylang=en

    Just wondering when will be all the DBI ActiveX available?


  • Visual FoxPro Can Create Office Plug In's

    We had a meeting some time ago in the company where I work, we were speaking in ways for a better use of the bandwidth of our connection. One of the points we talk about, was that every file sent as an attachment, should be a ZIP file. We all agree about this, but during the next week, we find out that not all of the employes were going to follow the rule (some because "they don't know how" even when you have teached them, some because they don't want to, etc). So I tought about a program that will take all the attachments from a message and create a ZIP file from them.

    A simple search in google, bring me a lot of choices for this, but at the same time, I was reading the newest entry on Craig Boyds blog (wich by the way it's always great), and came to my hands the latest version of his compression library, so yesterday I tried to create a COM server in VFP to create a ZIP file from all the attachments in an email message using Microsoft Outlook.

    This was a quick work, so I'm sure that anyone can make it better, I have only tried this with Outlook 2003, so please let me know any issues you may have.

    These are the steps, needed to make it work:


    1. First every office plug in based in COM, it's based in the following class IDTExtensibility2, what is this? well thanks to our Object browser, was really easy to find out it's the Microsoft Add In Designer, like this image shows




    So if you ever need to write one, this is the way to go. Drag and drop the interface part into a an empty PRG, and it will create the basic structure to the class we are going to build. After this part, we need to create another class that we are going to bind to the Microsoft Outlook application model, for this part I read all the information in the VFP Help File.

    Thi
    s is the code, of the two libraries:

    Define Class Connect As session OLEPUBLIC
        Implements IDTExtensibility2 In {AC0714F2-3D04-11D1-AE7D-00A0C90F26F4}#1.0
        oOutlook=Null
        oProxy=Null
       
    Procedure IDTExtensibility2_OnConnection(_Application As VARIANT, ConnectMode As VARIANT, AddInInst As VARIANT, custom As VARIANT) As VOID
            Local lcStr As String
            lcStr="Iniciando Servidor en: "+_Vfp.ServerName
            StrToFile(lcStr,"C:\LogNavas.Log")
            This.oOutlook=_Application
            This.oProxy=NewObject("OutlookEvents")
            If EventHandler(This.oOutlook,This.oProxy) Then
                lcStr=Chr(13)+Chr(10)+"BindEvent Hecho"
           
          StrToFile(lcStr,"C:\LogNavas.Log",1)
            Else
          
          lcStr=Chr(13)+Chr(10)+"No se pudo realizar el BindEvent"
                StrToFile(lcStr,"C:\LogNavas.Log",1)
            EndIf
        EndProc
        Procedure IDTExtensibility2_OnDisconnection(RemoveMode As VARIANT, custom As
    VARIANT) As VOID
        EndProc
       
    Procedure IDTExtensibility2_OnAddInsUpdate(custom As VARIANT) As VOID
        EndProc
        Procedure IDTExtensibility2_OnStartupComplete(custom As VARIANT) As VOID
        EndProc
        Procedure IDTExtensibility2_OnBeginShutdown(custom As VARIANT) As VOID
            This.oOutlook=Null
            This.oProxy=Null
        EndProc
        Function Error(nError As Integer, cMethod As String, nLine As Integer)
         
    ComReturnError(cMethod+'  Error#='+Str(nError,5)+'  línea='+Str(nline,6)+' '+Message(),_VFP.ServerName)
       
    EndFunc
        Procedure Destroy
        EndProc
    EndDefine

    Define Class OutlookEvents As Session OLEPUBLIC
      
    Implements ApplicationEvents In Outlook.Application
        oFiles=Null
         cTempPath=""
       Procedure ApplicationEvents_ItemSend(ITEM AS VARIANT, CANCEL AS LOGICAL) AS VOID
            Local loItem As Object, lcFileName As String, lcPath As String, lnI As Integer, lnTotal
    As Integer, lcStr As String
            lcPath=JustPath(_Vfp.ServerName)+"\"
            Set Library To lcPath+"vfpcompression.fll"
            This.cTempPath=Addbs(Sys(2023))
            lnTotal=m.Item.Attachments.Count
            If lnTotal>0 Then
                This.oFiles=CreateObject("Collection")
                If File(This.cTempPath+"Adjuntos.Zip") Then
                    Delete File (This.cTempPath+"Adjuntos.Zip")
          
              lcStr=Chr(13)+Chr(10)+"Se elimino el archivo Adjuntos.ZIP"
               
         StrToFile(lcStr,"C:\LogNavas.Log",1)
                EndIf
                ZipOpen("Adjuntos.Zip",This.cTempPath,.F.)
                lcStr=Chr(13)+Chr(10)+"Se Creo el Archivo Adjuntos.ZIP"
                StrToFile(lcStr,"C:\LogNavas.Log",1)
                For lnI=lnTotal To 1 Step -1
                    lcFileName=This.cTempPath+m.Item.Attachments(lnI).FileName
          
              m.Item.Attachments.Item(lnI).SaveAsFile(lcFileName)
                    ZipFile(lcFileName,.T.)
                   
    lcStr=Chr(13)+Chr(10)+"Se Agregó el Archivo "+lcFileName
                    StrToFile(lcStr,"C:\LogNavas.Log",1)
                    m.Item.Attachments.Item(lnI).Delete
                    This.oFiles.Add(lcFileName)
       
             EndFor
                ZipClose()
                m.Item.Attachments.Add(This.cTempPath+"Adjuntos.Zip")
                lcStr=Chr(13)+Chr(10)+"Se Adjunto el Archivo Adjuntos.ZIP"
                StrToFile(lcStr,"C:\LogNavas.Log",1)
                For lnI=1 To lnTotal
                    Delete File (This.oFiles.Item(lnI))
                    lcStr=Chr(13)+Chr(10)+"Se Eliminó el Archivo "+This.oFiles.Item(lnI)
                    StrToFile(lcStr,"C:\LogNavas.Log",1)
          
          EndFor
            EndIf
            This.oFiles=Null
      
    EndProc
       Procedure ApplicationEvents_NewMail() AS VOID
       EndProc
       Procedure ApplicationEvents_Reminder(ITEM AS VARIANT) AS VOID
       EndProc
       Procedure ApplicationEvents_OptionsPagesAdd(PAGES AS VARIANT) AS VOID
      
    EndProc
       Procedure ApplicationEvents_Startup() AS VOID
       EndProc
       Procedure ApplicationEvents_Quit() AS VOID
            If File(This.cTempPath+"Adjuntos.Zip") Then
                Delete File (This.cTempPath+"Adjuntos.Zip")
         
       EndIf
            Local lcStr As Strin
    g
            lcStr=Chr(13)+Chr(10)+"Se Finalizó la Sesión"
            StrToFile(lcStr,"C:\LogNavas.Log",1)
       EndProc
      
    Function Error(nError As Integer, cMethod As String, nLine As Integer)
          ComReturnError(cMethod+'  Error#='+Str(nError,5)+'  línea='+Str(nline,6)+' '+Message(),_VFP.ServerName)
       EndFunc
       Procedure Destroy
       EndProc

    EndDefine


    An important part of the code is the EventHandler(This.oOutlook,This.oProxy) function call, think of it like BindEvent() but for COM objects.

    The last step, is to create a key in the registry:

    [HKEY_CURRENT_USER\Software\Microsoft\Office\Outlook\AddIns\outlookzip.Connect]
    "LoadBehavior"=dword:00000003
    "Description"="To create ZIP files in all attachments"
    "FriendlyName"="Outlook ZIP"

    This is an image of the registry key:





    To check if everything is working as expected, in Outllook, go to Tools Menu, Options, Others tab, Advanced options, Com plug in and be sure that Outlook Zip is checked.

    Take a look at this image, if you have any doubt:




    You will find all the code in the file attached to this post.

    More information, and samples in another languages,  in:

    http://msdn2.microsoft.com/en-us/library/Aa140126(office.10).aspx
    http://www.outlookcode.com/article.aspx?ID=36




    posted Saturday, August 18, 2007 3:10 AM by luisn | 1 Comments
    Filed Under:
    Attachment(s): OutlookZip.zip
  • Visual FoxPro Popup Class

    Hi to all, when I saw Emerson Reed Outlook Class I love it at the first time, so I tried to create my small contribussion to this community that has give me a lot.

    That is how this class was born, I'm taking some ideas from the Emerson source, and other that came to my mind while I was working. The class it's free, and it's really easy to use:

    Take a look at this code:

    Public oPopup As Object
    Set Classlib To popup Additive
    oPopup=NewObject("popup","menus")
    With oPopup
        .AddPad("New","FileNew.Bmp","New File","Modify Command Temp")
        .AddPad("Open","FileOpen.Bmp","Open File","Getfile()")
        .AddPad("Save As...","FileSave.Bmp","Save File","PutFile()")
        .Addpad("\-") &&Separator
        .AddPad("First","NavigateFirst.bmp","Navigates to First Record","Messagebox('You Selected First Previous')")
        .AddPad("Previous","NavigatePrevious.bmp","Navigates to Previous Record","Messagebox('You Selected Navigate Previous')")
        .AddPad("Next","NavigateNext.bmp","Navigates to Next Record","Messagebox('You Selected Navigate Next')")
        .AddPad("Last","NavigateLast.bmp","Navigates to Last Record","Messagebox('You Selected Last Next')")
        .Addpad("\-") &&Separator
        .AddPad("Disabled Item and without Picture","","Selects all data in the Current Control","Messagebox('Disabled')",".F.")
        .AddPad("Last Popup Item","","Selects all data in the Current Control","Messagebox('Last Popup Item')")
        .Show()
    EndWith

    This will create a popup like this image:




    The class will detect in an automatic way the 3 standard themes of XP.

    Olive


    Silver


    The AddPad method will receive this parameters:
    lcCaption As String
    Caption of the Menupad
    lcPicture As String
    Picture to use in the Menupad
    lcMessage As String
    Message to display in Statusbar when selected or mouse over it.
    lcCommand As String
    Command to run when the user clicl on the pad
    lcSkipFor As String
    Expresion that must evaluate to boolean to enable or disable a menupad.

    Future Features that I wish to add:

    1. Enable to handle Sub Popups.
    2. Create a MenuBar
    3. Create a Builder
    4. Ability to define shortcuts and support for hotkeys
    5. Support to any Windows XP Theme.
    6. Create a toolbar base class to be partner of the menubar
    7. Fix all the bugs it may have.

    If anyone of you is interested in make it better, feel free to do it, I'm sure a lot of people will come with better ideas than this. Just let me know any update and please share it with all VFP developers.

    I hope you like

    Take care

    Luis Navas

    posted Monday, October 02, 2006 11:42 PM by luisn | 6 Comments
    Filed Under:
    Attachment(s): MenuTest.zip
  • QuickFRX2PDF Update

    Hi to all. It's been a while since I use my Blog here at this greate site www.foxite.com

    I have updated my Listener to create PDF Files, now it can merge existing documents into the PDF file being generated. I also had chance to get a better performance when processing reports with Images in it. Today I tried the INVOICE reports sample that come with VFP and it took me less than 50 seconds to proccess 747 pages. Here's some sample code of how to use it:

    You can generate two types of PDF files, a normal file, this PDF file will let you Copy the text, has a better resolution at greater zoom levels and the file size it's really small.

    Local loListener As ReportListener, lcTargetFile As String, lcMasterPassword As String, lcUserPAssword As String,;
    lcMergeFileName As String

    lcTargetFile="MyPDfFile"
    lcMasterPassword="master"
    lcUserPassword="user"
    lcMergeFileName="existingPDF"
    loListener = NewObject('PdfListener1', 'QuickFRX2PDF.vcx','QuickFRX2PDF.App')
    loListener.TargetFileName = lcTargetFile
    loListener.QuietMode=.F. &&Put .T. to turn off messagges
    loListener.EncryptDocument=.F. &&Put .T. to Encrypt Document
    If loListener.EncryptDocument
    loListener.MasterPassword=lcMasterPassword
    loListener.UserPassword=lcUserPassword
    EndIf
    loListener.MergeDocument=.F. &&Put .T. to Merge Document with an Existing PDF
    If loListener.MergeDocument
    loListener.MergeDocumentName=lcMergeFileName &&Name of the existing file to be merged with
    EndIf
    loListener.OpenViewer=.T. &&Put .F. to prevent Acrobat Reader from being opened
    Report Form myrerport.frx Object loListener

    And you can generate an Image PDF File, this kind of PDF will export everything as an image file to the document, people will not be abble to copy your text form it, but PDF files are bigger and has less resolution at greater zoom levels.

    Local loListener As ReportListener, lcTargetFile As String, lcMasterPassword As String, lcUserPAssword As String,;
    lcMergeFileName As String

    lcTargetFile="MyPDfFile"
    lcMasterPassword="master"
    lcUserPassword="user"
    lcMergeFileName="existingPDF"
    loListener = NewObject('PdfListener2', 'QuickFRX2PDF.vcx','QuickFRX2PDF.App') &&By calling PdfListener2 we create a PDF File as image.
    loListener.TargetFileName = lcTargetFile
    loListener.QuietMode=.F. &&Put .T. to turn off messagges
    loListener.EncryptDocument=.F. &&Put .T. to Encrypt Documente
    If loListener.EncryptDocument
    loListener.MasterPassword=lcMasterPassword
    loListener.UserPassword=lcUserPassword
    EndIf
    loListener.MergeDocument=.F. &&Put .T. to Merge Document with an Existing PDF
    If loListener.MergeDocument
    loListener.MergeDocumentName=lcMergeFileName &&Name of the existing file to be merged with
    EndIf
    loListener.OpenViewer=.T. &&Put .F. to prevent Acrobat Reader from being opened
    Report Form myrerport.frx Object loListener

    Also you can specify other options for both PDF Files types, you can enabled or disable print button, copy options and you can encrypt the document with 2 different levels and assign a passwords.
    Anyone interest in try it, can download a copy from www.crystalvfpclass.net
    It comes with complete Help file and sample form, and there's also a version in Spanish.
    Or send me an email to lnavasdangel@gmail.com

  • QuickFRX2PDF

    Update, I had to change my domain to www.crystalvfpclass.net I have published a new version of my PDF convertor. I'm really excited with this realese. It's now faster than before, has a Help File and the PDF Files are much smaller. In the previous version the class exported all pages as images to the PDF, this new version exprts everything as it should, text as text and so on. Please take a look at it here: http://www.crystalvfpclass.net/QuickFRX2PDF.htm The spanish version can be find it here (Versión en español): http://www.crystalvfpclass.net/QuickFRX2PDFEsp.htm The money I get from the sales of this library will be used to make cirgury to my kid, he is deaf and he needs a cochlear implant. Thanks a lot for your time and let me know any bugs you find.
  • My first post here, bringing you a new Listener Class

    I have updated the link to the file, thanks to Borislav Borisovv for the space in his server. Please try to download the file again. Well it's my first time playing with Blogs, first of all I will like to thank Eric for this oportunity. To anyone interested I have created a new listener class for creating PDF files from VFP reports. It's the first version, and it will be improved in the future. Please let me know any problem you have or bug found in the class. You can find more information here: http://www.crystalvfpclass.com/QuickPdfVfp.htm

This Blog

Post Calendar

<May 2008>
SuMoTuWeThFrSa
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567

Post Categories

Syndication