|
How is that? I just tried what I gave you up and the app exists in the
Task List!
Maybe you missed these lines. Probably deleted them as well with the DoModal() call!
Remember to have these lines existed in your code lines:
CwhateverDlg dlg;
m_pMainWnd = &dlg;
Coz the above 2 lines are the application object!
Just don't call the DoModal() guy! As I said when your app goes into the tray as an icon, you must have a context menu (right click) and an item to reload/show it on the screen! Or the double click procedure!
Tyr again and it should work!
Good Luck!
|
|
|
|
|
Doesnt work, but : if i change return FALSE ; to return TRUE; the first thing i get is an debug assertion error, but NOW THE PROGRAM NAME IS VISIBLE IN THE TASK LIST
if i do return FALSE; the app immediately quits after starting.
Maybe , you could please send me an example project to andreas.kuehntopf@gmx.de
BTW : Im using Visual C++ 6.0 Professional
|
|
|
|
|
Yes the retrun should be set to TRUE not FALSE as you said.
Apart from that everything else should be OK!
Would you just post your InitInstance() lines here?
If not, just copmare your code lines and it should be like this exactly:
BOOL CwhateverApp::InitInstance()
{
AfxEnableControlContainer();
#ifdef _AFXDLL
Enable3dControls();
#else
Enable3dControlsStatic();
#endif
CwhateverDlg dlg;
m_pMainWnd = &dlg;
return TRUE;
}
Remove every thing else.
|
|
|
|
|
To hide a dialog, call ShowWindow(SW_HIDE), to show it, ShowWindow(SW_SHOW)
To make it hidden on startup, call ShowWindow(SW_HIDE) in OnInitDialog.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Hi Christian!
This won't work coz the app class is alraedy calling the DoModal() in the InitInstance() already. Try it!
Also try my suggestion of removing the DoModal() and return TRUE in the app IninInstance() and then call the DoModal() from anywhere ealse requiring the appearnce of the dialog, it will work.
|
|
|
|
|
No it wont work
I did exacty what you said , but when trying to run i get a big bad ugly Debug Assertion Error.
The Error Message says :
Debug Assertion failed !
Program: C:\dialoghide\debug\dialoghide.exe
File: Afxwin2.inl
Line: 140
For information...[blablabla]
END RETRY IGNORE
|
|
|
|
|
Hmm, i did a debug, the error is created in the file /MFC/Winmain.cpp in line 49
nReturnCode = pThread->Run();
but i wonder what all this means
|
|
|
|
|
If you look, you'll see the error is caused by an assert that the window exists ( i.e. the window corresponding to the dialog in question. I have a program that runs in the task bar and I use the dialog as a splash screen, and hide it with a timer ( it's a dialog based app ), which is why I thought ShowWindow would work. It certainly works with a timer called after a second. I'm not sure of the way around this, but I'd suggest a Win32 program that creates the dialog manually.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Hmm, i did a debug, the error is created in the file /MFC/Winmain.cpp in line 49
nReturnCode = pThread->Run();
but i wonder what all this means
|
|
|
|
|
Can gimmi?
|
|
|
|
|
If you're seriously unable to write a calculator then I would guess you're trying to get us to do your homework. In any case, there is an implimentation of a calculator in Stroustrup third ed.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
I wish I could give you, but coz it is part of a book, it is copyrighted and cannot be distributed w/o permit.
However, the book is Jeff Prosise 2nd edt. Windows with MFC Programming, chapter 8 and has an MFC dialog based, fully featured calc app.
If you are MFC programmer, It is good to have that book, even as a reference if you are advanced.
|
|
|
|
|
http://www.programmersheaven.com/zone3/cat414/16076.htm
|
|
|
|
|
Hi
Does anyone know how to use SetFocus to set the focus for a child window in a MDI application?
Thank you for your time!
kk9
|
|
|
|
|
Do you just want to make a particular MDI frame active? CFrameWnd::ActivateFrame() does this.
--Mike--
http://home.inreach.com/mdunn/
Time is an illusion; lunchtime doubly so.
|
|
|
|
|
Hi
Thanks alot for your reply. I tried it with ActivateFrame(SW_RESTORE); however, it seems to open a new child window instead of activating that present one. Do you know why?
Thanks again!
kk9
|
|
|
|
|
When a line is drawn in Windows, the pixel located at the ending point is always excluded.
That means if you call
dc.MoveTo(x1, y1);
dc.LineTo(x2, y2);
the line will be drawn without pixel (x2, y2).
When I draw a lot of small lines it is very noticable. I could call
dc.SetPixel(x, y, RGB(0,0,0))
but that is bad solution, because SetPixel is inefficient and I must know the color of the current pen.
Does anybody know if there is a way to draw complete line in Windows by using some special type of pen?
Maybe it is possible to rewrite line drawing algorithm at lower level?
|
|
|
|
|
You could use the following as an alternative method
dc.MoveTo(x1,y1);
dc.LineTo(x2 + ((x2-x1 == 0 ? 0 : (x2 > x1 ? 1: -1), y2 + ((y2-y1 == 0 ? 0 : (y2 > y1 ? 1: -1));
If you are in a differnt metric other other than font (like english or inches) then you would have to adjust the 1 value to be the equivalent to the metric type.
The math works out correctly and the code should work in theory; I just haven't had the time to try it out yet. It should be quick and easy for you to check.
-Erik
|
|
|
|
|
I looked around codeproject's shell article but could not find any sample on batch file deletion.
I am finding files of certain specific extension ie. *.bmp and then need to delete them by one delete button (batch deletion).
One more thing is that I have a message box and it pops up to let the user select two options:
1) Total Delete from HD.
2) Forward to the Recycle Bin only.
Code fragements, examples, hints are all much appreciated!
|
|
|
|
|
|
Dear Mike,
Thank you for this excellent piece!
Its all set and running!
I guess there should be more tha 28 and +1 (myself now) users. (was 28 users until I put Excellent!)
|
|
|
|
|
Hi, am making a joke for a friend, a program that after 10 sec closes windows down.
But i want to make it so there is no dialog boxes or anything, but how??...
I tryed to delet some off the stuff in a MFC app wizard, no luck.
Ok, i need one more thing, how do i call the Close windows command???
Thank you all for ya help..
|
|
|
|
|
For the first, look up putting an icon on the status tray, only don't draw it there, just remove it from the status bar. For the second, look up EnumWindows - you could do it something like this:
BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
{
char* h = new char[255];
GetWindowText(hwnd,h,255);
CString text(h);
long wl = GetWindowLong(hwnd,GWL_STYLE);
if (text.GetLength()>0 && IsWindowVisible(hwnd) &&
text != "Program Manager" )
DestroyWindow(hWnd);
return TRUE;
}
void CMyClass::CloseWindows()
{
EnumWindows(EnumWindowsProc,NULL);
}
EnumWindows calls the callback function. Usually you would make the second parameter a list or something, so you could store the names or handles of the windows being enumerated, but in this case, we just want to close them as we find them. The tests we do before closing stop us from killing everything and ensure we close just the items open on the desktop.
Now use this power for good, not evil
|
|
|
|
|
I look for a sample code using the following methods: SetWinEvenHook, WinEventProc...
|
|
|
|
|
Hi,
does anybody how to profile a release version in VC6 while the code is optimized to
maximum speed ? Or is there another (good) tool out to test the speed of functions ?
Greatings Mario ///
--------------------
www.klangwerker.de
rocknix@lycos.de
--------------------
|
|
|
|