get application icon

Module('WINAPI')
  FindExecutable(LONG,LONG,LONG),LONG,PASCAL,RAW,Name('FindExecutableA')
END
....

DATA
l:Executable         CSTRING(255)
l:FileName           CSTRING(255)

CODE
  ...
  l:FileName = 'test.txt'
  ret# = FindExecutable(address(l:FileName),0 , address(l:Executable))
  if l:Executable then
    ?Image1{Prop:Text} = l:Executable & '[]'
  else
    ?Image1{Prop:Text} = ICON:Hand  ! no icon found
  end
 ...

time since last reboot

Try GetTickCount: – You can use this to tell how long the computer has been running – From there you can calculate when the last reboot happened.

http://msdn.microsoft.com/library/en-us/sysinfo/base/gettickcount.asp

GetTickCount(),Long,PASCAL,proc,NAME('GetTickCount'),Dll(dll_mode)

local               group, pre(loc)
UpTime                long
UpDays                long
UpHours               long
UpMins                long
                    end


    loc:UpTime = GetTickCount()
    loc:UpDays = (((loc:UpTime / 1000) / 60) / 60) / 24
    loc:UpHours = (((loc:UpTime / 1000) / 60) / 60) % 24
    loc:UpMins = (((loc:UpTime / 1000) / 60) % 60)

Can display something like this:

 ' Up_Time = ' & loc:UpDays & 'd ' & loc:UpHours & 'h ' & format(loc:UpMins, @N02) & 'm'

Cheers
Jono Woodhouse

use the entire screen

Globall embed: Inside The Global Map

Module('User32.dll')
    SetWindowPos(LONG,LONG,SIGNED,SIGNED,SIGNED,SIGNED,LONG),BOOL,PASCAL
    GetWindowLong(LONG,SIGNED),LONG,PASCAL,NAME('GetWindowLongA')
    SetWindowLong(LONG,SIGNED,LONG),LONG,PASCAL,NAME('SetWindowLongA')
End

In INIT of the frame right after opening the window:

OrgStyle# = GetWindowLong(0{PROP:Handle},-16)
OrgStyle# = BXOR(OrgStyle#,0C00000H)
NewStyle# = SetWindowLong(0{PROP:Handle},-16,OrgStyle#)
r# = SetWindowPos(0{PROP:Handle},0,0,,,24h)

To find Max values i guess you can first do a 0{PROP:Maximized} = True and use the API GetWindowPos to read the Window size. Dont use
GetPosition(0,X,Y,W,H) because if you uses toolbars the WindowSize is redused. Using GetWindowPos will give you the correct size.


Ole-Morten Heien

——————————————————————————
Question:

> With a standard Clarion application (app frame, etc), how do I get a
> procedure to use the entire screen, not just the app window?
>
> This is for a POS application which I want to appear as a normal
> Windows application, EXCEPT when it it running as a cash register.
> The cash register procedure should use the entire screen.
>
> Can’t seem to find the right combination of settings, or whatever.

enumerate menu items

You have to use PROP:NextField, here’s a small example. In it I’m enumerating the menu and storing the structure and properties in a queue.

  ThisField   LONG,AUTO
  CODE
  FREE(mQ)
  ThisField = 0
  LOOP
    ThisField = SELF.W{PROP:NextField, ThisField}  !Get the next feq out of the array
    IF ThisField = 0 THEN BREAK.                    !done when the feq is zero again

    CASE SELF.W $ThisField{PROP:Type}
    OF CREATE:MenuBar OROF CREATE:Menu OROF CREATE:Item
      SELF.GetMenuItemProperties(mQ, ThisField)
      IF mQ.pType = CREATE:MenuBar
        SELF.MenuBarFeq = mQ.Feq
      END
      ADD(mQ, -mQ.ParentFeq, -mQ.Feq)
      ...
    END
  END

Cheers,
Larry Sand

app for russian language

Tanya Lumkis:

I have an app that supports some multi-langual capabilities on certain fields. I allow the user to dynamically change to a number of
languages (Russian, Greek, English, Vietnamese).

Depending up what business functions the your app will undertake you will need to change the charater set at the appilcation or window level. Or you can change it for individual fields as required.

      SetFont(0,,,,,Charset:Cyrillic)
      SetFont(?Some:FieldName,,,,,Charset:Cyrillic)

If you are using the email templates i’ve found using a variable to
define the language allows the user to dynamically change the language
setting.

 Local:Language = '/plain;charset="iso-8859-5"'
 charset="iso-8859-1=5' will need to be inserted 
 Message.AddBody(Some:Field,Content:text,clip(Local:Language,QuotedPrintable.IEncoder)

You will find that the Cyrillic character set should still support the latin based alphabet as well.

I also have found that choosing a unicode font (like Lucinda Unicode) will help.

If you are using Win2000 or XP you can add Russian as one of the languages and switch to the Russian to check that display and entry etc. works. (To input Russian characters use the On-Screen Keyboard if you don’t have a dual mode keyboard)

Of course if your Russian clients are running the Russian version of Windows they won’t have too many problems. You will find that using the dictionary to scan any files will not display the correct character set unless you have Russian Windows. However, when you display the records with the character set = cyrillic they will display correctly.

The clarion help does have an explanation of character sets under Fonts.
Also you can check out http://www.iso.org (International Standards Org) and http://www.ietf.org/ for info on character sets and the Internet.

Hope this is of some help.
Tanya

get logical drives

!------------------------------------------------------------------------------------------
! inside the global map
!------------------------------------------------------------------------------------------
Module('WINAPI')
   GetLogicalDrives(),ULONG,PASCAL
   GetLogicalDriveStrings(LONG,*CSTRING),LONG,PASCAL,RAW,NAME('GetLogicalDriveStringsA')
   GetDriveType(*CSTRING),UNSIGNED,PASCAL,RAW,NAME('GetDriveTypeA')
END

!------------------------------------------------------------------------------------------
! DATA
!------------------------------------------------------------------------------------------
qDrive               QUEUE,PRE(qDrive)
Drive                CSTRING(5)
qDrive:Desciption    CSTRING(40)
Type                 BYTE
                     END
l:DrivesCString      CSTRING(200)
l:DrivesLen          LONG

!------------------------------------------------------------------------------------------
! CODE
!------------------------------------------------------------------------------------------
   l:DrivesDWORD   = GetLogicalDrives()
   l:DrivesLen     = 200
   l:DrivesCString = '<0>{200}'
   l:DrivesString  = ''
   clear(qDrive)
   free(qDrive)
   ret# = GetLogicalDriveStrings(l:DrivesLen,l:DrivesCString)
   loop i# = 1 to 200
     if val(l:DrivesCString[i#]) > 20 then
       qDrive:Drive = qDrive:Drive & l:DrivesCString[i#]
     else
       if qDrive:Drive then
         qDrive:Type = GetDriveType(qDrive:Drive)
         case qDrive:Type
           of 0;  qDrive:Desciption = 'The drive type cannot be determined.'
           of 1;  qDrive:Desciption = 'The root directory does not exist.'
           of 2;  qDrive:Desciption = 'removable drive'
           of 3;  qDrive:Desciption = 'fixed drive'
           of 4;  qDrive:Desciption = 'network drive'
           of 5;  qDrive:Desciption = 'CDROM drive'
           of 6;  qDrive:Desciption = 'ramdisk'
         end
         add(qDrive)
         clear(qDrive)
       end
     end
   end

play wav file

! inside the global map
Module('WINAPI')
   SndPlaySound(*LPCSTR,UNSIGNED),BOOL,PROC,PASCAL,RAW,NAME('SndPlaySoundA')
END

! data
l:SoundFile cstring(255)

! code
  l:SoundFile = 'test.wav'
  SndPlaySound(l:SoundFile,1)  ! play sound and return
  SndPlaySound(l:SoundFile,0)  ! play sound and wait

get computername and user

! inside the global Map
Module('WINAPI')
   GetComputerName(*CSTRING,*ULONG),SIGNED,RAW,PASCAL,NAME('GetComputerNameA')
   WNetGetUser(ULONG,*CSTRING,*ULONG),LONG,RAW,PASCAL,NAME('WNetGetUserA')
END

! data
WIN:Computername CSTRING(32)
WIN:Computerlen  ULONG
WIN:User         CSTRING(32)
WIN:Userlen      ULONG
WIN:Net          ULONG

! code
  WIN:Computerlen = 32
  WIN:Userlen     = 32
  ret# = GetComputerName(WIN:ComputerName,WIN:Computerlen)  ! get the computername
  ret# = WNetGetUser(WIN:Net,WIN:User,WIN:Userlen)          ! get the current user

override message function before closedown

Close your application immediately without any messagebox like „Record changed, save?“.

!------------------------------------------------------------------------------------------
! hook prototype
mmessage (STRING,,,,UNSIGNED=0,BOOL=FALSE),UNSIGNED,PROC ! hook message

!------------------------------------------------------------------------------------------
! Hook procudure
mmessage  function(msg,tit,ico,but,def,sty)
 code
 return(BUTTON:NO)


!------------------------------------------------------------------------------------------
! hook messagebox and now close the app
 system{Prop:MessageHook} = address(mmessage)
 post(Event:CloseDown,,1)