I thought the declare section was at the top of the file. This is the first three lines of code in the file (after a couple of comments):
Declare Function SetWindowWord Lib "User" (ByVal hwnd As Integer, ByVal Index As Integer, ByVal wNewWord As Integer) As Integer
Const GWW_HWNDPARENT = (-8)
Dim OriginalParenthWnd As Integer
Everywhere else I've seen declare statements, they have been the first lines in the file. What is the syntax to declare it public? I have several examples of declares from this program and other VB programs in the suite of programs we're working on. I don't see a public keyword in any of the declare statements.
use the same declare you already have but prefix it with Public.
The declare section is at the top of the file but when you declare API functions you need to do those at the top of a module. You can of course have several of them in the same module. Just need to keep them all above any code for subs and functions.
Public Declare Function SetWindowWord Lib "User" (ByVal hwnd As Integer, ByVal Index As Integer, ByVal wNewWord As Integer) As Integer
Public Const GWW_HWNDPARENT = (-8)
Public OriginalParenthWnd As Integer
I tested your code and if I place the code if a form the app will not compile. If I place the same code in a module it compiles fine.
The example above shows how to set them public in a module.