How to create a Basic4ppc library

Cableguy

Expert
Licensed User
Longtime User
NO Problem....Thanks for you time and expertize....
I'm eagger to learn, and although internet HAS everything you'll ever whanted, is hard to find when you don't known what others call it...
 

Cableguy

Expert
Licensed User
Longtime User
Taximania, the thing about those tutorials is that they all base the assumption that you have the Visual Studio version of c#....And some of the options featured on these are not available, or are hard to find in other c# enviroments such as sharpdevelop...And they all only tell "do it this way" and "why things are done this way"....
 

taximania

Well-Known Member
Licensed User
Longtime User
My last post has bit the dust.
DLL's can be created in SharpDevelop2.1.
I've done a very simple one based on the link to the example code from my previous post. Ask me if you want the code.

EDIT AGAIN:
Tried eVC++ :-(
Stick to Sharp Develop. eVC++ is way out
 
Last edited:

Louis

Active Member
Licensed User
Longtime User
Hi. What is the best way to build the .SLN files, or does SharpDevelop do this automatically whenever you select new Solution and then select .net CF application? Thanks.
 

dzt

Active Member
Licensed User
Hi,

.sln files created automatically by SharpDevelop.

But I think, the best way to start is to use a template solution (I've posted earlier in this thread ScrollBar examples) and then from the project area rename solution, project, and class files.

Attached in this post is one more simple sample, I've made for this thread http://www.b4x.com/forum/showthread.php?t=599

@taximania
I am amazed. Your passion to learn looks endless. C++ isn't an easy to learn programming language but on the other hand it delivers all the power.
With eVC++ you can't create .NET DLLs but only native ones. C# is a good choice (VB.NET too).
 

Attachments

  • CableGuyAboutBox.zip
    2.7 KB · Views: 433
Last edited:

taximania

Well-Known Member
Licensed User
Longtime User
@DZT, I have qualifications in 'C' programming. C++ is just a bit more complex.

To use your example in Sharp Develop, what option do I chose when I click on new solution ? C#, VBNet, etc.

Sharp had arguments with this line,
frmAbout = new System.Windows.Forms.Form();
so I added a reference to system.windows.forms, it compiled to a dll but it wont work on my device.
 

dzt

Active Member
Licensed User
You shouldn't make new solution. Just open (from File->Open-> Project/Solution) .sln file with SharpDevelop 2.2 (yes there is an update). It has all the necessary references and at Project Options->Compiling has Target Framework: Compact Framework 1.0.

Then Build->Build Solution...

(Ohhh, now I see. I mean the attached zip file in my previous post at this thread, not the code I've posted at Questions and Help thread)
 

Cableguy

Expert
Licensed User
Longtime User
dzt thanks for all your trouble helping me, and of course, all others who want to learn dll creation...

I built your code and it works fine except that, in the desktop, the inputbox is shown outside the form boundaries even when i set the position relatively to the form...

I haven't tryed it in my device yet...
Any clues?
 
Last edited:

dzt

Active Member
Licensed User
Hi cableguy,

Positioning forms at Desktop Windows is a bit tricky if you want to use the same DLL for both device and desktop. Didn't post anything because I had the device in my mind.

The workaround:
Add Left and Top properties to your AboutBox
B4X:
[B][SIZE=2][COLOR=#0000ff]public [/COLOR][/SIZE][SIZE=2][COLOR=#ff0000]int [/COLOR][/SIZE][/B][SIZE=2]Left[/SIZE]
[SIZE=2][COLOR=#006400]{[/COLOR][/SIZE]
[SIZE=2][COLOR=#8b4513]get [/COLOR][/SIZE][SIZE=2][COLOR=#006400]{[/COLOR][/SIZE][SIZE=2][COLOR=#000080]return [/COLOR][/SIZE][SIZE=2]frmAbout[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Left[/SIZE][SIZE=2][COLOR=#006400];}[/COLOR][/SIZE]
[SIZE=2][COLOR=#8b4513]set [/COLOR][/SIZE][SIZE=2][COLOR=#006400]{[/COLOR][/SIZE][SIZE=2]frmAbout[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Left [/SIZE][SIZE=2][COLOR=#006400]= [/COLOR][/SIZE][B][SIZE=2]value[/SIZE][/B][SIZE=2][COLOR=#006400];}[/COLOR][/SIZE]
 
[SIZE=2][COLOR=#006400]}[/COLOR][/SIZE]
 
[B][SIZE=2][COLOR=#0000ff]public [/COLOR][/SIZE][SIZE=2][COLOR=#ff0000]int [/COLOR][/SIZE][/B][SIZE=2]Top[/SIZE]
[SIZE=2][COLOR=#006400]{[/COLOR][/SIZE]
[SIZE=2][COLOR=#8b4513]get [/COLOR][/SIZE][SIZE=2][COLOR=#006400]{[/COLOR][/SIZE][SIZE=2][COLOR=#000080]return [/COLOR][/SIZE][SIZE=2]frmAbout[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Top[/SIZE][SIZE=2][COLOR=#006400];}[/COLOR][/SIZE]
[SIZE=2][COLOR=#8b4513]set [/COLOR][/SIZE][SIZE=2][COLOR=#006400]{[/COLOR][/SIZE][SIZE=2]frmAbout[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Top [/SIZE][SIZE=2][COLOR=#006400]= [/COLOR][/SIZE][B][SIZE=2]value[/SIZE][/B][SIZE=2][COLOR=#006400];}[/COLOR][/SIZE]
 
[SIZE=2][COLOR=#006400]}[/COLOR][/SIZE]

case 1, using .Show
Position the AboutBox after the .show method

case2, using .ShowDialog
As nothing executed after .ShowDialog until the user presses OK you can't position your AboutBox after .ShowDialog. So to do the trick you should use a timer. Enable it before .ShowDialog and in the first tick (1 ms should be enough) disable the timer first and then position your AboutBox.

And a small notice about my posted c# code. If you use .ShowDialog to show the AboutBox then at btnOK_Click event is not enough to use frmAbout.Hide(). Instead of Hide use frmAbout.Close()
 

dzt

Active Member
Licensed User
I'm not sure. I'm away now and can't check it. Your probably missing .NETCF developers package.
Anyway remove it from references. No needed for this project.
 

taximania

Well-Known Member
Licensed User
Longtime User
Thanks for the reply.

Opened a new project, cut and pasted your code.
I got it to build after adding a reference to system.windows.forms and adding the line 'Using System.Windows.Forms'

Works on the desktop :sign0060: It's just not on the form as CableGuy stated :cool:

Device now errors with, (get ready)

An error occured.
File or assembly name
'System.Windows.Forms,
Version=2.0.0.0,
Culyure=neutral,
PublicKeyToken=B77A5C5
61934E089', or one of its
dependencies, was not
found.

If I try to reload the dll I get on the device,

InvalidProgramException on the device :sign0137:

Have I made a reference to windows system.windows.forms and not the .NET system.windows.forms ??

Just deleted the reference and added the .net reference to the file.
No change. Still the same errors.


Don't rush to reply. I'm in no hurry.

Many thanks all the same :sign0188:
 
Last edited:

Cableguy

Expert
Licensed User
Longtime User
Taximania, I've come to notice that even when we change the c# code and Build the solution, sometimes,(idon't know why), the dll doesn't get built...and the first created dll is still there..

I alway check the date and time of the file present in the bin folder to make sure it's up to date...
 

Louis

Active Member
Licensed User
Longtime User
Hi. I am having trouble using my first very simple DLL with Basic4ppc on the device, though I haven't yet tested it on the desktop yet.
When I write and build the following code:

public class test
public function ShowMe() as string
return "This is a test to see if this really works!"
end function
end class

The project builds correctly when targetting .net CF 2.0 but Basic4ppc on the device is giving me an unclear error.
Basic4ppc Error Test.dll
It doesn't say what the error is. My device runs the .net CF 1.0 which I cannot find its SDK, so I assumed compatibility with the .net CF 2.0 and .net CF 1.0 when writing this simple code.
I am at least excited I got thus far, but can anyone tell me what's wrong? I'll try the same DLL using the desktop IDE and see if I can at least compile an app linked with this DLL.
Thanks all!
Well, the desktop references to it fine, but Basic4ppc sees no classes or objects to add.
 
Last edited:

Cableguy

Expert
Licensed User
Longtime User
Its the other way around...
If a dll target .NET CF 1.0, device running .NET CF 2.0 will run it, but if a dll targets the .NET CF 2.o the device MUST sbe running .NET CF 2.0 and the apropriate config file must be placed in the Basic4PPC folder...

In the BASIC4PPC web page there's a tutorial on how to "see" your cf version, and how to install the cf 2.0
 

dzt

Active Member
Licensed User
Some links about various .NET SDKs. Please Read carefully these pages and download the apropriate files.

http://www.microsoft.com/downloads/...99-b7b4-4f47-a244-c96d69c35dec&displaylang=en

http://www.microsoft.com/downloads/...a6-3647-4070-9f41-a333c6b9181d&displaylang=en

http://msdn2.microsoft.com/en-us/library/ms172491.aspx

http://blogs.msdn.com/onoj/archive/2004/05/01/124609.aspx

@taximania
Looks like you compiled your dll as a compact framework 2.0 dll and you didn't install .netcf 2.0 in your device. Don't forget to add YourApp.exe.config file.

@Louis
Cableguy is right. You can't run 2.0 dll in a device with .netcf 1.0. Look at links above for .netcf 1.0 sdk (I'm still not sure if it exists out of Visual Studio)

Well, the desktop references to it fine, but Basic4ppc sees no classes or objects to add.
Your class must have a constructor (a New method for vb.net) and is good to have a Dispose method. See vb.net examples posted in this thread earlier.

Pure .Net development (especially with #develop) is by far more complicated than Basic4ppc. But don't give up, your libraries are coming!
 

Cableguy

Expert
Licensed User
Longtime User
Thanks to everyone's input, especially of DZT, I'm in the fast lane on my dll creation sprea....

I'm thinking about addind some sort of string manipulation controled by a timer, from one of my inputs...and maybe have it turn on/off by a boolean...
Where in the code do I place it?
 

dzt

Active Member
Licensed User
Timer is one more control, like a button but without GUI. Add it and handle it's Tick event. Enable it or disable it, using a property like Left.
 

Cableguy

Expert
Licensed User
Longtime User
HELP!!!

I have (hopefully) one more question...

In my custom form controls I have a picturebox, wich will receive its filename from a public property called "Logo"...
how to set it?

Picturebox.image=............Logo

please fill up the blanks...!:)
 
Top