Click here to Skip to main content
15,912,329 members
Home / Discussions / System Admin
   

System Admin

 
GeneralRe: Old Hardware and Windows 98 SE Pin
Michael Martin8-May-03 0:58
professionalMichael Martin8-May-03 0:58 
GeneralRe: Old Hardware and Windows 98 SE Pin
J. Dunlap8-May-03 7:49
J. Dunlap8-May-03 7:49 
GeneralRe: Old Hardware and Windows 98 SE Pin
Roger Wright8-May-03 17:28
professionalRoger Wright8-May-03 17:28 
GeneralRe: Old Hardware and Windows 98 SE Pin
Michael Martin8-May-03 18:16
professionalMichael Martin8-May-03 18:16 
QuestionHow to transfer the domain from Win2000 to Win2003? Pin
Exceter6-May-03 23:06
Exceter6-May-03 23:06 
GeneralPreventing Our Windows from Suspending in VC++ 6.0 Pin
Cahya Dewanta6-May-03 3:24
Cahya Dewanta6-May-03 3:24 
GeneralRe: Preventing Our Windows from Suspending in VC++ 6.0 Pin
Duncan Edwards Jones6-May-03 4:14
professionalDuncan Edwards Jones6-May-03 4:14 
GeneralRe: Preventing Our Windows from Suspending in VC++ 6.0 Pin
Cahya Dewanta6-May-03 18:12
Cahya Dewanta6-May-03 18:12 
Smile | :) Hi! It`s a very good luck, coz I got the code from your site (www.merrioncomputing.com)! Nice code guys!
Here`s the code:

'IN A MODULE<br />
Option Explicit<br />
<br />
Public oldProcAddress As Long<br />
<br />
Public Enum enPowerBroadcastType<br />
     PBT_APMQUERYSUSPEND = &H0<br />
     PBT_APMQUERYSTANDBY = &H1<br />
     PBT_APMQUERYSUSPENDFAILED = &H2<br />
     PBT_APMQUERYSTANDBYFAILED = &H3<br />
     PBT_APMSUSPEND = &H4<br />
     PBT_APMSTANDBY = &H5<br />
     PBT_APMRESUMECRITICAL = &H6<br />
     PBT_APMRESUMESUSPEND = &H7<br />
     PBT_APMRESUMESTANDBY = &H8<br />
