Send Whatsapp Mesasge From Visual Foxpro
I had used msg.dbf
DBF Structure :
Structure for table: MSG.DBF
Number of data records: 2
Date of last update: 10-20-2021
Code Page: 1252
Field Field Name Type Width
1 MSG Character 50
2 NUMBER Character 12
Mobile Number should written with country code without plus(+) symbol example:
format : 9198691xxxxx
Create above dbf file and add two or three records.
Create prg file
Example: modify command wamsg.prg
Code following code into wamsg.prg
Declare Integer FindWindow In WIN32API String , String
Declare Integer SetForegroundWindow In WIN32API Integer
Declare Integer ShowWindow In WIN32API Integer , Integer
Declare Integer ShellExecute In shell32.Dll ;
INTEGER hndWin, ;
STRING cAction, ;
STRING cFileName, ;
STRING cParams, ;
STRING cDir, ;
INTEGER nShowWin
SELECT 0
USE Msg
DO While !EOF()
Local lt, lhwnd
cPhone=msg.Number
ccMessage=msg.Msg
cmd='whatsapp://send?phone=&cPhone&text='+ccMessage
=ShellExecute(0, 'open', cmd,'', '', 1)
Wait "" Timeout 1
lt = "Whatsapp"
lhwnd = FindWindow (0, lt)
If lhwnd!= 0
SetForegroundWindow (lhwnd)
ShowWindow (lhwnd, 1)
ox = Createobject ( "Wscript.Shell" )
ox.sendKeys ( '{ENTER}' )
Else
Messagebox ( "Whatsapp is not activated!" )
Endif
SELECT Msg
SKIP
ENDDO
No comments:
Post a Comment
Please, Write your valuable comments..