Originally posted by: DannyBoy
Thanks for the sarcastic reply.
Code guru site will not load for me, ive searched on google, and i already have the google image
Can anyone help?
Thanks
Dan
Originally posted by: DaveSimmons
If you did something "different" to create your MFC app (i.e. didn't use the appwizard), the easiest thing to do may be to create a second junk MFC app in another folder, copy the folder, add the splash component to the junk app, then use windiff to compare the junk app folder to the copy you made. This will show you exactly which files were added and changed.
Or use one of the other splash windows from CTho9305's links.
Well that's probably why you're getting an error for the lack of a CWinApp class, since you don't have one.Originally posted by: DannyBoy
I didnt use the app wizard dave, I re-wrote it from scratch without plans to introduce a splash screen.
Note im using a bare Win32 API not MFC.
What is Windiff?
Thanks for your help so far![]()
Originally posted by: DaveSimmons
Well that's probably why you're getting an error for the lack of a CWinApp class, since you don't have one.Originally posted by: DannyBoy
I didnt use the app wizard dave, I re-wrote it from scratch without plans to introduce a splash screen.
Note im using a bare Win32 API not MFC.
What is Windiff?
Thanks for your help so far![]()
I believe the CSplashWnd component needs to be in an MFC app, so you can't use it -- look at the other splash window components linked to above and find one that says Win32 rather than MFC.
visual studio > tools > windiff is a file-differencing tool can can also be fed 2 folders and will then "diff" all the files inside those two foldders. Try it, it's very very useful if you ever make a bad change and are not sure exactly which files have changed or how.
My includes are set as follows:
#include "stdafx.h"
#include "resource.h"
#include "SPLASH.h"
//
SPLASH mysplash;
#include "SPLASH.cpp"
#include <io.h>
VOID ExceptionHandler(LPEXCEPTION_POINTERS p_Ex, ULONG ulEx )
{
OutputDebugString("Exception Handler\n");
}
LRESULT CALLBACK KyxCasterWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
P_KYXWINDOWDATA p_KyxWindowData;
POINT ptMouse;
int nUdpConnections;
int nTcpLiveConn;
int nTcpFileConn;
if (message == WM_CREATE)
mysplash.Init(hwnd,hInst,IDB_SPLASH); << This is line 388 for error's
mysplash.Show();
//simulate lengthy window initialization
Sleep(4000);
//hide the splash screen as the main window appears
mysplash.Hide(); <<This italic paragraph.
{
BOOL bMenuResult;
SetTimer(hwnd,ID_TIMER, 1000, NULL);
p_KyxWindowData = (P_KYXWINDOWDATA)MemAlloc(sizeof(KYXWINDOWDATA));
p_KyxWindowData->usState = 0;
p_KyxWindowData->bFrameShowing = true;
p_KyxWindowData->usStart = 0;
Now im getting the error kyxcaster.cpp(388) : error C2065: 'hInst' : undeclared identifier when i try to compile?
Im not sure what im doing wrong here...
Hope you can help with this one Dave, or anyone else....
Thanks,
Dan![]()
//globals
CHAR chKyxclass[] = "KYXCLASS";
CHAR chIniFile[] = "kyxcast.ini";
INT tabs[] = {75,140,300};
INT tabs2[] = {260,400,710};
SPLASH mysplash;
HINSTANCE hinst;
etc etc
//--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
// Func: WinMain
// Desc: GUI entry win32 program
//--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
INT WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
{
hinst = hInstance;
MainInit();
MainServer();
MainGui();
MainCleanup();
return(FALSE);
}
//--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
// Func: ExceptionHandler
// Desc: This routine is called when a __try fails to complete
//--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
VOID ExceptionHandler(LPEXCEPTION_POINTERS p_Ex, ULONG ulEx )
{
OutputDebugString("Exception Handler\n");
}
LRESULT CALLBACK KyxCasterWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
P_KYXWINDOWDATA p_KyxWindowData;
POINT ptMouse;
int nUdpConnections;
int nTcpLiveConn;
int nTcpFileConn;
if (message == WM_CREATE)
mysplash.Init(hwnd,hInst,IDB_SPLASH);
mysplash.Show();
//simulate lengthy window initialization
Sleep(4000);
//hide the splash screen as the main window appears
mysplash.Hide();
{
etc etc
// SPLASH.h: interface for the SPLASH class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_SPLASH_H__41182F11_BB6F_11D6_B0F5_00B0D01AD687__INCLUDED_)
#define AFX_SPLASH_H__41182F11_BB6F_11D6_B0F5_00B0D01AD687__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class SPLASH
{
public:
void Hide();
void Show();
void Init(HWND hWnd,HINSTANCE hInst,int resid);
BOOL SHOWING;
SPLASH();
virtual ~SPLASH();
private:
UINT TimerID;
HWND hParentWindow;
HWND hSplashWnd;
};
#endif // !defined(AFX_SPLASH_H__41182F11_BB6F_11D6_B0F5_00B0D01AD687__INCLUDED_)
.// SPLASH.cpp: implementation of the SPLASH class.
//
//////////////////////////////////////////////////////////////////////
#include "stdAfx.h"
#include "SPLASH.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
SPLASH::SPLASH()
{
}
SPLASH::~SPLASH()
{
DestroyWindow(hSplashWnd);
}
void SPLASH::Init(HWND hWnd,HINSTANCE hInst,int resid)
{
hParentWindow=hWnd;
hSplashWnd=CreateWindowEx(WS_EX_CLIENTEDGE,"STATIC","",
WS_POPUP|WS_DLGFRAME|SS_BITMAP,300,300,300,300,hWnd,NULL,hInst,NULL);
SendMessage(hSplashWnd,STM_SETIMAGE,IMAGE_BITMAP,(LPARAM)LoadBitmap(hInst,MAKEINTRESOURCE(resid)));
this->SHOWING = FALSE;
}
void SPLASH::Show()
{
//get size of hSplashWnd (width and height)
int x,y;
int pwidth,pheight;
int tx,ty;
HDWP windefer;
RECT rect,prect;
GetClientRect(hSplashWnd,&rect);
x=rect.right;y=rect.bottom;
//get parent screen coordinates
GetWindowRect(this->hParentWindow,&prect);
//center splash window on parent window
pwidth=prect.right-prect.left;
pheight=prect.bottom - prect.top;
tx=(pwidth/2) - (x/2);
ty=(pheight/2) - (y/2);
tx+=prect.left;
ty+=prect.top;
windefer=BeginDeferWindowPos(1);
DeferWindowPos(windefer,hSplashWnd,HWND_NOTOPMOST,tx,ty,50,50,SWP_NOSIZE|SWP_SHOWWINDOW|SWP_NOZORDER);
EndDeferWindowPos(windefer);
ShowWindow(hSplashWnd,SW_SHOWNORMAL);
UpdateWindow(hSplashWnd);
this->SHOWING = TRUE;
}
void SPLASH::Hide()
{
ShowWindow(hSplashWnd,SW_HIDE);
this->SHOWING = FALSE;
}
wcex.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
wcex.lpfnWndProc = KyxCasterWndProc;
wcex.cbClsExtra = 0;
// wcex.cbWndExtra = 1 * sizeof(LONG_PTR);
wcex.cbWndExtra = 1 * sizeof(LONG);
wcex.hInstance = g_hinst;
wcex.hIcon = LoadIcon (g_hinst, MAKEINTRESOURCE(IDI_KYXCASTER));
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = CreateSolidBrush(RGB(0,0,0));
wcex.lpszMenuName = (LPCSTR)KYXCASTER;
wcex.lpszClassName = chKyxclass;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_KYXCASTER));
RegisterClassEx(&wcex);
