Please Help: TranslateMessage() API FUNCTION <<============= 
Author Message
 Please Help: TranslateMessage() API FUNCTION <<=============

I am using VB3 to write a scientific application, in which one of the
fuctions does lengthy calculations. I order for this function to give up
control to other messages I have tried to use the following sequence of
code that I have successfully used in C/C++, however it is not working in
VB :

In Modules declaration I added the following:

Global Const PM_REMOVE = &H1

Type POINTAPI
    x As Integer
    y As Integer
End Type

Type msg
    hWnd As Integer
    Message As Integer
    wParam As Integer
    lParam As Long
    time As Long
    pt As POINTAPI
End Type

Global Mess As msg

Declare Function PeekMessage Lib "User" (lpMsg As msg, ByVal hWnd As
Integer, ByVal wMsgFilterMin As Integer, ByVal wMsgFilterMax As Integer,
ByVal wRemoveMsg As Integer) As Integer
Declare Function TranslateMessage Lib "User" (lpMsg As msg) As Integer
Declare Function DispatchMessage Lib "User" (lpMsg As msg) As Long

and in the claculation-intensive funtion I added the following:

    Do
        While (PeekMessage(Mess, 0, 0, 0, PM_REMOVE))
                TranslateMessage (Mess)
                DispatchMessage (Mess)
        Wend

The problem is that I am getting the following error on both
TranslateMessage, and DispatchMessage API funtions :

User-defined Type variable not allowed in expression.

Any help with this problem will be greatly appreciated.

Thanks

Naamat Al-Aswad, P.Eng.
Assistant Research Engineer
Research & Development Branch
Ministry of Transportation, Ontario, Canada





Sat, 31 Oct 1998 03:00:00 GMT  
 Please Help: TranslateMessage() API FUNCTION <<=============



Quote:
>I am using VB3 to write a scientific application, in which one of the
>fuctions does lengthy calculations. I order for this function to give up
>control to other messages I have tried to use the following sequence of
>code that I have successfully used in C/C++, however it is not working in
>VB :

>In Modules declaration I added the following:

>Global Const PM_REMOVE = &H1

>Type POINTAPI
>    x As Integer
>    y As Integer
>End Type

>Type msg
>    hWnd As Integer
>    Message As Integer
>    wParam As Integer
>    lParam As Long
>    time As Long
>    pt As POINTAPI
>End Type

>Global Mess As msg

>Declare Function PeekMessage Lib "User" (lpMsg As msg, ByVal hWnd As
>Integer, ByVal wMsgFilterMin As Integer, ByVal wMsgFilterMax As Integer,
>ByVal wRemoveMsg As Integer) As Integer
>Declare Function TranslateMessage Lib "User" (lpMsg As msg) As Integer
>Declare Function DispatchMessage Lib "User" (lpMsg As msg) As Long

>and in the claculation-intensive funtion I added the following:

>    Do
>        While (PeekMessage(Mess, 0, 0, 0, PM_REMOVE))
>                TranslateMessage (Mess)
>                DispatchMessage (Mess)
>        Wend

>The problem is that I am getting the following error on both
>TranslateMessage, and DispatchMessage API funtions :

>User-defined Type variable not allowed in expression.

>Any help with this problem will be greatly appreciated.

>Thanks

>Naamat Al-Aswad, P.Eng.

Try using the DoEvents command in VB rather than the PeekMessage Loop.

-Jim-
NCR Corp.



Sun, 01 Nov 1998 03:00:00 GMT  
 Please Help: TranslateMessage() API FUNCTION <<=============

(...)

Quote:
>>Declare Function PeekMessage Lib "User" (lpMsg As msg, ByVal hWnd As
>>Integer, ByVal wMsgFilterMin As Integer, ByVal wMsgFilterMax As Integer,
>>ByVal wRemoveMsg As Integer) As Integer
(...)
>>    Do
>>        While (PeekMessage(Mess, 0, 0, 0, PM_REMOVE))
>>                TranslateMessage (Mess)
>>                DispatchMessage (Mess)
>>        Wend

>>The problem is that I am getting the following error on both
>>TranslateMessage, and DispatchMessage API funtions :

>>User-defined Type variable not allowed in expression.

(...)

Aside from needing to use DoEvents here, is the problem that the Mess
parameter in PeekMessage is a user-defined type?



Tue, 03 Nov 1998 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. <<<<<<<PROGRAMA GRATUITO PARA WINDOWS 95 /NT<<<<<<<<<<<

2. one SQL datacontrol or many TABLE datacontrols<<<<<<<<<<<<<<<<<

3. HELP >>>>>>WIN API <<<<<<<<<<

4. *************** TRADING TRANSCENDER <<<<<<<<<<<<<<<<

5. >>>>HELP ME WITH DATEVALUE IN UK FORMAT<<<<<<<

6. <<<<<<<<ComboBox>>>>>>>>>>>>

7. >>>>> URGENT: PLEASE HELP <<<<<

8. >>>> WAV file GRAPH <<<<<<<

9. << -- WinAPI : FINDREPLACE - please help

10. help me out please!!!!<<<<<<<<<<<<<<<<<<<<<<<thanks>>>>>>>>>>>>>>>>>>>>>>>>

11. Help recasting UDT <<PLEASE!>>

12. << -- WinAPI : FINDREPLACE - please help

 

 
Powered by phpBB® Forum Software