Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create a com dll in vfp
Message
From
03/03/2006 12:36:21
Erick Miranda
Formata Data Business - Grupo Linx
Contagem, Brazil
 
 
To
03/03/2006 10:57:10
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01101265
Message ID:
01101309
Views:
11
Hi Mohammed!

Does it solve your doubt?
define class testclass as cuistom olepublic
   name="testclass"

   function testmethod
      return "it works?"
   endfunc

   PROCEDURE SetKeyboard(lcKeyboardcode as String)
      IF VARTYPE(lcKeyboardcode)<>'C'
         RETURN
      ENDIF
      IF EMPTY(lcKeyboardcode)
         RETURN
      ENDIF
      LOCAL pwSzklid
      pwSzklid = SPACE(8)
      DECLARE INTEGER GetKeyboardLayoutName IN user32.DLL STRING @
      geTkeyboardlayoutname(@pwSzklid)
      DECLARE INTEGER ActivateKeyboardLayout IN user32.DLL INTEGER, INTEGER
      IF ATC(lcKeyboardcode, pwSzklid)=0
         acTivatekeyboardlayout(1,0)
      ENDIF
      RETURN
   ENDPROC
enddefine


*- Test
oCOM = createobject('myfirstcom.testclass')
? oCom.testmethod()
? oCom.SetKeyboard(lcYourCode)
Good luck!



>hi all,
>
>i need to make code under to com dll,
>i see at UT ..example, but i have no idea how or (where) i can add the code under .
>define class testclass as cuistom olepublic
>       name="testclass"
>       function testmethod
>       return "it works?"
>enddefine
>oCOM=createobject('myfirstcom.testclass')
>?ocom.testmethod()
>this code....
>PROCEDURE SetKeyboard
> LPARAMETER lcKeyboardcode
> IF VARTYPE(lcKeyboardcode)<>'C'
>      RETURN
> ENDIF
> IF EMPTY(lcKeyboardcode)
>      RETURN
> ENDIF
> LOCAL pwSzklid
> pwSzklid = SPACE(8)
> DECLARE INTEGER GetKeyboardLayoutName IN user32.DLL STRING @
> geTkeyboardlayoutname(@pwSzklid)
> DECLARE INTEGER ActivateKeyboardLayout IN user32.DLL INTEGER, INTEGER
> IF ATC(lcKeyboardcode, pwSzklid)=0
>      acTivatekeyboardlayout(1,0)
> ENDIF
> RETURN
>ENDPROC
>thanks
Erick
Força Sempre!
Strength Always!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform