C'est exactement ce que je fqis (après la lecture des différents posts) malheureusement, ça ne donne rien dans le simulateur dans lequel je teste avec l'application memo. J'ai mis comme code "PMem" et rien ne se fait.
J'avance tout doucement

Voilà en gros où j'en suis. Dans un module, on m'a dit de mettre ceci:
CODE
Public Const sysNotifyAppLaunchingEvent as string="PAdd"
Public Const sysTrapDmDatabaseInfo as Long=&HA046
Public Declare function DmDatabaseInfo(Byval cardNo as Integer, Byval dbID as Long, byref nameP as String, byref attributesP as Integer, byref versionP as Integer, byref crDateP as Long,byref modDateP as Long, byref bckUpDateP as Long,byref modNumP as Long, byref appInfoIDP as Long,byref sortInfoIDP as Long, byref typeP as Long,byref creatorP as Long) as Integer Trap sysTrapDmDatabaseInfo
Ceci devait permettre de s'accrocher aux événements de l'application sysNotifyAppLaunchingEvent (donc ici l'application contact).
Dans ma classe "principale", j'utilise ceci:
CODE
Private Sub Application_SyncNotify()
RegisterExtension sFileExtension
RegisterNotify hbNotifySyncStartEvent
RegisterNotify hbNotifyMenuCmdBarOpenEvent
RegisterNotify hbNotifyCardInsertedEvent
RegisterNotify hbNotifyCardRemovedEvent
RegisterNotify hbNotifyDBDeletedEvent
RegisterNotify hbNotifyDBCreatedEvent
RegisterNotify hbNotifyDBChangedEvent
RegisterNotify hbNotifyDBDirtyEvent
RegisterNotify hbNotifyAppLaunchingEvent
RegisterNotify hbNotifyAppQuittingEvent
' Register our application for our extension
RegisterExtension "vcf"
End Sub
Je demande à mon application de réagire à plusieurs Notify (bien sûr c'est un test, au final il y en aura beaucoup moins).
Enfin, pour traiter les notify, j'utilise :
CODE
Private Sub Application_Notify(ByVal eNotify As HbNotify, ByRef bHandled As Byte, ByVal objParams As StreamMemory, ByVal lUserData As Long)
Select Case eNotify
Case hbNotifySyncStartEvent
' TODO: insert your code here
Case hbNotifyMenuCmdBarOpenEvent
' TODO: insert your code here
Case hbNotifyCardInsertedEvent
' TODO: insert your code here
Case hbNotifyCardRemovedEvent
' TODO: insert your code here
Case hbNotifyDBDeletedEvent
' TODO: insert your code here
Case hbNotifyDBCreatedEvent
' TODO: insert your code here
Case hbNotifyDBChangedEvent
' TODO: insert your code here
Case hbNotifyDBDirtyEvent
' TODO: insert your code here
Case hbNotifyAppLaunchingEvent
' TODO: insert your code here
If eNotify = creatorToLong(sysNotifyAppLaunchingEvent) Then
Dim version as Long
Dim dbID as Long
Dim cardNo as Integer
Dim creatorID as Long
dim PADDING as integer
objParams.Read version
objParams.Read dbID
objParams.Read cardNo
objParams.READ PADDING
Dim szDBName as string
Dim di as New DatabaseInfo
di.LocalID = dbID
MsgBox (di.Name)
' szDBName=Space(32)
' DmDatabaseInfo cardNo ,dbID,szDBName,0,0,0,0,0,0,0,0,0,creatorID
'
' if Trim(szDBName)<>"" then
' Msgbox szDBName & " launched!"
' End if
bHandled =1
End If
Case hbNotifyAppQuittingEvent
' Msgbox "Action B"
' TODO: insert your code here
End Select
End Sub
Je sais que mon application réagit bien au notify car tester avec des actions simples comme afficher une boite de dialogue suivant le notify. Là où ça ne fonctionne plus, c'est lorsque je veux faire quelque chose en fonction de la "provenance" du notify. Je suis encore tout frais sur HB++ et le Palm donc le problème peut venir de moi