keybd_event

keybd_event

I have successfully used the keybd_event function in a program that I haven't re-compiled since 2001 (compiler version unknown). Now, I am re-compiling/linking that program and get the following error even though the source code hasn't changed in ages. Thanks for any help

Microsoft Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

/subsystem:windows
/entry:WinMainCRTStartup
/ignore:505
/debugtype:cv
/debug:minimal
/pdb:none
C:DOCUME~1ADMINI~1.000LOCALS~1Tempobj70.tmp
PVIO.OBJ
GRAPHQW.OBJ
dformt.lib
libcmt.lib
dfqw_mdi.lib
dfqwin.lib
user32.lib
gdi32.lib
comdlg32.lib
dfport.lib
kernel32.lib
/out:SCANMF8.exe
/incremental:no
GRAPHQW.OBJ : error LNK2001: unresolved external symbol _KEYBD_EVENT@16
SCANMF8.exe : fatal error LNK1120: 1 unresolved externals
NMAKE : fatal error U1077: 'C:BATDFVARS.BAT' : return code '0x460'
Stop.

4 Beiträge / 0 neu
Letzter Beitrag
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.

Hah, it seems it's a DFWIN bug -- there is no INTERFACE to keybd_event in user32.f90 -- although it was there even in CVF5.0. (Superficially, it looks as if someone was manually fixing the result of automatic translation from winuser.h (there's a MSFWIN$ added at mouse_event) and screwed it up...).

As a workaround, you should put the INTERFACE block in the routine(s) that calls keybd_event:

interface
   subroutine  keybd_event (bVk ,bScan ,dwFlags ,dwExtraInfo ) 
  !DEC$ IF DEFINED(_X86_)
  !DEC$ ATTRIBUTES STDCALL, ALIAS : '_keybd_event@16' :: keybd_event
  !DEC$ ELSE
  !DEC$ ATTRIBUTES STDCALL, ALIAS :  'keybd_event'    :: keybd_event
  !DEC$ ENDIF
  BYTE    bVk
  BYTE    bScan
  integer dwFlags
  integer dwExtraInfo
  end subroutine keybd_event
end interface

Jugoslav

Jugoslav
www.xeffort.com

Hi,
I was trying to use mouse_event in a win32 app as I was converting my quickwin ones. Tried to apply this example into mouse_event but I am not succesful.

Basically, in quick win I use

	bret=waitonmouseevent(MOUSE$RBUTTONDOWN,keystate,ixpos,iypos)
if (keystate==MOUSE$LBUTTONDOWN) then
....
end if
 

and want the equivalent of that in Win32
I tried

 bret= mouse_event(dwFlags,dx,dy,dwData,dwExtraInfo)
    	if (dwFlags == MOUSEEVENTF_RIGHTDOWN) then

   iret= Messagebox(ghwndmain,'PROCEED ?','Please Click Left Mouse Button'C,MB_ICONEXCLAMATION .OR. MB_YESNOCANCEL)  
	IF(IRET == IDYES) then 
	logi=.FALSE.
	end if

The error I get is
Error: This PARAMETER constant name is invalid in this context. [MOUSE_EVENT]
Can you please help.

Thanks

MOUSE_EVENT is a PARAMETER in DFWINTY.f90, and the function is renamed to msfwin$mouse_event (because Fortran is not case-sensitive). However, it will not solve your problem, as it does something quite different than WaitOnMouseEvent -- it just "simulates" a mouse click. There's no Win32 equivalent of WaitOnMouseEvent.

Jugoslav

Jugoslav
www.xeffort.com

Kommentar hinterlassen

Bitte anmelden, um einen Kommentar hinzuzufügen. Sie sind noch nicht Mitglied? Jetzt teilnehmen