|
-
Dec 14th, 1999, 11:43 AM
#1
Is my installation corrupt? I'm seeing alot of sample code with Public and when I try them, I get "...not allowed as Public members of object modules"
I put them in the General Declarations section of a Standard EXE project.
Public Declare Function GetMessagePos Lib "user32" () As Long
OR
Public Const WM_LBUTTONUP = &H202
Also, I tried two examples of AddresOf, from different people, and they both said improper usage.
Are there some project settings I need, or is my installation corrupt? Or is an object module not a module? I'm going nuts. Or do these examples only work for 90 days after buying the MS product?
-
Dec 14th, 1999, 12:28 PM
#2
Member
The good news is that your installation is not corrupt. The bad news (not really) is that public declares, constants, arrays, and user defined types are not allowed in object modules, which is another way of saying the code in a form. However, you can use public declares, constants, arrays, and user defined types in module.
Gerald M.
-
Dec 14th, 1999, 06:56 PM
#3
Member
Yup, you have to put your public items in a module (Module1.bas) etc.
-
Dec 14th, 1999, 07:15 PM
#4
Frenzied Member
You can put API declares in a form if you change the Public keyword to Private
...and remove the Public from the Const
------------------
Mark Sreeves
Analyst Programmer
[email protected]
A BMW Group Company
-
Dec 15th, 1999, 12:33 PM
#5
The reason for this is, that there can be multiple instances of the form loaded. This would cause duplicate declarations. So only variables can be declared public in the form, and they will be handled as if they were properties of the form.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|