The MP3car.com Store  

Welcome to the MP3Car.com forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. Registering will also remove advertisements. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Go Back   MP3Car.com > Mp3Car Technical > Software & Software Development > Front Ends > Road Runner > RR Plugins

Reply
 
Thread Tools Display Modes
Old 07-10-2008, 12:50 PM   #1
Constant Bitrate
mezz64's CarPC Specs
 
mezz64's Avatar
 
Join Date: Nov 2004
Location: PA
Vehicle: 98 Honda CRV
Posts: 143
My Photos: (1)
Make VB6 Aware of Hibernation?

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!
__________________
98' Honda CR-V
http://www.superbluecrv.com
mezz64 is offline   Reply With Quote
Sponsored Links
Old 07-10-2008, 01:27 PM   #2
Confusion Master
Enforcer's CarPC Specs
 
Enforcer's Avatar
 
Join Date: Sep 2003
Location: If you go down to the woods today, You're sure of
Vehicle: 1997 BMW E36 328I
Posts: 9,899
My Photos: (1)
Have a look in the RR plugin examples

ModSDK.bas and ModCOM.bas
Enforcer is offline   Reply With Quote
Old 07-10-2008, 02:09 PM   #3
Constant Bitrate
mezz64's CarPC Specs
 
mezz64's Avatar
 
Join Date: Nov 2004
Location: PA
Vehicle: 98 Honda CRV
Posts: 143
My Photos: (1)
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!
__________________
98' Honda CR-V
http://www.superbluecrv.com
mezz64 is offline   Reply With Quote
Old 07-10-2008, 02:18 PM   #4
Confusion Master
Enforcer's CarPC Specs
 
Enforcer's Avatar
 
Join Date: Sep 2003
Location: If you go down to the woods today, You're sure of
Vehicle: 1997 BMW E36 328I
Posts: 9,899
My Photos: (1)
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
Enforcer is offline   Reply With Quote
Old 07-14-2008, 12:58 PM   #5
Constant Bitrate
mezz64's CarPC Specs
 
mezz64's Avatar
 
Join Date: Nov 2004
Location: PA
Vehicle: 98 Honda CRV
Posts: 143
My Photos: (1)
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?
__________________
98' Honda CR-V
http://www.superbluecrv.com
mezz64 is offline   Reply With Quote
Old 07-14-2008, 01:42 PM   #6
Confusion Master
Enforcer's CarPC Specs
 
Enforcer's Avatar
 
Join Date: Sep 2003
Location: If you go down to the woods today, You're sure of
Vehicle: 1997 BMW E36 328I
Posts: 9,899
My Photos: (1)
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
Enforcer is offline   Reply With Quote
Old 07-14-2008, 02:00 PM   #7
Constant Bitrate
mezz64's CarPC Specs
 
mezz64's Avatar
 
Join Date: Nov 2004
Location: PA
Vehicle: 98 Honda CRV
Posts: 143
My Photos: (1)
I've got COMHook Me.hwnd in place, i'll add COMUnhook Me.hwnd to the unload routine

Thanks!
__________________
98' Honda CR-V
http://www.superbluecrv.com
mezz64 is offline   Reply With Quote
Old 07-14-2008, 10:37 PM   #8
Constant Bitrate
mezz64's CarPC Specs
 
mezz64's Avatar
 
Join Date: Nov 2004
Location: PA
Vehicle: 98 Honda CRV
Posts: 143
My Photos: (1)
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!
Attached Files
File Type: zip obdmpg.zip (920.3 KB, 5 views)
__________________
98' Honda CR-V
http://www.superbluecrv.com
mezz64 is offline   Reply With Quote
Sponsored Links
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Set RR resolution on resume from hibernation? htsource Road Runner 5 08-08-2007 03:05 PM
Is Hibernation button the same as hibernation event? TheBiz StreetDeck 1 11-28-2006 09:32 AM
Hibernation drawing too much power... Borte General Hardware Discussion 20 09-06-2006 08:03 AM
Phoco and hibernation carlospelos PhoneControl 2 12-15-2005 05:04 PM


All times are GMT -5. The time now is 09:34 PM.


Sponsored Links
The MP3car.com Store

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0
Copyright © 1999 - 2008 Mp3Car.com Inc.
Ad Management by RedTyger
Message Board Statistics