Unofficial Content
  • This documentation is valid for:

Warning: The .NET Mobile generator has been discontinued. Refer to Native Mobile Applications Development.

Including external libraries

To use externals dlls from a .net mobile model set the model property "Compiler Flags" = /r:binmylibrary1.dll /r:binmylibrary2.dll ..... Then generate and compile again.

Changing cursor state

To change the cursor state add the following csharp commands to your source:

Csharp System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
Csharp System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;

Setting application icon

To use a custom application icon add the following text to the model property "Compiler Flags": /win32icon:customicon.ico , copy your customicon.ico to the model directory, generate and compile again.

Calling external application

There are two ways that you can call your external application: As dynamic call or With C# language statements.You can get the complete examples from the above attachment link.

a.You have your external application source at the model directory, let's say 'afvbateria.cs', with the following structure:

 using GeneXus.Application;
 using com.genexus;
 namespace GeneXus.Programs
   public class afvbateria{
     public afvbateria(IGxContext context, int hnd, ModelContext jContext):this(){... }
     public void execute(ref string var1, ref int var2....){.....}

b. If afvbateria references external libraries, then add them to the Compiler Flags property model, for exmaple Compiler Flags=/r:binanotherlibrary1.dll /r:binanotherlibrary2.dll....

c.Call the component with the following code:

 Event 'DynCall'
 call('afvbateria', &var1, &var2....)
 EndEvent  // 'DynCall'



a. You have your external application library at the bin directory of the model directory, let's say 'afvLibrary.dll'.
b. Add afvLibrary.dll to the Compiler Flags model property: Compiler Flags=/r:binafvLibrary.dll.
c. Call the component with the following code: (supposing you want to call the execute method of MyClass class)

 csharp MyLibraryNamespace.MyClass form = new MyLibraryNamespace.MyClass();
 csharp form.execute([!&var1!], [!&var2!]...);



Compacting database



Compacting database can be used to compact and reclaim wasted space that collects in the database as data and objects are deleted and tables are reindexed. It is recommended that SQLCE databases be periodically compacted because this also leads to improved query performance through index reordering and the refreshing of statistics used by the query processor to generate execution plans. Compacting a database can also be used to change the collating order,18 encryption, or password for the database. The following code compacts a database, reclaiming wasted space, and copies the newly created database back to the old name. You can get the complete example from the above attachment link.

&src = "sampledb.sdf"
&dest = "sampledb.sdf.tmp"
&dbconn = GetDataStore("Default")
&password = &dbconn.UserPassword
csharp System.Data.SqlServerCe.SqlCeEngine engine = new System.Data.SqlServerCe.SqlCeEngine("Data Source=" + [!&src!] +  ";Password=" + [!&password!]);
csharp engine.Compact("Data Source=" + [!&dest!]  + ";Password=" + [!&password!]);
csharp engine.Dispose();

If you pass an empty string for the connection string, the new database file overwrites the old database file and maintains the same name.

csharp engine.Compact(null);


csharp engine.Compact("Data Source=; Password=" + [!&password!]");


Beep function (iPAQ)

To use the Beep function, copy the following code:

Event 'beep'
   Do 'Beep'
EndEvent // 'beep'

Sub 'Beep'

csharp Beep();
csharp }
csharp [System.Runtime.InteropServices.DllImport("coredll", EntryPoint="MessageBeep", SetLastError=true)]
csharp private static extern void MessageBeep(uint type);
csharp public static void Beep(){
csharp MessageBeep(0xffffffff);


Default = 0xFFFFFFFF,
Asterisk = 0x00000040, //Sound played during an Asterisk Message Box.
Exclamation = 0x00000030,// Sound played during an Exclamation Message Box.
Question = 0x00000020, // Sound played during a Question Message Box.
Hand = 0x00000010,// Sound played during a Hand Message Box.
/ *


Beep function (Symbol MC3000) 

To use the Beep function, copy the following code:

Event Enter
    do  'Beep'
EndEvent  // Enter

sub 'Beep'
    csharp Beep();
    csharp }

    csharp static Symbol.Audio.Controller MyAudioController;

    csharp public static void Beep(){
    csharp  if (MyAudioController==null){
    csharp                  Symbol.Audio.Device
    csharp                  if(MyDevice
==null){System.Windows.Forms.MessageBox.Show("No Device Selected",
"SelectDevice"); return;}
    csharp          else{
    csharp                                  MyAudioController = new
    csharp              else if
    csharp                                  MyAudioController = new
    csharp              else{ System.Windows.Forms.MessageBox.Show("Unknown
Device Type"); return;}
    csharp          }
    csharp  }
    csharp  MyAudioController.PlayAudio(1500,2670);
    csharp  MyAudioController.Dispose();

Setup model properties:  Compiler Flags = /r:bin\Symbol.Audio.dll /r:bin\Symbol.dll  /r:bin\Symbol.StandardForms.dll
Copy the Dlls in bin directory.

Add the Dlls to "Additional Files" when deploying with F5.

Symbol Libraries

Enabled/Disable SIP by code and change Input Method

Event 'Sip'
csharp SIP.Show();
EndEvent // 'Sip'

Event 'Nosip'
csharp SIP.Hide();
EndEvent // 'Nosip'

Some devices need a diferente way of disabling the keyboard

First, you need to put the property "Simple input panel activation" = No
Event Enter
   if &SIP_visible = 0 
       &SIP_visible = 1
       csharp SipShowIM(0x1); //para prenderlo 
       csharp SipShowIM(0x0); //para apagarlo
       &SIP_visible = 0
EndEvent  // Enter

sub 'dummy'
csharp }
csharp [System.Runtime.InteropServices.DllImport("coredll.dll")]
csharp public extern static void SipShowIM(uint dwFlag);
csharp public void nada(){
Event 'SIPM'
    do  'ChangeSIPMethod'
EndEvent  // SIPM

sub 'ChangeSIPMethod'
    csharp SIPType("{42429690-ae04-11d0-a4f8-00aa00a749b9}");
    //Guid("{42429691-ae04-11d0-a4f8-00aa00a749b9}")   Block Recgonizer
    //Guid("{42429667-ae04-11d0-a4f8-00aa00a749b9}")  Standard Keyboard
    //Guid("{42429690-ae04-11d0-a4f8-00aa00a749b9}")   Letter Recognizer
    //Guid("{f0034dd0-2ad4-11d1-9cb0-e84be8000000}")  Microsoft Transcriber
    csharp }
    csharp [System.Runtime.InteropServices.DllImport("coredll.dll")]
    csharp extern static void SipSetCurrentIM(Array clsid);

    csharp public static void SIPType(string type){
    csharp  Guid clsidKbdIM = new Guid(type);
    csharp   SipSetCurrentIM(clsidKbdIM.ToByteArray());


Attachment (External call sample)

Attachment (Compacting database sample, xpz)

Last update: November 2023 | © GeneXus. All rights reserved. GeneXus Powered by Globant