Announcement

Collapse
No announcement yet.

unload a cursor

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • unload a cursor

    I have a group of applications (dlls) all done in ddt.
    One loads 2 cursors. When i exit this application and return to the menu,
    and go to some of the other applications within the menu, one of the
    previously loaded cursors shows up.

    How do i get rid of (unload) the cursors when i exit the application that
    initially sets them up. I have them in a resource file in the application that
    loads them.

    the following code is what i use to initially set them up.
    Code:
      STATIC hCurZoom AS DWORD
      STATIC hCurZoomO AS DWORD
      STATIC hCursor1 AS DWORD
      STATIC hPreview AS DWORD
      STATIC GraphicHandle AS LONG
      STATIC cursorname AS ASCIIZ * 255
      STATIC cursorname2 AS ASCIIZ * 255
      STATIC modulename AS ASCIIZ * 255
      STATIC hCtrl&
      STATIC disable1&
      cursorname="ZOOMIN"
      cursorname2="ZOOMOUT"
      modulename="WUXPRNT.DLL"
     .
     .
     .
       
        CASE %WM_INITDIALOG
           hCurZoom  = LoadCursor(GetModuleHandle(modulename), Cursorname) 
           hCurZoomO  = LoadCursor(GetModuleHandle(modulename), Cursorname2) 
          hPreview = GetDlgItem(hDlgPreview, %IDC_Graphic1) 
          hCursor1 = GetClassLong(hPreview, %GCL_HCURSOR)
          SetClassLong hPreview, %GCL_HCURSOR, hCurZoom 
          PageBeingViewed&=1
          PagesPreviewed&=1
    
          lResult&=previewit(coid$,pagesPreviewed&)
          CONTROL DISABLE hDlgPreview,%IDC_GRAPHIC1
    I have tried doing the following on exiting the dialog but it doesnt seem to
    help
    Code:
            CASE 306 'cancel
              .
              .
              .
              setcursor %IDC_ARROW
              DIALOG END hDlgPreview,1
    Last edited by Fred Buffington; 21 Oct 2008, 04:20 PM.
    Client Writeup for the CPA

    buffs.proboards2.com

    Links Page

  • #2
    Just a swag from looking at my URL procedure.

    Reload the arrow?

    Code:
          '---Load the cursor
          GetWindowsDirectory z, SizeOf(z)
          z = z & "\winhlp32.exe"
          If IsFalse hCurHand Then
              hLib = LoadLibrary(z)
              If hLib Then
                  hCurHand = LoadCursor(hLib, "#106") '<---Findvalue for IDCARROW in Shell32.dll or Winhlp32.exe
                  FreeLibrary hLib
              End If
          End If
    Scott Turchin
    MCSE, MCP+I
    http://www.tngbbs.com
    ----------------------
    True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

    Comment


    • #3
      Thanks Scott but I couldn't get that to help.

      The only time it seems to do it is on maintenance apps where i have set
      tooltips. The zoomin cursor shows up instead of the arrow. Otherwise
      it remains an arrow.

      I also tried
      DestroyCursor hCurZoom
      DestroyCursor hCurZoomO

      which didnt help.

      Here's one more thing.
      Under %WM_DESTROY
      i have
      Code:
            DestroyCursor hCursor1
            DestroyCursor hCurZoom
            DestroyCursor hCurZoomO
            hCursor1 = GetClassLong(hPreview, %GCL_HCURSOR)
            SetClassLong hPreview, %GCL_HCURSOR, %IDC_ARROW
            
            CALL SetCursor(LoadCursor(%NULL, BYVAL %IDC_ARROW))   'Reset Cursor
      this works perfectly. The zoom cursor does not show up in the maintenance application when displaying tooltips.

      The Cancel and Print options use the same commands before (and tried after) the DIALOG END statement but it
      doesn't get rid of the zoom cursor when i go to the maintenance app.
      Last edited by Fred Buffington; 21 Oct 2008, 05:52 PM.
      Client Writeup for the CPA

      buffs.proboards2.com

      Links Page

      Comment


      • #4
        I was able to do it but I feel it's not the best way.

        I included Arrow_1.CUR in my resouce file then
        put the following before the graphic window end
        Code:
              Cursorname="Arrow_1"
              hCurZoom  = LoadCursor(GetModuleHandle(modulename), Cursorname) 
              hCurZoomO  = LoadCursor(GetModuleHandle(modulename), Cursorname) 
              hPreview = GetDlgItem(hDlgPreview, %IDC_Graphic1) 'PREVIEW)
              hCursor1 = GetClassLong(hPreview, %GCL_HCURSOR)
              SetClassLong hPreview, %GCL_HCURSOR, hCurZoom 'Cursor2
        Then used the
        CALL SetCursor(LoadCursor(%NULL, BYVAL %IDC_ARROW))
        after the Graphic Window End and before DIALOG END.
        Client Writeup for the CPA

        buffs.proboards2.com

        Links Page

        Comment

        Working...
        X