Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


Help Creating a dll


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-21-2007, 03:31 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,314
Default Help Creating a dll

Hi guys....

I decided to have it a go...but stopped right in the 1st line of code...

Im trying to create a custom control using Shap-Develop...

So I create the graphical control and now must do the code...

1st- what is the constructer syntax like?

I have ..

mycontrol obj = new mycontrol

Is this correct?

I2nd- Now I need to accept some args, 4 Strings and 1 Image name, how do I implement this?

Thanks guys....
__________________
Paulo Gomes
Porto, Portugal

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD

DLL Version Listing
Reply With Quote
  #2 (permalink)  
Old 07-21-2007, 06:21 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,314
Default

After beeing stuck for most of the afternoon, i decided to re-install vs2005 and try in it to build my dll....

As before designing the control grafic is easy but the rest...

HELP!!!

OK, putting it simple....

I'm trying to build a 4 Label, 1 image user control, wich args will only be the text for the labels and the image file name, all other props are locked....

please help...I don't want anyone doing it for me, I want to understand what i'm doing....
__________________
Paulo Gomes
Porto, Portugal

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD

DLL Version Listing
Reply With Quote
  #3 (permalink)  
Old 07-21-2007, 06:29 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,688
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

This may help. It is the simplest possible C# dll that displays and undisplays the wait cursor.

Note that the constructor is a function with the same name as the class. This constructor is a do nothing constructor as no initialisation is needed.

Quote:
Now I need to accept some args, 4 Strings and 1 Image name, how do I implement this
Replace the existing constructor (or add another) such as

Public myclassname(string s1, string s2, string s3, string s4, string image)
{
// do your initialisation
}

You can add as many constuctors as you want as long as their argument lists are different. The first constructor will be New1 in B4PPC, the next New2 and so on. For example

Public myclassname(string s1, string s2, string s3, string image)
{
// do your initialisation including setting s4 to some default or null
}
Attached Files
File Type: txt SimpleDLL.txt (742 Bytes, 55 views)
Reply With Quote
  #4 (permalink)  
Old 07-21-2007, 06:35 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,314
Default

Thanks agraham....

Do i need to declare the args before the constructer? If so where?
__________________
Paulo Gomes
Porto, Portugal

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD

DLL Version Listing
Reply With Quote
  #5 (permalink)  
Old 07-21-2007, 06:41 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,688
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Quote:
Originally Posted by Cableguy View Post
Thanks agraham....

Do i need to declare the args before the constructer? If so where?
No. They ARE being delared in the constructor argument list, you merely need to use their values in your initialisation code or store them in private local variables before the constructor returns or they are lost.
Reply With Quote
  #6 (permalink)  
Old 07-21-2007, 06:45 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,314
Default

Ok, You are beeing very helpfull....

Now the dumber question...

Do i need to worry about the font setting in the control properties?

And one last but perhaps the more inportant to me...
I'm also ading a button to the control...(It's an About Panel) shhh.....how do I implement dispose with the button click event?
__________________
Paulo Gomes
Porto, Portugal

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD

DLL Version Listing
Reply With Quote
  #7 (permalink)  
Old 07-21-2007, 06:57 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,688
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

If you are interested in coding for the .NET Framework and don't already know about Lutz Roeders' .NET Reflector then you should.

http://www.aisto.com/roeder/dotnet/

This superb utility lets you examine almost all of the .NET Framework in the language of your choice, VB.NET, C# Delphi etc. and see how Microsoft has coded it. You can also look inside the B4PPC dlls and other .NET exes to see how they are built and what they do. Download it and in case it is not obvious press the spacebar or invoke Tools -> Disassemble to see the code for the selected assembly. There are various add-ons, of variable quality, available via a link on the download page. I like FileGenerator which will produce a VS 2005 project file set, although actually getting it to compile without errors may be a battle!
Reply With Quote
  #8 (permalink)  
Old 07-21-2007, 07:09 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,688
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Quote:
Originally Posted by Cableguy View Post
Do i need to worry about the font setting in the control properties?
I don't know what control you are using but I would try it and see. I think most of the existing controls come with a default font already set.

Quote:
Originally Posted by Cableguy View Post
I'm also ading a button to the control...(It's an About Panel) shhh.....how do I implement dispose with the button click event?
I'm not sure what you mean but normally in .NET code you don't need to ever implement a disposal function as the .NET Garbage Collector will remove an object when there are no further references to it. Disposal is normally only needed when your code has acquired resources from outside .NET (like mallocing memory or interacting with non-managed dlls) that need to be explicitly freed. Doing this is unsafe code that should be avoided if at all possible as you are then losing the safe coding advantages of the .NET Framwork.
Reply With Quote
  #9 (permalink)  
Old 07-21-2007, 07:26 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,314
Default

Calling the control will pop-up( eventaully) a Panel containing the refered fields and, beiing all of them just output fields, i need to implement a way of hidding/disposing the control...that's why I added the button, but how to implement the Hide or, preferably, the dispose upon button click?

BTW-Thanks for the link, great tool...
__________________
Paulo Gomes
Porto, Portugal

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD

DLL Version Listing
Reply With Quote
  #10 (permalink)  
Old 07-21-2007, 07:41 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,314
Default

Ok, I'm/was getting confused with the amount of files created with the basic project, but i'm starting to get a hold of things...
So I implemented 1 constructer and 1 method(?) called DLLVersion...Anad build the solution....

I tryed it out and it works....well...sort of...my constructor is there and my method along with a LOT of other things that I dont know what they are, and that i didn't create....What am i doing wrong?
__________________
Paulo Gomes
Porto, Portugal

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD

DLL Version Listing
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
creating chm files Ricky D Questions & Help Needed 2 10-15-2008 11:03 AM
Creating process-real!!! Byak@ Code Samples & Tips 6 10-06-2008 02:59 PM
Creating SIP spectra9 Questions & Help Needed 2 05-21-2008 03:32 PM
Creating code faster pmu5757 Basic4ppc Wishlist 0 04-13-2008 12:33 PM
Creating additional libraries Nycran Questions & Help Needed 3 11-07-2007 05:51 AM


All times are GMT. The time now is 03:27 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0