By default, the compiler will search for #INCLUDE files in the path specified by the /I option (also see the OPTIONS dialog in the IDE), before it searches the current directory.
To instruct the compiler to search the current folder first, prefix your /I path with ".;" (the period indicates the current directory, and the semicolon acts as a seperator between paths). For example:
.;C:\PBDLL\WINAPI;C:\PROJECT\SOURCE\;
------------------
Lance
PowerBASIC Support
mailto:[email protected][email protected]</A>
Announcement
Collapse
No announcement yet.
Problem with EnumWindows
Collapse
X
-
Guest replied
Well, several things seemed to have corrected the problem.
First, I deleted the newer WIN32API.INC that was in the same
directory as the source code .BAS files.
Then, I searched the WIN32API.INC file in my WINAPI directory
with Notepad instead of the PB IDE and found a declare for
ENUMWINDOWS without the alias. I deleted it and put the declare
from my source code into that file, searched my hard drive
for other instances, found none. Recompiled and all is well.
Thanks for the quick responses.
Ben
------------------
Leave a comment:
-
Guest repliedSure, it's too strange. I agree with what you said about the CAPS
and the alias.
Here's the code that causes the no entry point error (Using copy and paste for accuracy)
$COMPILE EXE "c:\test.exe"
$INCLUDE "WIN32API.INC"
FUNCTION WinMain (BYVAL CurInst AS LONG, BYVAL PrvInst AS LONG, CmdLine AS ASCIIZ PTR, BYVAL CmdShow AS LONG) EXPORT AS LONG
Dim RV as Long
RV = EnumWindows(CODEPTR(EnumWindowsProc), 0)
END FUNCTION
FUNCTION EnumWindowsProc(BYVAL lHandle AS LONG, BYVAL lNotUsed AS LONG) AS LONG
EnumWindowsProc = 1
END FUNCTION
Here's the code that works: (Again, Ctrl-C, Ctrl-V)
$COMPILE EXE "c:\test.exe"
DECLARE FUNCTION EnumWindows LIB "USER32.DLL" ALIAS "EnumWindows" (BYVAL lpEnumFunc AS LONG, BYVAL lParam AS LONG) AS LONG
FUNCTION WinMain (BYVAL CurInst AS LONG, BYVAL PrvInst AS LONG, CmdLine AS ASCIIZ PTR, BYVAL CmdShow AS LONG) EXPORT AS LONG
Dim RV as Long
RV = EnumWindows(CODEPTR(EnumWindowsProc), 0)
END FUNCTION
FUNCTION EnumWindowsProc(BYVAL lHandle AS LONG, BYVAL lNotUsed AS LONG) AS LONG
EnumWindowsProc = 1
END FUNCTION
------------------
Leave a comment:
-
Can you post the complete code please, or is the code in the 1st message the *exact* code you tried with?
The following code (per your original message, and sans the filename in #COMPILE) works perfectly for me!
Code:#COMPILE EXE #INCLUDE "WIN32API.INC" FUNCTION WINMAIN (BYVAL CurInst AS LONG, BYVAL PrvInst AS LONG, CmdLine AS ASCIIZ PTR, BYVAL CmdShow AS LONG) EXPORT AS LONG DIM RV AS LONG RV = EnumWindows(CODEPTR(EnumWindowsProc), 0) END FUNCTION FUNCTION EnumWindowsProc(BYVAL lHandle AS LONG, BYVAL lNotUsed AS LONG) AS LONG EnumWindowsProc = 1 END FUNCTION
------------------
Lance
PowerBASIC Support
mailto:[email protected]com[email protected]</A>
Leave a comment:
-
Guest repliedI did quote the error message verbatim.
When I remove that declaration from the WIN32API.INC, I get
Error 516 DefType etc., etc. when I try to compile.
I removed the $INCLUDE "WIN32API.INC" from my code
and copied the declaration for EnumWindows directly
into my source and now the program works.
The declare line again:
DECLARE FUNCTION EnumWindows LIB "USER32.DLL" ALIAS "EnumWindows" (BYVAL lpEnumFunc AS LONG, BYVAL lParam AS LONG) AS LONG
Any ideas as to why? I'd rather the declare line
stay in the WIN32API.INC file for use by other projects.
Thanks,
Ben
Leave a comment:
-
Ben, if you quoted the error message accurately, then there cannot be an ALIAS clause in the declaration your code is actually using (since the function name is shown as capilatized).
Are you sure the code is using the correct declaration? The one you posted is correct, but maybe your code is really using another declaration.
Also, your code is shown to be compiled to a specific directory, which may not necessarily the current directory.
Therefore, if you use BUILD+EXECUTE from within the IDE, then maybe you are unwittingly running an "older" version of your code that happens to be residing in the current directory (rather than the compiled code that is sitting in another directory...???)
Note that the IDE will likely handle this situation in the future, but the current edition does not support the paths in the #COMPILE meta-statement.
I hope this helps...
------------------
Lance
PowerBASIC Support
mailto:[email protected][email protected]</A>
Leave a comment:
-
Problem with EnumWindows
The following code compiles just fine, but returns
the following error message:
"The procedure entry point ENUMWINDOWS could not be
located in the dynamic link library USER32.DLL."
Any Ideas?
Running Windows 2000 and PB/DLL 5.0
Same code runs great under VB
Checked with Depends and found the entry point for the function
$COMPILE EXE "c:\test.exe"
$INCLUDE "WIN32API.INC"
FUNCTION WinMain (BYVAL CurInst AS LONG, BYVAL PrvInst AS LONG, CmdLine AS ASCIIZ PTR, BYVAL CmdShow AS LONG) EXPORT AS LONG
Dim RV as Long
RV = EnumWindows(CODEPTR(EnumWindowsProc), 0)
END FUNCTION
FUNCTION EnumWindowsProc(BYVAL lHandle AS LONG, BYVAL lNotUsed AS LONG) AS LONG
EnumWindowsProc = 1
END FUNCTION
My WIN32API.INC has the following declaration for the function:
DECLARE FUNCTION EnumWindows LIB "USER32.DLL" ALIAS "EnumWindows" (BYVAL lpEnumFunc AS LONG, BYVAL lParam AS LONG) AS LONG
Thanks,
Ben Rathbone
Tags: None
Leave a comment: