How to create a Basic4ppc library

Discussion in 'Code Samples & Tips' started by Erel, May 1, 2007.

  1. dzt

    dzt Active Member Licensed User

    Hi dennishea,

    Attached is a complete C# project (with compiled DLL) for Compact FramewWork 1.0. You can change it to CF 2.0 or anything else (through Sharp Develop Project Properties)

    Attached also is the appropriate b4ppc file.
     

    Attached Files:

  2. dennishea

    dennishea Active Member Licensed User

    Thanks dzt. I appreciate your time for this. Thanks again and hope your day goes well.

    :)

    dennishea

    edit:

    If I would've known about being able to choose which cf. It took me a minute to find where the selection window was for changing it to cf2. While I was waiting for your input I did some reading on MSDN and learned a lot. My main problem with MSDN is I have a hard time finding what I'm looking for and when I do an even harder time understanding it. That's what I get for being a 61 year old high school drop out. Thank You Thank You Thank You dzt for your help. I am now growing hair again.

    :sign0060: :sign0008:
     
    Last edited: Sep 10, 2007
  3. Cableguy

    Cableguy Expert Licensed User

    I'n Portugal we have a saying that goes like this:

    "Old donkeys don't learn new languages"

    My dad is 65, never went beyond the 3rd grade, and his most ambicious chalange was to get is driver's license at 42....

    This is to say that you, or anybody else for the matter, should not feel diminished for not having a phd, md or whatever....
    I could only wish my dad was interested in computers when I was grouwing up...It would have made adolescence so much easyer....

    I praise you all, old timers, that still have the will to learn new things....

    :sign0188::sign0188::sign0188::sign0188:
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    I join the praises. :sign0188:
     
  5. dennishea

    dennishea Active Member Licensed User

    Thank You cableguy & erel. I can't seem to find the words to express how your kind words make me feel.

    dennishea
     
  6. lairdre

    lairdre Member Licensed User

    pass exception back

    Erel,
    When writing a dll for B4PPC, if I have an exception in one of my methods, how do I pass it back to the calling code in B4PPC?

    Is my only option to return from the fucntion false?

    Do I have access to any other code in the application from my dll.

    I have a few dll's I would like to publish, but I need to clean up the error handling first.

    Thanks,

    Ron Laird
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    The error will automatically pass to Basic4ppc and it will show the standard error message.
    The user can always prevent the error message by using ErrorLabel method.
     
  8. lairdre

    lairdre Member Licensed User

    Dlls

    From my dll, do I have access to any of the object in any other dll's that are loaded. I guess I am asking how namespaces are actually handled.

    Ron
     
  9. Erel

    Erel Administrator Staff Member Licensed User

    You could access any of the objects only if the user passes the object inside a method call.
    Like using ControlRef / Value properties which are usually just references to the real object.
    It allows the user to pass the object to a method.
    In your method declaration you should except an object and now cast it to whatever requires.
     
  10. Louis

    Louis Active Member Licensed User

    Hi. The next time I have string to unmanaged native C pointers issues with .NET especially with 1.1 how can I fix this? My screen reader JAWS is not able to read Sharp Develop errors properly to me because some of the list boxes are not regular Windows List boxes but are customized with lots and lots of pictures. But I still can manage to use parts of the IDE JAWS is able to read to me. But if I find out how to fix errors that aren't obvious, this way, I don't have to keep submitting ok compiled dlls but unrunnable ones that have errors at runtime, unless people don't mind helping me out when no one at home can? Thanks very much. Also, is there a way to capture these errors to ASCII text files or to an HTML file so I can see exactly what they are in another editor? Thanks.
     
  11. thearrow

    thearrow New Member

    Hi,

    I downloaded your example and just compiled it with #develop (last version). The dll work correctly then I test it with b4ppc on my desctom computer. But when I try to add dll in a b4ppc project on my compact device, I get messagebox that "an error occured. NotSupportedException". Can you tell me what I do wrong.

    Device: HTC Artemis, WM6

    Thanks.
     
  12. dzt

    dzt Active Member Licensed User

    Hi,

    Menu->"Project"->"Project Options"
    Click "Compiling" tab".
    At "Target Framework" combo, select "Compact Framework 1.0" or "Compact Framework 2.0".

    First you should install Compact Framework SDK.
     
  13. Louis

    Louis Active Member Licensed User

    Hi. I code my DLLS in Vb.NET. If I have a class named "Const", and Const is a reserved keyword, and because this .net library is closed-source, how can I use this "Const" class? It has some unsined hexadecimal integers it returns that I need to use. If I convert these integers, they turn into signed integers and I get errors. Thanks.
     
  14. agraham

    agraham Expert Licensed User

    Can you explain what the problem is in some more detail as I don't understand it.
     
  15. Louis

    Louis Active Member Licensed User

    Hi. I am trying to wrap a c# class from within a VB.NET library, but the class from the C# dll is named Const. It returns unsigned Hexadecimals I nee to pass to a couple of other subs/functions. The problem is that in VB.NET Const is also used to declare Constants. So how can I use this kind of conflicting class? Thanks.
     
  16. agraham

    agraham Expert Licensed User

    If it is a C# dll I presume you have a reference to it in your project rather than using DLLImport (aka Declare). The class Const should be in its' own namespace in that dll so try referring to it as "WhateverNamespace.Const"
     
    Last edited: Nov 23, 2007
  17. Louis

    Louis Active Member Licensed User

    Hi, thanks but however when I do that, VB.NET says that Const must be used as declaring variable types and can't be a class. This C# dll I am trying to wrap is closed, but I'm making a wrapper for it in VB.NET for Basic4ppc. I guess I could try letting Basic4ppc deal with passing the Constance in the Const class to my wrapper? Thanks.
     
  18. agraham

    agraham Expert Licensed User

    What are you using? This works for me in VS2005

    Code:
    C# DLL
    -----------------------
    namespace ClassLibrary1
    {
        
    public class Const
        {
            
    public Const()
            {
            
    }

            public String Version
            { get { return "Const" ;}}
        }
    }

    -------------------
    VB.NET
    -------------------
    Imports ClassLibrary1

    Public Class Form1
        Dim Test As ClassLibrary1.Const = New ClassLibrary1.Const

        Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
            MsgBox(Test.Version)
        End Sub

    End Class
     
  19. iamechinese

    iamechinese New Member

    you are great!
     
  20. Louis

    Louis Active Member Licensed User

    Hi. I am having a hard time following the ScrollBar VB example for creating and raising events in a Basic4ppc library. Can someone show me a more simpler example of how I can raise events to activate in Basic4ppc maybe show an infinite loop of a counter being incremented by 1 and when it gets to 10 the loop raises an event to Basic4ppc and exits? Thanks.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice