Have a look in the RR plugin examples
ModSDK.bas and ModCOM.bas
I'm nearly finished with writing an OBD MPG plugin for RR, my only problem is the behavior on resume from hibernate.
A restart of RR gets things going again so it's not the ELM interface dropping out. So I was going to see if it was possible to make the .dll aware of when the hibernate process was occurring, I could then tell it to close the port, and then do the opposite when it comes back.
Is this possible with vb6? How do people usually handle hibernation when using an MSComm object? I've been doing a fair bit of google searching but haven't come up with anything useful yet.
Thanks!
Have a look in the RR plugin examples
ModSDK.bas and ModCOM.bas
I'm taking a look right now, working on understanding what I'm seeing.
First off I guess I was a bit off on my terminology in my first post, I'm making a extension plugin, not a base plugin. Whether or not that alters your advice I don't know.
I see in ModSDK.bas PrepareForHibernate and ResumeFromHibernate subroutines, can I just place the necessary code in these subroutines and have it executed upon entrance and return from hibernation?
It's been a few years since I've done any programming and I'm just getting used to vb6 and how RR is setup. Thanks for your help!
in ModCom.bas is the important parts
Code:Private lpPrevWndProc As Long Private Const WM_COPYDATA = &H4A Private Const GWL_WNDPROC = (-4) Private Const SW_HIDE = 0 Private Const SW_NORMAL = 1 Private Const WM_POWERBROADCAST = &H218 Private Const PBT_APMSUSPEND = 4 Private Const PBT_APMRESUMESUSPEND = 7 Private Declare Function CallWindowProc Lib "user32" Alias _ "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hwnd As _ Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As _ Long) As Long 'Process Window Events Private Function WindowProc(ByVal hw As Long, ByVal uMsg As Long, _ ByVal wParam As Long, ByVal lParam As Long) As Long Select Case uMsg Case WM_COPYDATA 'If our function process data Call ReceiveMsg(lParam) Case WM_POWERBROADCAST 'System is asking about/entering/resuming from standby If wParam = PBT_APMSUSPEND Then PrepareForHibernate End If If wParam = PBT_APMRESUMESUSPEND Then ResumeFromHibernate End If End Select 'If we're still hooked If lpPrevWndProc <> 0 Then ' Call the original window procedure associated with this form. WindowProc = CallWindowProc(lpPrevWndProc, hw, uMsg, wParam, lParam) Else WindowProc = 0 End If End Function
So if you add ModCom.bas to your project just add PrepareForHibernate and ResumeFromHibernate Public Subs to your project
I've been playing around with this a little bit and so far using private subs in ModCom whenever I put anything in the PrepareForHibernate or ResumeFromHibernate, RR is closed when I resume from hibernate.
I realized today it might be do to the private subs in ModCom so I moved them into my form and made them public. I'm going to test after work. Any ideas?
You will need to add
COMHook Me.hwnd
to form_load
to enable your program to receive messages.
And add
COMUnhook Me.hwnd
to form_unload
I've got COMHook Me.hwnd in place, i'll add COMUnhook Me.hwnd to the unload routine
Thanks!
Ok everything is setup I believe the correct way yet RR is still closed every time I return from hibernate. If I comment out the routines RR is fine on return from hibernate, but unfortunately my plugin isn't.
Any suggestions? I'm attaching my VB6 project, any help would be greatly appreciated.
Thanks!
Bookmarks