Expected identifier, found 'DWORD'

General FreeBASIC programming questions.
lassar
Posts: 300
Joined: Jan 17, 2006 1:35
Contact:

Expected identifier, found 'DWORD'

Postby lassar » Oct 21, 2018 16:44

Am using this code and got this compiler error.

Command executed:
"F:\FreeBASIC\fbc.exe" -s gui dish.rc "F:\RadioTelephone-Tutor-Work-Folder\WinTutor-Source-Code\detect-fullscreen.bas"

Compiler output:
F:\FreeBASIC\inc\win\windef.bi(217) error 14: Expected identifier, found 'DWORD' in 'dwLowDateTime as DWORD'
F:\FreeBASIC\inc\win\winnt.bi(270) error 14: Expected identifier, found 'DWORD' in 'LowPart as DWORD'
F:\FreeBASIC\inc\win\winnt.bi(276) error 14: Expected identifier, found 'DWORD' in 'LowPart as DWORD'
F:\FreeBASIC\inc\win\winnt.bi(288) error 14: Expected identifier, found 'DWORD' in 'LowPart as DWORD'
F:\FreeBASIC\inc\win\winnt.bi(294) error 14: Expected identifier, found 'DWORD' in 'LowPart as DWORD'
F:\FreeBASIC\inc\win\winnt.bi(306) error 14: Expected identifier, found 'DWORD' in 'LowPart as DWORD'
F:\FreeBASIC\inc\win\winnt.bi(373) error 14: Expected identifier, found 'DWORD' in 'Flink as DWORD'
F:\FreeBASIC\inc\win\winnt.bi(389) error 14: Expected identifier, found 'DWORD' in 'Uniquifier as DWORD'
F:\FreeBASIC\inc\win\winnt.bi(979) error 17: Syntax error, found 'DWORD' in 'const STATUS_WAIT_0 = cast(DWORD, &h00000000)'
F:\FreeBASIC\inc\win\winnt.bi(980) error 17: Syntax error, found 'DWORD' in 'const STATUS_ABANDONED_WAIT_0 = cast(DWORD, &h00000080)'
F:\FreeBASIC\inc\win\winnt.bi(980) error 132: Too many errors, exiting

Results:
Compilation failed

System:
FBIde: 0.4.6
fbc: FreeBASIC Compiler - Version 1.05.0 (01-31-2016), built for win32 (32bit)
OS: Windows NT 6.2 (build 9200)





How do I fix this error, and keep from getting this error in the future?


Code from https://www.freebasic.net/forum/viewtopic.php?t=8872

Code: Select all


'detect fullscreen mode, Windows only, fbgfx and console
' compile gui (if using screen) or console
' requires fb v17b >= Jan 2007
'
#include once "windows.bi"
'

dim as integer fullscreen = FALSE
declare function isfullscreen() as integer
declare function GetHWnd(pid as integer=0) As HWND
'
'screen 13 'try with and without gui
'
while inkey<>chr(27)' "Esc" to end
'
   print time,
   '
   fullscreen=isfullscreen
   if fullscreen=TRUE then
      print "fullscreen"
   else
      print "normal"
   end if
   '
   sleep 1000
'
wend
'
end
'
function isfullscreen() as integer
'
   dim as integer w,h
   dim as RECT wrect
   dim as HWND hwnd
   '
   hwnd=GetHwnd
   if hwnd<=0 then hwnd=GetForegroundWindow
   '
   w = GetSystemMetrics(SM_CXSCREEN)
   h = GetSystemMetrics(SM_CYSCREEN)
   '
   if Screenptr>0 then
      GetWindowRect(hwnd,@wrect)
      if w=(wrect.right-wrect.left) then
         if h=(wrect.bottom-wrect.top) then
            'print "fullscreen"
            return TRUE
         end if
      else
         'print "normal"
         return FALSE
      end if
   else
      GetWindowRect(hwnd,@wrect)
      if wrect.right<0 _
         or _
               (w=(wrect.right-wrect.left) _
            and _
                h=(wrect.bottom-wrect.top)) _
      then
         '
         'print "fullscreen"
         return TRUE
      else
         'print "normal"
         return FALSE
      end if
   end if
'
end function
'
function GetHwnd(pid as integer) As HWND
   dim as integer    res,ProcessID
   dim as string*512 wt
   dim as string     teststr="  DIEmWin  Default IME  M  "
   dim as HWND       hwnd
   if pid<=0 then pid=GetCurrentProcessID
   hwnd=FindWindow(NULL,NULL)
   while hwnd>0
      GetWindowThreadProcessId(hwnd,@ProcessID)
      if ProcessID=pid then
         res=GetWindowText(hwnd,strptr(wt),511)
         wt=trim(left(wt,res))
         if instr(teststr,"  " & trim(left(wt,res)) & "  ")<1 _
            then return hwnd
      end if
      hwnd=GetWindow(hwnd,GW_HWNDNEXT)
   wend
   return NULL
end function

caseih
Posts: 1386
Joined: Feb 26, 2007 5:32

Re: Expected identifier, found 'DWORD'

Postby caseih » Oct 21, 2018 17:26

I can't replicate the issue on my machine. The code snippet you supplied compiles without errors or warnings.
counting_pine
Site Admin
Posts: 6173
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Re: Expected identifier, found 'DWORD'

Postby counting_pine » Oct 22, 2018 12:44

Does it fail with just a single-line program?

Code: Select all

#include once "windows.bi"
Does it make any difference if you omit "once"? (Probably not, but might as well simplify as much as possible)

Return to “General”

Who is online

Users browsing this forum: No registered users and 2 guests