|
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!
|
|
|
|
|
Of course I read through them. I also seached the web for similar problems, and most places indicated that you should ignore them.
The warnings were the following:
URLParameters.h(167) : warning C4251: 'URLParameters::iAttributes' : class 'CMapStringToString' needs to have dll-interface to be used by clients of class 'URLParameters'
c:\Program Files\Microsoft Visual Studio .NET\Vc7\atlmfc\include\afxcoll.h(1410) : see declaration of 'CMapStringToString'
BackgroundImage.h(26) : warning C4275: non dll-interface class 'CWnd' used as base for dll-interface class 'BackgroundImage'
c:\Program Files\Microsoft Visual Studio .NET\Vc7\atlmfc\include\afxwin.h(1913) : see declaration of 'CWnd'
BackgroundImage.h(25) : see declaration of 'BackgroundImage'
On top of this I've tried to find what's wrong with the memory handling.
I added a dummy loop that allocates an int in each iteration. If I put it in the top of InitInstance it can allocate int forever and ever, but if I move it down a bit (below a couple of window creations) it fails really quickly, after a 9 ints
We have now problem what so ever with memory when we're using VC 6, but now it crashes really early (not more than 14Mb of memory usage).
|
|
|
|
|
I have a program in visual C++ which is used to plot rainfall rate graphs against time. Now i am looking for a suitable interpolation method that can improved my rainfall rate graphs especially near the maximum turning points.
Anyone out there that i can tap on his or her expertise????Thank youu
God bless;)
|
|
|
|
|
|
Now i have one serial com port, and i want it been shared by 2 threads. Now i am using the binary semaphore to control it. I want to ask is it good? or is it good to use the critical section?
Can any body help me compare these method to let me see which one is better?
Thanks
|
|
|
|
|
Microsoft's own documentation makes the claim that the critical section is faster. Critical section can be used for synchronization among many threads within the same process. The critical section can not synchronize separate threads from different processes. It is difficult to make reader/writer type objects with critical sections.
|
|
|
|
|
Please if any of you can help me in these 2 cases :
Case 1:
I want to know something about Thread Termination . Generally I do it by exiting from the thread function by a return statement and posting a message to the main thread that the thread has ended . I have never used Terminate thread or Exit Thread API calls . But I have seen articles telling you call call Exit Thread from "Inside a thread" and not from "Outside a thread".Can you please explain me or put some of your thoughts in this matter ?
Case 2 :
Can you please send me a sample project which contains any program such as this :
There is a main thread which monitors two different Worker threads . Any sample application will do . So far I have done by creating a single thread within my the main thread .
Any help will be great . Thanks in Advance . Please mail me at aveek_99@yahoo.com .
Regards,
Aveek
|
|
|
|
|
sudiptam wrote:
But I have seen articles telling you call call Exit Thread from "Inside a thread" and not from "Outside a thread".Can you please explain me or put some of your thoughts in this matter ?
See here.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Please if any of you can help me in these 2 cases :
Case 1:
I want to know something about Thread Termination . Generally I do it by exiting from the thread function by a return statement and posting a message to the main thread that the thread has ended . I have never used Terminate thread or Exit Thread API calls . But I have seen articles telling you call call Exit Thread from "Inside a thread" and not from "Outside a thread".Can you please explain me or put some of your thoughts in this matter ?
Case 2 :
Can you please send me a sample project which contains any program such as this :
There is a main thread which monitors two different Worker threads . Any sample application will do . So far I have done by creating a single thread within my the main thread .
Any help will be great . Thanks in Advance . Please mail me at aveek_99@yahoo.com .
Regards,
Aveek
|
|
|
|
|
|
Hello Friends,
I want to migrate from VC++6.0 to .Net, Please suggest me the correct path and what are the different technologies are present in it.
Thanks you in advance only.
Neelesh K J Jain.
|
|
|
|
|
Hi , I'am copying some text content into the Clipboard. But I'm getting error at the SetClipboardData(CF_TEXT, h_glbl); function call. This is the code I'm using
CString str; <br />
HGLOBAL h_glbl;<br />
char * buff_data ;<br />
EmptyClipboard();<br />
m_ctrl_edit_cliptextdata.GetWindowText(str);<br />
if ( OpenClipboard() != 0 )<br />
{<br />
h_glbl = GlobalAlloc(GMEM_DDESHARE, str.GetLength() );<br />
buff_data = (char * ) GlobalLock(h_glbl);<br />
strcpy(buff_data, (LPCSTR) str) ;<br />
GlobalUnlock(h_glbl);<br />
SetClipboardData(CF_TEXT, h_glbl);<br />
CloseClipboard();<br />
}
Thanks in Advance.
|
|
|
|
|
is this why if not what error type!
Text format. Each line ends with a carriage return/linefeed (CR-LF) combination. A null character signals the end of the data. Use this format for ANSI text.
to CF_TEXT
|
|
|
|
|
SivaramanDhamodharan wrote:
But I'm getting error...
Would you mind telling us what this error is?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|