|
Hi tox !
toxcct wrote:
lower lower level ???
-> InitInstance()...
otherwise, In the main frame constructor.
Nope, none of them is good because InitInstance is left when the window is created (it is not like in a dialog based application). What I want is a way to 'encapsulate' the message loop inside my try/catch block so I can really catch ALL exception (these are my own exceptions...) that can be thrown wherever in my code.
toxcct wrote:
but it is not so good to manage all the exception at only one place. you should have some try/catch at several places and maybe re-throw some of them if you like lower levels to cath'em and manage their part of the exception.
No, I know but here I want to have some try/catch block in my code to handle some exceptions. But I have also a lot of exceptions that can be thrown when resources are missing (these are external files). This would be really a lot of try/catch statements to put in my code (and this will be very ugly also).
In fact when a resource is missing, I just need to display a MessageBox with the error and quit the program. Thus, it's a little bit stupid to write try/catch statements everywhere in my code (and they are numerous !).
But thanks for your suggestion
|
|
|
|
|
I recently had to do something like this in a project and settled on using SetUnhandledExceptionFilter
In CMyApp::InitInstance
<br />
SetUnhandledExceptionFilter(MyAppUnhandledExceptionFilter);<br />
The handler
<br />
LONG WINAPI MyAppUnhandledExceptionFilter(struct _EXCEPTION_POINTERS* ExceptionInfo);<br />
<br />
LONG WINAPI MyAppUnhandledExceptionFilter(struct _EXCEPTION_POINTERS* ExceptionInfo)<br />
{<br />
LONG lReturnValue = EXCEPTION_EXECUTE_HANDLER;<br />
<br />
static BOOL bHandledException = FALSE;<br />
<br />
if (!bHandledException)<br />
{<br />
bHandledException = TRUE;<br />
<br />
}<br />
<br />
return (lReturnValue);<br />
}<br />
Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
|
|
|
|
|
Hi !
Thanks for your response, it seems to be what I'm looking for
Thanks!
|
|
|
|
|
Hello,
All message handlers are protected by a TRY - CATCH_ALL block in the function: AfxCallWndProc See WinCore.cpp line 182 for more details.
However, it only catches MFC exceptions derived from CException..
Behind every greak black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Hi folks,
I wanted to know if anyone has experience with power management unders XP. Mainly what I want to do is to be able to shutdown AND wake up the PC using the RTC alarm wake up feature of the BIOS.
If anyone can direct me to some piece of code or how to do it, I would appreciate.
Thanks for your time,
|
|
|
|
|
The Plug & Play Manager is what notifies devices on the system of power management and shutting down or powering up in general.
You are talking simply about going into lower power mode right not hibernation?
What exactly do you want to shut down, the monitor? The hard disks? Everything? There is a configuration under Screen Savers that sets the interval to shut down these devices. I did notice at one point that a WM_SYSCOMMAND with f170, 1 was sent to an active window which caused the monitor to recieve a power IRP.
You may want to enable those features then debug how they occur if you want to force them.
8bc7c0ec02c0e404c0cc0680f7018827ebee
|
|
|
|
|
Look around function SetSystemPowerState in MSDN. She belongs to the Power Management group, where other PM related stuff in WinXP is documented.
Shutdown can be easily achieved directly with this function, but about the Wake-up feature, I never tried that, so I don't know.
|
|
|
|
|
I managed to figure out the shutdown using the Power Management functions. My real problem now is the wake-up feature. I know I can wakeup the system from poweroff using my BIOS RTC alarm. Also I know (by using the GetPwrCapabilities function) that my system support wakeup on RTC alarm from hibernation but my problem is that I do not know how to setup the wakeup call. Any informations on how to write data to my BIOS or to schedule an event using the power management functions would be appreciated.
Thanks for your time,
|
|
|
|
|
I scanned the OnNow specifications and Windows and found this:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndevio/html/onnowapp.asp[^]
Where (at nearly bottom of the page) they write:
The OnNow-capable operating system can ensure that the PC system is in the working state at a scheduled time. To do this, applications can use timer objects to wake the PC from a low power state (assuming sufficient power is available). The operating system will track all timer objects and program the hardware with the next wake-up time when putting the system into the sleep state.
Create, Open, Set, and Cancel capabilities will be provided in "Waitable Timer" objects for use by event-handling applications or by Windows 2000 services. The following is an example:
BOOL SetWaitableTimer(HANDLE hTimer, const LARGE INTEGER *lpDueTime, LONG
lPeriod, PTIMERAPCROUTINE pfnCompletionRoutine, LPVOID
lpArgToCompletionRoutine, BOOL fResume)
|
|
|
|
|
I don't seem to be able to do what I want with that function...
|
|
|
|
|
Well, as I understood the documentation, you simply create a waitable timer to be waked at say 20 minutes, do the power down and windows should take care for the rest.
|
|
|
|
|
Hello,
I'm wondering if someone is familiar with the technique use by many programs today - starting the app before any other app, and pausing windows load (like adaware does).
Any help appreciated,
D>
|
|
|
|
|
to load a program from another, use ShellExecute() (or more deprecated WinExec() ).
to allow a program to be paused, you have to manage threads, with a flag raised by the GUI which is handled by the working thread...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
No,
I know how to launch program, the effect that I'm after is loading my application at windows startup, process tasks, and then allow or shut down the system
Thanks
|
|
|
|
|
See MSDN article Q179365.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Will do,
Thank you
|
|
|
|
|
Hi!
How could i replace for example the first byte (call it b0) of a UInt32 variable?
thx
|
|
|
|
|
zuschauer1980 wrote:
How could i replace for example the first byte (call it b0) of a UInt32 variable?
newVal = (oldVal & 0xffffff00) | (newByteVal & 0xff);
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
By "first" do you mean least significant or most significant? Check out the bit-related operators such as AND (&), OR (|), NOT (~), and XOR (^).
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
|
Hi,
I am developing a marker application. Basically allows free-hand drawing with the mouse. When i draw a line, i want the window below also to visible. I am not able to create a transparent Pen for this? i tried BS_HOLLOW, but it doesn't draw at all.
hdc = CreateDC(TEXT("DISPLAY"),NULL,NULL,NULL);
lb.lbColor = rgbCurrent;
lb.lbHatch = NULL;
lb.lbStyle = BS_SOLID;
//hNewPen = CreatePen(PS_SOLID,10,rgbCurrent);
//SetROP2(hdc,R2_MERGEPEN);
hNewPen = ExtCreatePen(PS_GEOMETRIC,10,&lb,0,NULL);
//SelectObject(hdc,CreateBrushIndirect(&lb));
//SetDCBrushColor(hdc,rgbCurrent);
SelectObject(hdc,hNewPen);
MoveToEx(hdc, PrevX, PrevY, NULL);
LineTo(hdc, CurrX, CurrY);
DeleteDC(hdc);
........
Can anyone help?
Hercules
|
|
|
|
|
Hi, I don't remember it very well, but you may search SelectStockObject (NULL_PEN); //NULL_BRUSH
C U later
|
|
|
|
|
Thanks for replying...
But this code is all in Platform SDK, how do i create a NULL_PEN there. I create a BS_HOLLOW(same as BS_NULL) but it doesn't draw the line at all.
Your help will be appreciated!
Hercules
|
|
|
|
|
Can anyone tell me how to show line numbers in the editor in visual studio 6. I've looked and cant find out how.
Regards
Paul
|
|
|
|
|
I didn't think you could do this before VS2003.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|