Forum Discussion

scsvel's avatar
scsvel
Frequent Contributor
13 years ago

Getting Cursor property

Hi all,



Can anyone give me example code to get the Cursor property. Help file shows, I have to use to Cursor property for a component object.

So can I pass whatever controls available in my window?



Please give me sample code....

8 Replies

  • scsvel's avatar
    scsvel
    Frequent Contributor
    Thanks Alex...



    I used the code you mentioned like, 



        var dDLL = DLL.DefineDLL("USER32");

        var dProc = dDLL.DefineProc("LoadCursorW", vt_i4, vt_ui2, vt_i4);

        var lib = DLL.Load("USER32.DLL", "USER32");

        global_cache[cursorID] = lib.LoadCursorW(0, cursorID);        



    above code is part of  loadCursor(cursorId).



    Its working fine and returning my cursor type. But always TC logs warnings like "A function with specified name is already defined". 

    So I changed my functionName to "LoadCursorA" from "LoadCursorW". But no luck..



    How can I suppress those warnings?



    Thanks...
  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    Hi
    Shanmugavel,



    Add the 'DefineAlias' line after 'DefineProc' one:



        var dDLL = DLL.DefineDLL("USER32");


        var dProc = dDLL.DefineProc("LoadCursorW", vt_i4, vt_ui2, vt_i4);


        dDLL.DefineAlias("LoadCursor", "LoadCursorW");


        var lib = DLL.Load("USER32.DLL", "USER32");


        global_cache[cursorID] = lib.LoadCursor(0, cursorID);        
  • scsvel's avatar
    scsvel
    Frequent Contributor
    Hi Alex,



    Still I am getting the Warning message. Any Ideas?



    Thanks...
  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    Hi
    Shanmugavel,



    What code line results in the warning in the log?

    Can it be that your code defines the function twice?
  • scsvel's avatar
    scsvel
    Frequent Contributor
    No Alex, I have one time only ...Here is my code.




    function loadCursorNum(cursorID)

    {

      try {

        global_cache.length

      }

      catch (e) {

        global_cache = new Array();

      }

     

      if (null == global_cache[cursorID]) {            

        var dDLL = DLL.DefineDLL("USER32");

        var dProc = dDLL.DefineProc("LoadCursorW", vt_i4, vt_ui2, vt_i4);

        dDLL.DefineAlias("LoadCursor", "LoadCursorW"); 

        var lib = DLL.Load("USER32.DLL", "USER32");

        global_cache[cursorID] = lib.LoadCursor(0, cursorID);        

      }

      

      return global_cache[cursorID]; 

    }




    But still I am getting warning messages in line

    dDLL.DefineProc.....

    Can u look this?



    Thanks...

  • Hi Shanmugavel,





    Reproduce the problem, pack the folder containing your project suite and post the archive - I think, we're missing a crucial detail here.


  •   var dDLL = DLL.DefineDLL("USER32");

        var dProc = dDLL.DefineProc("LoadCursorW", vt_i4, vt_ui2, vt_i4); 



    add these as global variables. this worked for me.