PlanetSquires Forums

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: FF3 - Suspicious Pointer Assignment  (Read 954 times)

SeaVipe

  • Senior Member
  • ***
  • Posts: 364
  • Windows 10
FF3 - Suspicious Pointer Assignment
« on: July 17, 2019, 07:42:07 PM »

Hello,


I can't get rid of the compiler warning "Suspicious Pointer Assignment" generated by the code below:


Code: [Select]

Function FRMTASKEDITOR_CUSTOM ( _
                              hWndForm      as HWnd, _      ' handle of Form
                              wMsg          as UInteger,  _  ' type of message
                              wParam        as WPARAM, _    ' first message parameter
                              lParam        as LPARAM   _   ' second message parameter
                              ) as Long
    Select Case wMsg
        Case WM_NOTIFY
            Dim lpNmh  as NMHDR Ptr
            lpNmh => lParam ' <- Suspicious Pointer assignment warning.
            ' or
            lpNmh = lParam ' <- Suspicious Pointer assignment warning.


The code works correctly but the warnings are there regardless of what I try. Researched on FB forum also.
Using this line as an example resulted in a syntax error:
Code: [Select]
LPWSTR = Cptr(LPWSTR, RT_RCDATA)
Any ideas would be helpful, thanks...
Clive
Logged
Clive Richey
*“You Either Have To Be Part Of The Solution, Or You’re Going To Be Part The Problem.” Eldridge Cleaver.
#StaySafe, Always  Keep A Safe #SocialDistance, #WashYourHands Often and please, #StayHome!

José Roca

  • Guru Member
  • *****
  • Posts: 3271
Re: FF3 - Suspicious Pointer Assignment
« Reply #1 on: July 17, 2019, 07:57:27 PM »

Use lpNmh = CAST(NMHDR PTR, lParam)

SeaVipe

  • Senior Member
  • ***
  • Posts: 364
  • Windows 10
Re: FF3 - Suspicious Pointer Assignment
« Reply #2 on: July 17, 2019, 08:05:37 PM »

Works! Thanks José,


I tried (almost) that code previously but got an error because I didn't use PTR correctly.
Logged
Clive Richey
*“You Either Have To Be Part Of The Solution, Or You’re Going To Be Part The Problem.” Eldridge Cleaver.
#StaySafe, Always  Keep A Safe #SocialDistance, #WashYourHands Often and please, #StayHome!