 |
 | VS2008 Unicode MDI gives assert Divya Rathore | 17:34 25 Aug '08 |
|
 |
if (!CreateEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST,_T("SplashScreenExClass"),NULL,WS_POPUP,0,0,0,0,hParentWnd,NULL))
gives following on debugging: Warning: Window creation failed: GetLastError returns 0x0000057F
as 'wincore.cpp' fails here:
HWND hWnd = ::AfxCtxCreateWindowEx(cs.dwExStyle, cs.lpszClass, cs.lpszName, cs.style, cs.x, cs.y, cs.cx, cs.cy, cs.hwndParent, cs.hMenu, cs.hInstance, cs.lpCreateParams);
#ifdef _DEBUG if (hWnd == NULL) { TRACE(traceAppMsg, 0, "Warning: Window creation failed: GetLastError returns 0x%8.8X\n", GetLastError()); }
I tried calling the class in InitInstance() of MDI app after creation of MainFrame and ParseCommandLine(cmdInfo); like this:
CSplashScreenEx *pSplash=new CSplashScreenEx(); pSplash->Create(GetMainWnd(),NULL,2000,CSS_FADE | CSS_CENTERSCREEN | CSS_SHADOW); pSplash->SetBitmap(IDB_SPLASH,255,0,255); pSplash->Show();
Am using VS2008, WinXP, UNICODE settings.
|
|
|
|
 |
 | how to show splash screen during loading dlls? yph20040107 | 16:04 27 Nov '07 |
|
 |
The program of my company contains many dlls, and it costs much time to load all of them. So I want to show a splash screen during loading time. Could you tell me how to do? Thanks.
|
|
|
|
 |
 | Probably a bug? min_2_max | 17:01 16 Aug '07 |
|
 |
I think this line is to be inserted into CSplashScreenEx::~CSplashScreenEx():
m_myFont.DeleteObject(); // Max: 2007-8-17 bugfix
Max
|
|
|
|
 |
 | (Small ?) Problem on Windows Vista [modified] Fran-No | 6:39 8 Aug '07 |
|
 |
Hi!
There is a small problem that I don't succeed in resolving with Windows Vista:
For example, with the project sample with this article, when I compile it (with Visual2003 or Visual2005) and run it on Vista, the bitmap appears first during one second approximatively with its "pink" border... Then, this color disappears during the rest of the bitmap view
Is anybody had an idea to solve this problem please?
-- modified at 6:30 Friday 10th August, 2007
|
|
|
|
 |
|
 |
I found a solution for my problem: In the Show function, I changed the second parameter of the called function m_fnAnimateWindow: m_fnAnimateWindow(m_hWnd,1,AW_BLEND);
It seems that the pink border of the bitmap stays only during the apparition animation of the splash screen, and disappears at the end of this animation. So, if this animation became instantaneous, the pink border won't appear...
I think it could possible to correct this bug in the fnAnimateWindow function... If somebody has an idea...
Thanks!
|
|
|
|
 |
|
 |
After some tests, I found that this bug only appears when the Aero mode is activated... When the Aero mode is desactivated, it runs normally.
Is somebody had an idea?
Somebody knows if it is possible to desactivate automatically the Aero mode for an application when it is started?
Thank you in advance
|
|
|
|
 |
|
 |
I found that this bug could be avoid if CSS_FADE was not set in flag.
It is a great class in general! Many Thanks to the author.
|
|
|
|
 |
|
 |
I've already tested your suggestion: Indeed, the problem is avoid if CSS_FADE is not set in flag, but this avoid transition effects too!
|
|
|
|
 |
 | Pixel format Generic Implementation only mitesh velani | 17:11 20 Sep '06 |
|
 |
Fantastic splashscreen. However after the splash screen comes up I also get a dialog titled "Pixel Format" and reads "Generic Implementation Only!" What does that mean, and how can I fix this?
Thanks a million
mitesh
|
|
|
|
 |
 | SetWindowPos() in Show() causes problem bitkidoku | 6:09 21 Dec '05 |
|
 |
I am trying to show the splash screen when user clicks a button. But when I call Show() it fails. But strange thing is it works well sometimes. Why can this happen? (I am a MFC newbie, so if you want more information please ask)
Thanks for your answers
|
|
|
|
 |
 | Improvement: Multiple Text Fields Michael Stammberger | 13:37 17 Nov '05 |
|
 |
