Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
One for the VFP whiz kids
Message
De
18/01/2005 17:28:04
 
 
À
18/01/2005 11:16:03
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
00977520
Message ID:
00978351
Vues:
34
This message has been marked as a message which has helped to the initial question of the thread.
>Thank you Herman. I'll explore the site. I hope the tsunami aid your country needs is getting to your people.

Grady,

Thank you very much for the tsunami aid, and I am hoping the same thing. Also thanks to all, who's helping our country from this disaster. Disaster by disaster, tragedy after tragedy....<*SIGH*>

Well... back to the thread, I had that example for more than a year, but haven't really take a look into the code and I'm kind of busy for this week. Anyway, I took a look deeper this time. Like Anatoliy has mentioned, it's not so easy to convert to VFP. Here is the code to set the microphone mute ON/OFF:
*********
*** Mic_Mute.PRG
*********
Declare Long mixerClose in WinMM Long hMixer
Declare Long mixerOpen in WinMM ;
   Long @hMixer, Long nMxId, Long dwCallback, ;
   Long dwInstance, Long dwOpenFlags

Declare Long mixerGetLineInfo in WinMM ;
   Long hMxObj, String @cMxLine, Long dwInfoFlags

Declare Long mixerGetLineControls in WinMM ;
   Long hMxObj, String @cMxLineControl, Long dwControlsFlags

Declare Long mixerSetControlDetails in WinMM ;
   Long hMxObj, String @cMxControlDetail, Long dwDetailFlags

Declare Long RtlMoveMemory in Kernel32 as Copy2Mem ;
   Long pDest, String @cSource, Long nLength

Declare Long RtlMoveMemory in Kernel32 as CopyMem ;
   String @cDest, Long pSource, Long nLength

Declare Long LocalAlloc in Kernel32 Long uFlags, Long dwBytes
Declare Long LocalFree in Kernel32 Long hMem

If SetMicMute( .T. )
   Wait 'Mute is ON. Press any key to turn OFF...' window
endif

If SetMicMute( .F. )
   Wait 'Mute is OFF' window nowait
endif

Clear Dlls



******************
**  Procedure for muting microphone
**
**  Return value:
**     .T. = succeed
**     .F. = failed
******************

Function SetMicMute( tl_Mute )
   Local lh_Mixer, lp_Buffer
   Local lc_MxControlDetail, lc_MxLine, lc_MxLineControl, lc_LineId
   Local ll_Success

   lh_Mixer = 0
   If (mixerOpen( @lh_Mixer, 0, 0, 0, 0 ) == 0)
      lc_MxLine = padr( Num2DWord( 168 ) + replicate( chr(0), 20 ) + ;
         Num2DWord( 4099 ), 168, chr(0) )
      If (mixerGetLineInfo( lh_Mixer, @lc_MxLine, 3 ) == 0)

         lp_Buffer = LocalAlloc( 64, 148 )
         If (lp_Buffer != 0)
            lc_MxLineControl = Num2DWord( 24 ) + substr( lc_MxLine, 13, 4 ) + ;
               Num2DWord( 0x20010002 ) + Num2DWord( 1 ) + ;
               Num2DWord( 148 ) + Num2DWord( lp_Buffer )

            If (mixerGetLineControls( lh_Mixer, @lc_MxLineControl, 2 ) == 0)
               lc_LineId = space(4)
               CopyMem( @lc_LineId, lp_Buffer+4, 4 )
               lc_MxControlDetail = Num2DWord( 24 ) + lc_LineId + chr(1) + ;
                  replicate( chr(0), 7 ) + Num2DWord( 4 ) + Num2DWord( lp_Buffer )

               Copy2Mem( lp_Buffer, iif( tl_Mute, Num2DWord( 1 ), Num2DWord( 0 )), 4 )
               ll_Success = (mixerSetControlDetails( lh_Mixer, @lc_MxControlDetail, 0 ) == 0)
            endif

            LocalFree( lp_Buffer )
         endif
      endif
      mixerClose( lh_Mixer )
   endif

   Return ll_Success
EndFunc
Thanks again for the aid and best regards
Herman
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform