Jump to content
Sign in to follow this  
Mbee

Is it possible to De-Assign an ASSIGNed variable?

Recommended Posts

I certainly accept the wisdom that holds that the Assign statement should be avoided like, say, Cobol, but I don't have a choice -- it is forced upon me. You see, the graphical debugger is rather limited, and so I'm using DBUG instead, which has many benefits (though it has the enormous downside such that the "documentation" doesn't at all deserve the name). Anyway, here's why its forced upon me: I have need of a $WM_NOTIFY message handler in my script, but DBUG uses it extensively, so that if a script also needs to handle that message, you have to let DBUG know. The mechanism the developer chose was to use the Assign statement to set the variable "dbg_NotifyFunc" to the user's handler.

Unfortunately, this still seems to interfere with DBUG because whenever my function is invoked, the script stops and a warning page comes up telling me to assign "dbg_NotifyFunc"...

I think!

It's very confusing. Here's what the message/Help file (which is essentially no help whatsoever) states on this point:

Quote


4. Processing GUIRegisterMsg
WM_NOTIFY and WM_COMMAND hook to prevent interference with possible message handlers.

To automatically hook WM_NOTIFY messages GUIRegisterMsg function
the first parameter must be specified by a constant $WM_NOTIFY,
but the function itself is located in the current script.
If these conditions are not met, it is possible to replace
the function GUIRegisterMsg following code ("MY_WM_NOTIFY" - as an example):
   If IsDeclared("dbg_NotifyFunc") Then
      Assign("dbg_NotifyFunc", "MY_WM_NOTIFY")
   Else
      GUIRegisterMsg(0x004E, "MY_WM_NOTIFY")
   EndIf
or during the debugging execute the command ("MY_WM_NOTIFY" - as an example):
   $dbg_NotifyFunc = "MY_WM_NOTIFY"

 

Huh? WTF? Why would I want to "automatically" hook WM_NOTIFY? What does that even mean? The best I could figure is as I described above -- a method to allow DBUG to register $WM_NOTIFY for itself, and after processing it internally, it invokes the user function. Does anyone have a better grasp of what that's trying to say? (part of the problem may be that perhaps English is a second language for the writer).

Anyway, back to the issue at hand. It seems to me that if I can DE-assign that variable during the majority of the code where I have no need to capture WM_NOTIFY messages, my debugging sessions will not be interrupted as often as they are now.  Thus the question of my OP: Is there any way to de-assign a variable?

Thanks!

Edited by Mbee

Share this post


Link to post
Share on other sites

Would assigning space, zero or NULL help to DE-assign the variable?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-10-10 - Version 1.5.2.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-12-15 - Version 1.6.3.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites
36 minutes ago, water said:

Would assigning space, zero or NULL help to DE-assign the variable?

I'll give it a try. Thanks!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...