Hi,
I have created an extended version with multiple text fields. With this it's possible to display more than one text on the splashscreen. Each text can have its own color, font & position. In addition I added the improvements of kintz & yogurt which they posted here. It's completely backward compatible with the original version.
I would like to accord John these files, but unfortunately there is no email address available (or I've not understood how to contact the author of an article at codeproject ).
Anyway, if someone is interested at this piece of code, get in touch with me.
Michael
|
|
|
|
 |
|
 |
It's just what I need.
Would you please send to me a copy? (loadcom@sina.com)
Thank in advance.
Max
|
|
|
|
 |
|
 |
And a suggest further, or feature request:
I hope the effect could be similar to that of the splash of Photoshop. The main features includes:
The app could to the data initializing work while the splash is showing, with a prompt text on the splash dynamically change showing the progress of the initializition. And, preferably, a progress bar showing this process.
Anybody has any hints?
Thanks
Max
|
|
|
|
 |
|
 |
Hi!
Yes, it's possible to change the text data while processing something in the background (I use it this way), but a progress bar is not available. Indeed this feature would be nice and if you would implement it, I would be appreciated to get a copy of your improvements...
Best Regards, Michael
|
|
|
|
 |
 | Great work jefflewis | 2:59 19 Sep '05 |
|
 |
Much appreciated - looks great. thanks J
|
|
|
|
 |
 | Sound sicks | 12:22 21 Jul '05 |
|
 |
Thanks
I'v quickly added a function of CSplashScreenEx to have a "Splash-song".
void SetSound(LPCTSTR szPath, HMODULE hMod, DWORD fdwSound);
void CSplashScreenEx::SetSound(LPCTSTR szPath, HMODULE hMod, DWORD fdwSound) { if(PathFileExists(szPath)) { PlaySound(szPath, hMod, fdwSound); } }
|
|
|
|
 |
 | Some errors when using in UNICODE project bitmensch | 2:59 15 Jul '05 |
|
 |
nice, but there are some errors when using in a UNICODE project.
|
|
|
|
 |
 | How to use the class in SDI or MDI project? sibang jang | 17:30 11 Jul '05 |
|
 |
bottom reply compile error.....
Create function error...
please fast reply?:
sdfwefw
|
|
|
|
 |
|
 |
use the APP Class in MDI project?
|
|
|
|
 |
 | Why parent window is needed? Yogurt | 10:47 23 Jun '05 |
|
 |
I've seen some questions and replies about the necessity of the parent window. However, in the environment I'd use CSplashScreenEx, there is simply no parent window yet. (I'd show the splash screen as one of my DLLs is loaded, and hide when the application is loaded and the main window is created and shown.)
Now I've made the following modifications to CSplashScreenEx::Create
BOOL CSplashScreenEx::Create(CWnd *pWndParent,LPCTSTR szText,DWORD dwTimeout,DWORD dwStyle) { m_pWndParent = pWndParent; HWND hParentWnd = NULL; if (m_pWndParent != NULL) hParentWnd = m_pWndParent->m_hWnd;
(and got rid of the assert). And at the end of this function:
if (!CreateEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST,"SplashScreenExClass",NULL,WS_POPUP,0,0,0,0,hParentWnd,NULL)) return FALSE;
The only restriction is that CSS_CENTERAPP cannot be used when pWndParent == NULL but that is obvious: if there's no parent window, where to center it?
|
|
|
|
 |
|
 |
I second this modification. I used it in InitInstance( ) when the main window had not been created. Anyway the codes are just great, so is the modification.
My 2 Cents
|
|
|
|
 |
|
 |
PERFECT!!!!
Thanks for the "fix"
|
|
|
|
 |
 | Windows 2000 SP4 Johnnyfartpants | 21:28 30 May '05 |
|
 |
Forgive me if this appears twice - but I posted this comment yesterday and it seems to have vanished this morning!?!
I've been using CSplashScreenEx very successfully for an app that runs under both Windows 2000 and XP. It's a great utility and has never caused any problems. However, a week or two ago I upgraded my copy of Win2K to Service Pack 4.
My splash screen implements a short "fade-in" via the CSS_FADE style (which, in turn, invokes the AW_BLEND property of AnimateWindow() ). This seems to have stopped working since the upgrade to SP4. I just wondered if anyone else had encountered this? The splash screen still displays - but not with the fade-in. Oddly enough, it does fade out though...??? I've tried the original application (SplashScreenExDemo) and that suffers from the same problem.
The same apps (i.e. the very same physical exe files) still work perfectly under Windows XP. Does this ring a bell or make sense to anyone else?
|
|
|
|
 |
|
 |
Well, it's now about 3 months since my upgrade and CSplashScreenEx continues to have problems with Win2k SP4. I also upgraded my copy of XP to Service Pack 2, since when, I've had intermittent problems with the code crashing and even locking up my entire machine. This is also happening on other peoples' PC's too so I've had to abandon the splash screen for the moment.
However, it would be nice to get to the bottom of this and get it fixed sometime.
|
|
|
|
 |
 | A better CreateRgnFromBitmap function kintz | 1:34 1 Mar '05 |
|
 |
Below is my re-worked code for the CreateRgnFromBitmap method. This fixes the last transparent pixel row issue and also fixes a weird random crash when building regions with certain images.
Anyhow here is the code:
HRGN SplashScreenI::CreateRgnFromBitmap(HBITMAP hBmp, COLORREF color) { if (!hBmp) return NULL;
BITMAP bm; GetObject( hBmp, sizeof(BITMAP), &bm );
CDC dcBmp; dcBmp.CreateCompatibleDC(GetDC()); dcBmp.SelectObject(hBmp);
CArray<CRect,CRect&> Regions;
int nState=-1; int nStart=0; bool bIsMask; for ( int y = 0; y < bm.bmHeight; ++y ) { nState = -1; nStart = 0; for ( int x = 0; x < bm.bmWidth; ++x ) { bIsMask=(dcBmp.GetPixel(x,bm.bmHeight-y-1)==color); switch( nState ) { case -1: if( bIsMask ) nState = 0; else nState = 1; nStart = 0; break; case 1: if( bIsMask ) { Regions.Add( CRect( nStart, bm.bmHeight - y - 1, x, bm.bmHeight - y) ); nState = 0; } break; case 0: if( !bIsMask ) { nStart = x; nState = 1; } break; } } if( nStart != x-1 && nState==1) { Regions.Add( CRect( nStart, bm.bmHeight - y - 1, bm.bmWidth, bm.bmHeight - y) ); } }
dcBmp.DeleteDC();
HRGN hRgn=CreateRectRgn(0, 0, 0, 0); ASSERT( hRgn!=NULL ); for( int i=0;i<(int)Regions.GetSize();++i ) { const CRect& rt = Regions[i]; HRGN hr=CreateRectRgn(rt.left, rt.top, rt.right, rt.bottom); VERIFY(CombineRgn(hRgn, hRgn, hr, RGN_OR)!=ERROR); if (hr) DeleteObject(hr); } ASSERT( hRgn!=NULL );
return hRgn; }
[edit] fixed angle brackets on template!
|
|
|
|
 |