|
RedDragon2k wrote:
I'm working on a program which controls pupil pc's.
Have the students using accounts that do not have permission to terminate your process (which can be run under a different account).
Just about anything else is dodgy as hell, and will eventually be broken by any student worth his salt.
"The time has come," the Walrus said,
"To talk of many things..."
|
|
|
|
|
Hai All,
In my application InitInstance method the DoModal() calling of main application dialog return -1(bcoz of some loading problem). but i want to capture it and show some error mesage. But i cann't show any error message or any other dialog when it returns -1.
How i can i solve this problem.
ANyone can have any idea?
regards
Ans
|
|
|
|
|
|
AnsGe wrote:
But i cann't show any error message or any other dialog when it returns -1.
The reason is most likely here.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hai,
I tried with ur help. But my problem still remains.
If main window is successfully loaded then it is possible to show any mesagebox. But the main window Domodal() failed then it is not possible to show a MessageBox. The code snip running, but windows are not visible
Thanks
Anish
|
|
|
|
|
AnsGe wrote:
...then it is not possible to show a MessageBox.
Did you comment out the m_pMainWnd = &dlg statement in the app's InitInstance() method?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Whenever I've had DoModal() return -1 it was due to the dialog using a control whose window class wasn't registered yet. If you're running an older OS and are using any Win 95 common controls, check that you're calling InitCommonControls() in your init code.
--Mike--
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ | You Are Dumb
|
|
|
|
|
hai,
Thanks for ur reply.
i know the exact reason why it retuns -1. bcoz one my ocx is not installed in the machine. But i want to capture the situation and want to display error message.
I have done all hte initialisations in the InitInstance
Thanks
Ans
|
|
|
|
|
Hai All,
How can i check an ocx which is droped in my main application dialog is installed or not. I not used the CoCreateInstane function , but i directly placed the control in my dialog. The application crashes when the control is not installed.
How can i avoid it?
Thanks in Advance
Ans
|
|
|
|
|
You can try the CoCreateInstance before attempting to display the dialog. If that fails, do not show the dialog.
|
|
|
|
|
Hai,
Actually i don't know the internal structure about the used COM component. Its a 3rd party control and i have only know some functions in it. I dont know any classid and interface id's.
So how can i call CoCreateInstance()
Byy
Anish
|
|
|
|
|
Just trying to help here, but maybe you can use this:
HRESULT CLSIDFromProgID(
LPCOLESTR lpszProgID,
LPCLSID pclsid
);
You have to already know what the name of the OCX object is to use the function.
Otherwise, you might need to manually search the registry to find where the OCX is installed, find the OCX, see what it's GUID is, and then try to use the CoCreateInstance.
|
|
|
|
|
hi ans,
cocreateinstance is not required to instantiate the activex. i think your problem is u r not included the call to AfxEnableControlContainer(). it ll intializes the framework needed for the activeX container
naren
|
|
|
|
|
I have a gui application that is launched via createprocess(...) from another gui application (that subsequently kills itself). This new application creates a secondary thread that creates a dialog (hidden) at thread creation. I am looking for windows shutdown requests on this secondary dialog (using onQueryEndSession()), and then attempt to show this dialog. It works correctly for most cases (e.g. when I press ctrl+alt+delete and then select shutdown), but sometimes I get a "System Settings Change" Message Box which appears after new devices installed. In this scenario, my application catches and prevents the shutdown request, but fails to throw up the dialog when I use ShowWindow(SW_SHOWNORMAL) (by the way, its modeless). Does anyone know why a messagebox like this would cause this behaviour? I found that uninstalling a device brings up a similar messagebox (same caption, different text), but in this test my modeless dialog does appear. Any suggestions would be appreciated.
Thanks,
Himanshu
|
|
|
|
|
I am using the AlphaBlend function with an image on a transparent window to fade the image in with a timer and an alpha value incrementing from 1 to 255 as the timer fires (I'm redrawing using InvalidateRect), how can I fade the window back out? If I use the same redraw function and decrement the alpha value the images stays the same.
Am I going about it the right way? Is there a way to fade out?
|
|
|
|
|
|
Thanks for the reply, I tried AnimateWindow() before but I keep getting the error that it is an undeclared identifier even when I include windows.h as specified in the MSDN Library. What am I doing wrong?
|
|
|
|
|
|
Cheers, I've cracked it now, just had to define the windows version.
|
|
|
|
|
Hi,
I have a dialog based MFC app. When a certain command line argument is passed to it, I want the dialog to be run initially invisible. How do I do this? PreCreateWindow isn't called for dialog boxes, and I've tried all sorts of other ways (calling ShowWindow(SW_HIDE) in OnInitDialog doesn't work, overriding OnShowWindow doesn't work...) any ideas anyone? this has been bugging me for a while!
Thanks in advance,
Dave
|
|
|
|
|
There is very good article Written by Mr Nishant S for your problem.
visit his Site http://www.voidnish.com for details
-----------------------------
"I Think this Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Cheers, the solution on the site works great!
Dave Kerr
codechamber@hotmail.com
http://www.codechamber.com
|
|
|
|
|
I'm converting a multi project, multi threaded application from VC6 to .Net. After solving all the obvious problems due to the forgiveful VC6 compiler I stumbled across some harder problems.
First of all I got a ziljon of warnings (4251 and 4275). I chose to pragma ignore them. After that I got it all to compile and ran the application.
Then I got an Assertion Failed when the application greated the first CFrameWnd:
<br />
BOOL InterfaceThread::InitInstance()<br />
{<br />
iThreadHasExited = NULL;<br />
<br />
iDummyWindow=new DummyWindow();<br />
<br />
iDummyWindow->Create(NULL,"InterfaceThreadDummy");<br />
iDummyWindow is a CFrameWnd and InterfaceThread inherits from CWinthread. This is the first function called from _AfxThreadEntry.
In CFrameWnd::CreateEx AfxGetInstanceHandle Fails Assertion.
After this a lot of assertion fails and finally I get an unrecoverable crash in AfxNewHandler. The error occurs here (in operator new):
<br />
#ifdef _AFXDLL<br />
if (pfnNewHandler == _pfnUninitialized)<br />
{<br />
AFX_MODULE_THREAD_STATE* pState = AfxGetModuleThreadState();<br />
pfnNewHandler = pState->m_pfnNewHandler;<br />
}<br />
if (pfnNewHandler == NULL || (*pfnNewHandler)(nSize) == 0)<br />
break;<br />
#else<br />
->>>>>>>>if (_afxNewHandler == NULL || (*_afxNewHandler)(nSize) == 0)<br />
break;<br />
#endif<br />
Seems like _AFXDLL isn't defined even though it is defined in the preprocessor definitions.
Anybody got a hint???
|
|
|
|
|
After a little debugging I just realized that new returned NULL. How can that be possible, now extraordinary amout of memory has been used and the size of the block alloced is just 400 bytes.
A new just before this had functioned perfectly.
Is there something that need to be done i .Net?
|
|
|
|
|
Just a suggestion - have you tried reading through all the warnings you're getting, rather than just ignoring them? - You might be overlooking something really important
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|