End Enum<br />
<br />
Public Const BROADCAST_QUERY_DENY = &H424D5144<br />
Public Const WM_POWER = &H48<br />
Public Const WM_POWERBROADCAST = &H218<br />
Public Const PWR_SUSPENDREQUEST = 1<br />
Public Const GWL_WNDPROC = (-4)<br />
Public Const PWR_FAIL = (-1)<br />
<br />
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long<br />
Public 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<br />
<br />
'\\ In a .BAS file:<br />
'\\ --[VB_WindowProc]--------------------------------------------<br />
'\\ 'typedef LRESULT (CALLBACK* WNDPROC)(HWND, UINT, WPARAM,<br />
'\\ LPARAM);<br />
'\\ Parameters:<br />
'\\ hwnd - window handle receiving message<br />
'\\ wMsg - The window message (WM_..etc.)<br />
'\\ wParam - First message parameter<br />
'\\ lParam - Second message parameter<br />
'\\ Note:<br />
'\\ When subclassing a window proc using this, set the<br />
'\\  eventhandlerhOldWndProc property to the window's previous<br />
'\\ window proc address.<br />
'\\ -------------------------------------------------------------'\\ You have a royalty free right to use, reproduce, modify,<br />
'\\ publish and mess with this code<br />
'\\ I'd like you to visit http://www.merrioncomputing.com for<br />
'\\  updates, but won't force you<br />
'\\ ----------------------------------------------------------<br />
<br />
Public Function VB_WindowProc(ByVal hWnd As Long, ByVal wMsg As _<br />
  Long, ByVal wParam As Long, ByVal lParam As Long) As Long<br />
<br />
On Local Error Resume Next<br />
Dim lRet As Long<br />
<br />
<br />
'\\ If its a power suspending broadcast, kill it...<br />
If wMsg = WM_POWER And wParam = PWR_SUSPENDREQUEST Then<br />
   '\\ This is the message in Windows NT/2000<br />
    VB_WindowProc = PWR_FAIL<br />
ElseIf wMsg = WM_POWERBROADCAST And wParam = _<br />
      PBT_APMQUERYSUSPEND Then<br />
    VB_WindowProc = BROADCAST_QUERY_DENY<br />
Else<br />
VB_WindowProc = CallWindowProc(oldProcAddress, hWnd, wMsg, _<br />
       wParam, lParam)<br />
End If<br />
<br />
End Function<br />
<br />
'\\ IN OUR APP's MAIN FORM:<br />
Private Sub Form_Load()<br />
<br />
oldProcAddress = SetWindowLong(Me.hWnd, GWL_WNDPROC, _<br />
      AddressOf VB_WindowProc)<br />
<br />
End Sub<br />
<br />
Private Sub Form_Unload(Cancel As Integer)<br />
<br />
Call SetWindowLong(Me.hWnd, GWL_WNDPROC, oldProcAddress)<br />
<br />
End Sub


That works fine but since I`m a new VB-to-VC++ learner I can hardly do that stuff in VC++ language.

Again thank you so very much for your respond!
Regards.
GeneralRe: Preventing Our Windows from Suspending in VC++ 6.0 Pin
Chris Richardson6-May-03 18:39
Chris Richardson6-May-03 18:39 
GeneralRe: Preventing Our Windows from Suspending in VC++ 6.0 Pin
Cahya Dewanta9-May-03 4:50
Cahya Dewanta9-May-03 4:50 
QuestionSetting file/dir security ? Pin
mirex5-May-03 2:52
mirex5-May-03 2:52 
GeneralSome Services won't start... Pin
Eric at Cognos1-May-03 7:07
Eric at Cognos1-May-03 7:07 
GeneralRe: Some Services won't start... Pin
J. Dunlap1-May-03 7:19
J. Dunlap1-May-03 7:19 
GeneralDNS vs Windows Domains Pin
Roger Wright1-May-03 5:19
professionalRoger Wright1-May-03 5:19 
GeneralRe: DNS vs Windows Domains Pin
Ray Cassick1-May-03 5:56
Ray Cassick1-May-03 5:56 
GeneralRe: DNS vs Windows Domains Pin
Roger Wright1-May-03 6:17
professionalRoger Wright1-May-03 6:17 
GeneralInstallation packages for server applications. Pin
Jonas Follesø30-Apr-03 1:36
Jonas Follesø30-Apr-03 1:36 
GeneralRe: Installation packages for server applications. Pin
Daniel Turini30-Apr-03 6:04
Daniel Turini30-Apr-03 6:04 
GeneralDomain Setup Pin
Matt Newman29-Apr-03 18:38
Matt Newman29-Apr-03 18:38 
GeneralNetwork Card Pin
Chris Richardson28-Apr-03 13:59
Chris Richardson28-Apr-03 13:59 
GeneralRe: Network Card Pin
Roger Wright29-Apr-03 7:19
professionalRoger Wright29-Apr-03 7:19 
GeneralRe: Network Card Pin
Chris Richardson29-Apr-03 14:04
Chris Richardson29-Apr-03 14:04 
GeneralRe: Network Card Pin
Robert Little29-Apr-03 20:47
Robert Little29-Apr-03 20:47 
GeneralRe: Network Card Pin
Roger Wright30-Apr-03 5:36
professionalRoger Wright30-Apr-03 5:36 
GeneralHttp connection through Proxy Pin
Sam197925-Apr-03 21:38
Sam197925-Apr-03 21:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.