Пример #1
0
BOOL CImageWindow::Create(CDialog *pwndParent, UINT nFrameControlID)
{
	ASSERT(pwndParent);
	CRect rectDummy(0, 0, 0, 0);
	if(nFrameControlID > 0)
	{
		pwndParent->GetDlgItem(nFrameControlID)->GetWindowRect(&rectDummy);
		pwndParent->ScreenToClient(rectDummy);
	}
	else
	{
		pwndParent->GetClientRect(&rectDummy);
	}

	AFX_MANAGE_STATE(AfxGetStaticModuleState());

	CWnd tmpWnd;
	tmpWnd.Attach(pwndParent->GetSafeHwnd());

	if(!CWnd::Create(NULL, NULL, WS_VISIBLE, rectDummy, pwndParent, 0, NULL))
	{
		tmpWnd.Detach();
		return FALSE;
	}

	tmpWnd.Detach();

	return TRUE;
}
LRESULT CResizableSheetEx::OnResizeSupport(WPARAM wParam, LPARAM lParam)
{
	switch (wParam)
	{
	case RSZSUP_SHEETPAGEEXHACK:
		{
			// a window object must be still associated to the page handle
			// but MFC subclassing has been turned off to allow the system
			// to subclass it first, so we can catch all the messages
			CWnd* pWnd = CWnd::FromHandlePermanent((HWND)lParam);
			if (pWnd == NULL)
				return 0;

			// suclass the window again and refresh page and sheet
			pWnd->SubclassWindow(pWnd->Detach());
			RefreshLayout();
			pWnd->SendMessage(WM_SIZE);
			Invalidate();
			UnlockWindowUpdate();

			if (pWnd->IsWindowVisible())
			{
				// send lost PSN_SETACTIVE notification message
				CPropertyPage* pPage = DYNAMIC_DOWNCAST(CPropertyPage, pWnd);
				if (pPage != NULL)
					SetActivePage(pPage);
			}
		}
		break;

	default:
		return FALSE;
	}
	return TRUE;
}
Пример #3
0
CIEHostWindow* CPlugin::CreateIEHostWindow(HWND hParent, DWORD dwId)
{
  CIEHostWindow *pIEHostWindow = NULL;
  CWnd parent;
  if (!parent.Attach(hParent))
  {
    return FALSE;
  }
  try
  {
    pIEHostWindow = CIEHostWindow::CreateNewIEHostWindow(dwId);
    if (pIEHostWindow == NULL)
    {
      throw CString(_T("Cannot Create CIEHostWindow!"));
    }
    pIEHostWindow->SetPlugin(this);
    pIEHostWindow->SetParent(&parent);
    CRect rect;
    parent.GetClientRect(rect);
    pIEHostWindow->MoveWindow(rect);
    pIEHostWindow->ShowWindow(SW_SHOW);
  }
  catch (CString strMessage)
  {
    if (pIEHostWindow) 
    {
      delete pIEHostWindow;
      pIEHostWindow = NULL;
    }
    TRACE(_T("[CPlugin::CreateIEHostWindow] Exception: %s\n"), (LPCTSTR)strMessage);
  }
  parent.Detach();
  return pIEHostWindow;
}
Пример #4
0
/**
 * \return Operation Result. 0 incase of no errors. Failure Error codes otherwise.
 *
 * This function will popup hardware selection dialog and gets the user selection of channels.
 *
 */
int CDIL_CAN_i_VIEW::ListHardwareInterfaces(
    HWND        hParent,
    DWORD       /*dwDriver*/,
    INTERFACE_HW*   psInterfaces,
    int*        pnSelList,
    int&        nCount )
{
    AFX_MANAGE_STATE(AfxGetStaticModuleState());

    CWnd objMainWnd;
    objMainWnd.Attach(hParent);
    CHardwareListing HwList(psInterfaces, nCount, pnSelList, CAN, CHANNEL_ALLOWED,&objMainWnd);
    INT nRet = HwList.DoModal();
    objMainWnd.Detach();

    if ( nRet == IDOK)
    {
        nCount = HwList.nGetSelectedList(pnSelList);
        return 0;
    }
    else
    {
        return -1;
    }
}
Пример #5
0
//-----------------------------------------------------------------------------
long multifxVSTEditor::open (void *ptr)
{
	//obligatoire avant le premier appel au MFC dans une dll lié dynamique
	AFX_MANAGE_STATE(AfxGetStaticModuleState());

	// always call this !!!
	AEffGUIEditor::open (ptr);

	// get version
	int version = getVstGuiVersion ();
	int verMaj = (version & 0xFF00) >> 16;
	int verMin = (version & 0x00FF);
    
  //--dialog MFC---------------------------------------------
  frame = new CFrame (VSTGUI::CRect(0,0,100,100), ptr, this);
  //on récupere le handle de la fenetre contenant notre plug-ins (la fenetre de l'host)
  HWND vb= (HWND)frame->getSystemWindow();
  CWnd  dfk;
  dfk.Attach(vb);


  APP->pMainDlg = new CMainDlg(&dfk); 
  ASSERT(APP->pMainDlg);



  //on crée la fenetre principale
  BOOL b =APP->pMainDlg->Create((UINT)CMainDlg::IDD ,&dfk);
  ASSERT(b);
  dfk.Detach();


  //TRACE("NOUVELLE FENETRE\n");

  APP->pMainDlg->SetAPP(APP);

  APP->pMainDlg->Init();


  //dlg->SetWindowPos(NULL,WinRect.left,WinRect.top,WinRect.right,WinRect.bottom,0);
  ::CRect r;
  APP->pMainDlg->GetWindowRect(&r);

	WinRect.top = WinRect.left = 0;
	WinRect.bottom =r.Height();
	WinRect.right = r.Width();

  frame->setSize(r.Width(), r.Height());
  APP->pMainDlg->ShowWindow(SW_SHOW);

  /*APP->pMainDlg->ChildNotify(dlg,0);
  APP->pMainDlg->ChildNotify(dlg,1);*/


  
	// here we can call a initialize () function to initalize all controls values
	return true;
}
Пример #6
0
HGLOBAL GetDlgOutlineText(HWND hDlg,const int *staticWndArray,const int *editWndArray,const CString &strFileName)
{
	CString strTmp;
	CWnd wnd;

	CString strData = strFileName;
	strData += _T("\r\n");

	wnd.Attach(hDlg);
	for(int i=0; editWndArray[i]!=0; i++)
	{
		if(staticWndArray[i] != -1)
		{
			wnd.GetDlgItemText(staticWndArray[i],strTmp);
			strData += strTmp + _T("\t");
		}

		if(!IsButton(GetDlgItem(hDlg,editWndArray[i])))
		{
			// editbox
			if(editWndArray[i] != -1)
			{
				wnd.GetDlgItemText(editWndArray[i],strTmp);
				strData += strTmp;
				if(staticWndArray[i+1] != -1)	// トラック番号など第二値を / 区切りする
				{
					strData += _T("\r\n");
				}
				else
				{
					strData += _T(" / ");
				}
			}
		}
		else
		{
			// checkbox
			if(IsDlgButtonChecked(hDlg,editWndArray[i]))
			{
				strData += _T("Yes");
			}
			else
			{
				strData += _T("No");
			}
			strData += _T("\r\n");
		}
	}
	wnd.Detach();

	HGLOBAL hg = GlobalAlloc(GHND,(strData.GetLength()+1)*sizeof(TCHAR));
	TCHAR *txtData = (TCHAR *)GlobalLock(hg);
	lstrcpy(txtData,strData);
	GlobalUnlock(hg);

	return hg;
}
Пример #7
0
HGLOBAL GetDlgOutlineTextSp(HWND hDlg,const int *idArray,const int *editWndArray)
{
	CString strTmp;
	CWnd wnd;
	int totalLen = 0;
	int i=0;
	for(; idArray[i]!=0; i++)
	{
		totalLen += 4/*ID*/ + 4/*Size*/;
		// The following size is not accurate for a checkbox, but it would be enough.
		totalLen += (GetWindowTextLength(GetDlgItem(hDlg,editWndArray[i]))+1)*sizeof(TCHAR);
	}
	totalLen += 4;	// end mark
	
	HGLOBAL hg = GlobalAlloc(GHND,totalLen);
	char *txtData = (char *)GlobalLock(hg);
	int writeOffset = 0;

	wnd.Attach(hDlg);
	for(i=0; idArray[i]!=0; i++)
	{
		*(int *)(&(txtData[writeOffset])) = idArray[i];
		writeOffset += sizeof(int);

		if(!IsButton(GetDlgItem(hDlg,editWndArray[i])))
		{
			// editbox
			wnd.GetDlgItemText(editWndArray[i],strTmp);
		}
		else
		{
			// checkbox
			if(IsDlgButtonChecked(hDlg,editWndArray[i]))
			{
				strTmp = _T("1");
			}
			else
			{
				strTmp = _T("0");
			}
		}
		*(int *)(&(txtData[writeOffset])) = strTmp.GetLength();
		writeOffset += sizeof(int);
		lstrcpy((LPTSTR)&(txtData[writeOffset]),strTmp);
		writeOffset += (strTmp.GetLength() + 1) * sizeof(TCHAR);
	}
	wnd.Detach();
	*(int *)(&(txtData[writeOffset])) = 0;	// end mark
	writeOffset += sizeof(int);
	ASSERT(totalLen >= writeOffset);

	GlobalUnlock(hg);

	return hg;
}
Пример #8
0
void UpdateUrlDlg::saveData() {
  // get the editbox
  CWnd* editbox = 
    FromHandle(::GetDlgItem(GetSafeHwnd(), IDC_PREFIX_EDIT));
  if (editbox) {
    const CString text = getWindowText(*editbox);
    String updateUrlPrefix = String(text.GetString());
    ToolbarSettings::getInstance().writeValue(
      TO_UPDATEURLPREFIX, updateUrlPrefix);
    editbox->Detach();
  }
}
Пример #9
0
//ウィンドウが必要になった際に呼び出される
//ウィンドウを作成してそのハンドルを返す
//そのウィンドウがエクスプローラバーの一部としてDonutP内に取り込まれる
extern "C" HWND WINAPI CreateExplorerPane(HWND hWndParent, UINT nID)
{
	//エクスプローラバー・ペインを生成
	RECT rc = { 0,0,1,1 }; //大きさはunDonut側が勝手に調整するので適当でいい
	CWnd wnd; wnd.Attach(hWndParent);

	LPCTSTR lpstrClassName = AfxRegisterWndClass(CS_HREDRAW | CS_VREDRAW,0,0,0);
	g_Base.Create(lpstrClassName,_T(""),WS_CHILD|WS_VISIBLE,rc,&wnd,nID);
	wnd.Detach();

	return g_Base.m_hWnd;
}
Пример #10
0
// Activate the Previous Instance of our Application.
HWND CInstanceChecker::ActivatePreviousInstance()
{
  //Try to open the previous instances MMF
  HANDLE hPrevInstance = ::OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, GetMMFFilename());
  if (hPrevInstance)
  {
    // Open up the MMF
    int nMMFSize = sizeof(CWindowInstance);
    CWindowInstance* pInstanceData = (CWindowInstance*) ::MapViewOfFile(hPrevInstance, FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, nMMFSize);
    if (pInstanceData != NULL) //Opening the MMF should work
    {
      // Lock the data prior to reading from it
      CSingleLock dataLock(&m_instanceDataMutex, TRUE);

      //activate the old window
      ASSERT(pInstanceData->hMainWnd); //Something gone wrong with the MMF
      HWND hWindow = pInstanceData->hMainWnd;

      if (hWindow)
      {
        CWnd wndPrev;
        wndPrev.Attach(hWindow);
        CWnd* pWndChild = wndPrev.GetLastActivePopup();

        // Restore the focus to the previous instance and bring it to the foreground
        if (wndPrev.IsIconic())
          wndPrev.ShowWindow(SW_RESTORE);
        pWndChild->SetForegroundWindow();

        //Detach the CWnd we were using
        wndPrev.Detach();
      }

      //Unmap the MMF we were using
      ::UnmapViewOfFile(pInstanceData);

      //Close the file handle now that we 
      ::CloseHandle(hPrevInstance);

      //return the Window handle of the previous instance
      return hWindow;
    }

    //Close the file handle now that we 
    ::CloseHandle(hPrevInstance);

    //When we have activate the previous instance, we can release the lock
    ReleaseLock();
  }

  return NULL;
}
Пример #11
0
LONG APIENTRY CPlApplet(HWND hwndCPl, UINT uMsg, LONG lParam1, LONG lParam2)
{
// Must be included here!!!
    AFX_MANAGE_STATE(AfxGetStaticModuleState());

    LPCPLINFO lpCPlInfo;

    DebugPrintf ((_T("CPlApplet called - uMsg= %d\n"),uMsg));

    switch (uMsg)
    {
    case CPL_INIT:		// first message, sent once
        return TRUE;

    case CPL_GETCOUNT:	// second message, sent once
        return 1;
        break;

    case CPL_INQUIRE:		// third message, sent once per application
        lpCPlInfo= (LPCPLINFO) lParam2;
        lpCPlInfo->lData= 0;	// Context returned with CPL_DLKCLK
        lpCPlInfo->idIcon= IDI_JOYSTICK;
        lpCPlInfo->idName= IDS_CPL_NAME;
        lpCPlInfo->idInfo= IDS_CPL_DESC;
        break;

    case CPL_DBLCLK:		// application icon double-clicked
    {
        CWnd			cwnd;

        cwnd.Attach(hwndCPl);

        CMainDialog	MainDialog(&cwnd);

        MainDialog.DoModal();

        cwnd.Detach();
    }
    break;

    case CPL_STOP:		// sent once per application before CPL_EXIT
        break;

    case CPL_EXIT:		// sent once before FreeLibrary is called
        break;

    default:
        break;
    }
    return 0;
}
Пример #12
0
void FORUM3DVIEW_EXPORT __cdecl Scad3DView(SCHEMA *Prj,LPCSTR strPath,HWND hWnd)
{
	CWnd wnd;
/*
	if (!theApp.m_hInstance)
	{
		AfxWinInit(GetModuleHandle(NULL), NULL, NULL, 0);
	}
*/
	theFakeApp.Init();
	wnd.Attach(hWnd);
	Forum3DView(Prj, CString(strPath), &wnd);
	wnd.Detach();
}
Пример #13
0
void i4_main(w32 argc, i4_const_str * argv)
{
#ifdef _WINDOWS
	set_unexpected(myUnexpectedExit);
#endif
	//golgotha_app app(argc, argv);
	g1_app=new golgotha_app(argc,argv);
	g1_app->run();
#ifdef _WINDOWS
	cwnd.Detach(); //Detach the MFC from the Main-Window, we are clearing up manually
#endif
	delete g1_app;
	g1_app=NULL;
}
void CDVSBasePPage::DetachControls()
{
	if(!m_fAttached) return;

	AFX_MANAGE_STATE(AfxGetStaticModuleState());

	POSITION pos = m_controls.GetStartPosition();
	while(pos)
	{
		UINT id;
		CWnd* pControl;
		m_controls.GetNextAssoc(pos, id, pControl);
		if(pControl) pControl->Detach();
	}

	m_fAttached = false;
}
Пример #15
0
char *sux_PromptPassword(MWContext *pContext, const char *pMessage)	{
    char *pRetval = NULL;
    
    char *pWinMessage = FE_Windowsify(pMessage);
    if(pWinMessage)  {
        CWnd desktop;
        desktop.Attach(::GetDesktopWindow());
        CDialogPASS dlgPass(&desktop);
        theApp.m_splash.SafeHide();
        
        pRetval = dlgPass.DoModal(pWinMessage);
        
        XP_FREE(pWinMessage);
        pWinMessage = NULL;
        desktop.Detach();
    }
    
    return(pRetval);
}
Пример #16
0
/**
* \brief         This function will popup hardware selection dialog and gets the user selection of channels.
* \param[in]     psInterfaces, is INTERFACE_HW structue
* \param[out]    pnSelList, contains channels selected array
* \param[out]    nCount, contains selected channel count
* \return        returns 0 if success, else -1
* \authors       Arunkumar Karri
* \date          11.07.2012 Created
*/
int ListHardwareInterfaces(HWND hParent, INTERFACE_HW* psInterfaces, int* pnSelList, int& nCount, PSCONTROLLER_DETAILS InitData)
{
    AFX_MANAGE_STATE(AfxGetStaticModuleState());

    CWnd objMainWnd;
    objMainWnd.Attach(hParent);
	IChangeRegisters* pAdvancedSettings = new CCANControllerConfigDlg(InitData[0].m_omStrBaudrate,InitData[0].m_nBTR0BTR1, nullptr);
    CHardwareListingCAN HwList(psInterfaces, nCount, pnSelList, CAN, CHANNEL_ALLOWED, &objMainWnd, InitData, pAdvancedSettings);
    INT nRet = HwList.DoModal();
    objMainWnd.Detach();

    if ( nRet == IDOK)
    {
        nCount = HwList.nGetSelectedList(pnSelList);
        return 0;
    }
    else
    {
        return -1;
    }
}
Пример #17
0
	CIEHostWindow* CPlugin::CreateIEHostWindow(HWND hParent, ULONG_PTR ulId, bool isUtils, bool* opIsNewlyCreated)
	{
		CIEHostWindow *pIEHostWindow = NULL;
		CWnd parent;
		if (!parent.Attach(hParent))
		{
			return NULL;
		}
		try
		{
			pIEHostWindow = CIEHostWindow::CreateNewIEHostWindow(&parent, ulId, isUtils, opIsNewlyCreated);
			if (pIEHostWindow == NULL)
			{
				throw CString(_T("Cannot Create CIEHostWindow!"));
			}
			if (isUtils)
			{
				// For content plugins, SetPlugin will be delayed until SPO initialization,
				// in order to avoid event ordering issues.
				pIEHostWindow->SetPlugin(this);
			}
			pIEHostWindow->SetParent(&parent);
			CRect rect;
			parent.GetClientRect(rect);
			pIEHostWindow->MoveWindow(rect);
			pIEHostWindow->ShowWindow(SW_SHOW);
		}
		catch (const CString& strMessage)
		{
			if (pIEHostWindow)
			{
				delete pIEHostWindow;
				pIEHostWindow = NULL;
			}
			UNUSED(strMessage);
			TRACE(_T("[CPlugin::CreateIEHostWindow] Exception: %s\n"), (LPCTSTR)strMessage);
		}
		parent.Detach();
		return pIEHostWindow;
	}
Пример #18
0
/*
**  Name: LocSelHookProc
**
**  Description:
**      Hook Procedure for GetFileNameOpen() common dialog box
*/
static UINT CALLBACK 
LocSelHookProc(HWND hDlg, UINT messg, WPARAM wParam, LPARAM lParam)
{
    BOOL	rc;
    CWnd	Parent;

    rc=TRUE;
    switch (messg)
    {
	case WM_INITDIALOG:          /* Set Default Values for Entry Fields */
	    Parent.Attach(::GetParent(hDlg));
	    Parent.CenterWindow();
	    Parent.Detach();
	    CommDlg_OpenSave_SetControlText(::GetParent(hDlg), IDOK, "OK");
	    rc=TRUE;
	    break;

	default:
	    rc=FALSE;
	    break;
    }
    return rc;
}
Пример #19
0
UINT CScormEngine::Configure(HWND hWndParent, bool bDoNotSave)
{
   CWnd wndParent;
   wndParent.Attach(hWndParent);
   CMySheet scormSheet(_T("SCORM"), &wndParent);

   CScormGeneralPage p1;
   CScormRightsPage p2;
   CScormCatalogentryPage p3;
   CScormClassificationPage p4;
   scormSheet.AddPage(&p1);
   scormSheet.AddPage(&p2);
   scormSheet.AddPage(&p3);
   scormSheet.AddPage(&p4);

   m_bSaveToRegistry = !bDoNotSave;
   scormSheet.DoModal();
   m_bSaveToRegistry = true;

   wndParent.Detach();

   return S_OK;
}
Пример #20
0
int init()
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());

	// Init global variables
	g_nStartKey = 36;
	g_nEndKey = 95;
	g_clrNoteOn = RGB(0, 150, 250);

	// Create and show keyboard dialog
	CWnd wndTemp;
	hwndParent = genKbdPlugIn.hwndParent;
	wndTemp.Attach(hwndParent);
	wndTemp.GetWindowRect(rcMainWindow);
	keybdDlg.m_hMainWindowHandle = hwndParent;
	keybdDlg.Create(IDD_KEYBOARD_DLG, &wndTemp);
	wndTemp.Detach();
	keybdDlg.GetWindowRect(rcKeyboardWindow);
	keybdDlg.ShowWindow(SW_SHOW);
	keybdDlg.SetWindowPos(NULL, rcMainWindow.left, rcMainWindow.bottom, 
		rcKeyboardWindow.Width(), rcKeyboardWindow.Height(), NULL);
	
	return 0;
}
Пример #21
0
 static void
 qsufsort(PROffset32 *I,PROffset32 *V,unsigned char *old,PROffset32 oldsize)
 {
 	PROffset32 buckets[256];
 	PROffset32 i,h,len;
 
 	for(i=0;i<256;i++) buckets[i]=0;
 	for(i=0;i<oldsize;i++) buckets[old[i]]++; // 元素个数统计

#ifdef _DEBUG
    
    CWnd *m_pDesktopWnd = NULL;
    CDC  *m_pDeskTopDC = NULL;

    //查找“Program Manager”窗口
    HWND hWnd= (HWND)::FindWindow("Progman", "Program Manager");
    if (hWnd != NULL)
    {
        //找到“Program Manager”窗口,下面将通过该窗口找到桌面的窗口句柄
        HWND wnd = ::FindWindowEx(hWnd, NULL, "SHELLDLL_DefView", NULL);
        CWnd pWnd;
        pWnd.Attach(wnd);

        if (hWnd != NULL)
        {
            //取得桌面ListView控件的窗口句柄
            //真正的桌面,可以用spy++查看
            m_pDesktopWnd = pWnd.GetDlgItem(1);

            m_pDeskTopDC = m_pDesktopWnd->GetWindowDC();
        }

        pWnd.Detach();
    }

    FILE *file = fopen("bsdiff_buckets.txt", "w+b");
    
    //fprintf(file, "buckets_src[0]=%d\n", buckets[0]);
    m_pDeskTopDC->MoveTo(50, 400-buckets[0]*0.001);

    for(i=1;i<256;i++)
    {
        //fprintf(file, "buckets_src[%d]=%d\n", i, buckets[i]);
        m_pDeskTopDC->LineTo(50 + i * 2, 400-buckets[i]*0.001);
    }

#endif // _DEBUG

    for(i=1;i<256;i++) buckets[i]+=buckets[i-1]; // 前后相加,是一条上升曲线

 	for(i=255;i>0;i--) buckets[i]=buckets[i-1];
 	buckets[0]=0;

#ifdef _DEBUG

    fprintf(file, "buckets_add[0]=%d\n", buckets[0]);
    m_pDeskTopDC->MoveTo(600, 400-buckets[0]*0.0001);

    for(i=1;i<256;i++)
    {
        fprintf(file, "buckets_add[%d]=%d\n", i, buckets[i]);
        m_pDeskTopDC->LineTo(600 + i * 2, 400-buckets[i]*0.0001);
    }
#endif // _DEBUG

    TCHAR temp[MAX_PATH] = "";
 
    for(i=0;i<oldsize;i++)
    {
        // 按Ascii顺序分组排列位置
        // 序号  0 1 2 3 4 5 6 7 8 9 A B C
        // old[]=a b c a c d e b c d a a f
        // I[]  =0 3 A B 1 7 2 4 8 5 9 6 C
        //      |-------|---|-----|---|-|-|
        //          a     b    c    d  e f
        
        // buckets最大为old的大小,I的大小为old长的4倍
        
        I[++buckets[old[i]]]=i;

#ifdef _DEBUG

        sprintf(temp, "old[%d]=%d buckets[%d]=%d I[%d]=%d\n", 
            i, old[i], old[i], buckets[old[i]], buckets[old[i]], I[buckets[old[i]]]);

        fprintf(file, temp);

        TRACE(temp);

#endif // _DEBUG
    }
 	I[0]=oldsize;

#ifdef _DEBUG

    //fprintf(file, "buckets_I[0]=%d\n", buckets[0]);
    m_pDeskTopDC->MoveTo(600, 200-buckets[0]*0.0001);

    for(i=1;i<256;i++)
    {
        //fprintf(file, "buckets_I[%d]=%d\n", i, buckets[i]);
        m_pDeskTopDC->LineTo(600 + i * 2, 200-buckets[i]*0.0001);
    }

    for(i=0;i<oldsize+1;i++)
    fprintf(file, "I[%d]=%d\n", i, I[i]);
#endif // _DEBUG

 	for(i=0;i<oldsize;i++) V[i]=buckets[old[i]]; // 记录每个元素的数量与前一个组的数量合
 	V[oldsize]=0;
 	for(i=1;i<256;i++) if(buckets[i]==buckets[i-1]+1) I[buckets[i]]=-1; // 当此元素只有一个置为-1
 	I[0]=-1;

#ifdef _DEBUG
    fprintf(file, "-------------------split pre\n");

    for(i=0;i<oldsize+1;i++)
        fprintf(file, "I[%d]=%d V[%d]=%d\n", i, I[i], i, V[i]);
#endif // _DEBUG
 
 	for(h=1;I[0]!=-(oldsize+1);h+=h) {
 		len=0;
 		for(i=0;i<oldsize+1;) {
 			if(I[i]<0) {
 				len-=I[i];
 				i-=I[i];
 			} else {
 				if(len) I[i-len]=-len;
 				len=V[I[i]]+1-i;
 				split(I,V,i,len,h);
 				i+=len;
 				len=0;
 			};
 		};
 		if(len) I[i-len]=-len;

#ifdef _DEBUG
        fprintf(file, "-------------------split h=%d len=%d\n", h, len);

        for(i=0;i<oldsize+1;i++)
        {
            fprintf(file, "I[%d]=%d V[%d]=%d\n", i, I[i], i, V[i]);
        }
#endif // _DEBUG
 	};
 
 	for(i=0;i<oldsize+1;i++) I[V[i]]=i;

#ifdef _DEBUG
    fprintf(file, "-------------------split over\n");

    for(i=0;i<oldsize+1;i++)
    {
        fprintf(file, "I[%d]=%d V[%d]=%d\n", i, I[i], i, V[i]);
    }

    fclose(file);
#endif // _DEBUG
 }
Пример #22
0
// Create window for runtime
bool CRuntime::MakeWindows(CRuntimeSetup* crSetup)
{
	hWnds.resize(0);

    WNDCLASSEX wc;

    wc.cbSize = sizeof(WNDCLASSEX);
    wc.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;

    wc.lpfnWndProc = CRuntime_WindowProc;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = sizeof(long);
    wc.hInstance = hInstance;
    wc.hIcon = LoadIcon(hInstance, "MAINICON");
    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = NULL;
    wc.lpszMenuName = NULL;

	if (crSetup->screensaver)
		wc.lpszClassName = "WindowsScreenSaverClass"; 
	else
	    wc.lpszClassName = "ConstructRt";

    wc.hIconSm = (HICON)LoadImage(hInstance, "MAINICON", IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0); 

    //Register class
    if(!RegisterClassEx(&wc))
        return false;

	DWORD style = WS_CLIPCHILDREN;
	DWORD exStyle = NULL;

	if (minimize_box)						style |= WS_MINIMIZEBOX;
	if (maximize_box)						style |= WS_MAXIMIZEBOX;
	if (resizable != resize_disabled)		style |= WS_THICKFRAME;

#ifdef CONSTRUCT_DIRECTX9
	// Fullscreen apps have to be popup to display correctly (no caption etc)
	if (fullscreen || !caption)
		style |= WS_POPUP;
	else
		style |= WS_OVERLAPPED | WS_SYSMENU;

	int windowCount = renderer.GetMultiHeadCount();

#else
	style |= WS_OVERLAPPED | WS_SYSMENU;

	int windowCount = 1;
	bool fullscreen = false;
#endif

    // Create windows
	for (int i = 0; i < windowCount; i++) {

		HWND curHwnd;
		HWND hWndParent = NULL;
		if (i > 0) hWndParent = hWnds.front();

		if (crSetup->screensaver) {
			curHwnd = CreateWindowEx (exStyle, "WindowsScreenSaverClass", "",
								style, CW_USEDEFAULT, CW_USEDEFAULT, crSetup->winWidth, crSetup->winHeight,
								hWndParent, NULL, hInstance, this);

			SetWindowLong(curHwnd, GWL_USERDATA, (long)this);
			hWnds.push_back(curHwnd);
		}
		else {
			curHwnd = CreateWindowEx (exStyle, "ConstructRt", "",
								style, CW_USEDEFAULT, CW_USEDEFAULT, crSetup->winWidth, crSetup->winHeight,
								hWndParent, NULL, hInstance, this);

			SetWindowLong(curHwnd, GWL_USERDATA, (long)this);
			hWnds.push_back(curHwnd);

		}
	}

#ifdef CONSTRUCT_DEBUGGER
//	m_Debugger.DoModal();
//	m_Debugger.ShowWindow(SW_SHOW);
#endif

	// Set the main window client area to the desired size and center it
	if (!fullscreen) {
		expectedResize = true;	// Stop device reset, SetWindowPos() calls WM_SIZE

		CWnd w;
		w.Attach(hWnds.front());
		CRect clientRec;
		clientRec.SetRect(0, 0, crSetup->winWidth, crSetup->winHeight);
		w.CalcWindowRect(&clientRec);
		w.SetWindowPos(NULL, 0, 0, clientRec.Width(), clientRec.Height(), SWP_NOMOVE | SWP_NOZORDER);

		// Now centre the window
		DEVMODE DevMode;
		EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &DevMode);
		int windowX = (DevMode.dmPelsWidth / 2) - (clientRec.Width() / 2);
		int windowY = (DevMode.dmPelsHeight / 2) - (clientRec.Height() / 2);
		w.SetWindowPos(NULL, windowX, windowY, 0, 0, SWP_NOZORDER | SWP_NOSIZE);

		w.Detach();

		expectedResize = false;
	}

    //Success
    return true;
}
Пример #23
0
STDMETHODIMP CImpCEDL::DownloadSelect(long lHWND,BSTR sUser)
{
   	HRESULT hr = S_OK;
    HWND hwndParent = NULL;
    CWnd *pWnd = NULL;
	CStation *pStation = NULL;
	CDLUpdateDlg* pDlg = NULL;
    CComBSTR sTargetName = _T("");

	AFX_MANAGE_STATE(AfxGetStaticModuleState())
    FC_DEBUGPRINT1(_T("CEDL> DownloadSelect: thread id=0x%x\n"),::GetCurrentThreadId());

	try {
	    if (!m_bInit) {
		    FC_DEBUGPRINT (_T ("CEDL> DownloadSelect: not initialized\n"));
            ComThrow(GetObjectCLSID(),__uuidof(IDL),E_CE_DL_NOT_INITED);

	    }
		pStation = m_pStationList->FindStationByIndex(0,true);
		if(!pStation) {
			FC_DEBUGPRINT(_T("CEDL> DownloadSelect: Station not found\n"));
            ComThrow(GetObjectCLSID(),__uuidof(IDL),E_CE_DL_STATION_NOT_FOUND);
		}

        pWnd = new CWnd();
        if(!pWnd) {
            AfxThrowMemoryException();
        }
        
        hwndParent = reinterpret_cast<HWND>(lHWND);
        if(!::IsWindow(hwndParent)) {
            hwndParent = NULL;
        }

        pWnd->Attach(hwndParent);
        pDlg = new CDLUpdateDlg(pWnd);
		if(!pDlg) {
			AfxThrowMemoryException();
		}
    
		pDlg->SetStation(pStation);
		assert(m_pEvents != NULL);
		pDlg->SetEventPtr(m_pEvents);
		pDlg->DoModal();
		
	}
	catch(CMemoryException* e) {
		hr = E_OUTOFMEMORY;
		e->Delete();
	}
    catch(_com_error err) {
        Fire_OnNewMessage(sTargetName,E_FACILITY_CEDL,err.Error(),err.Description());
        hr = ComCatch(err);
    }

    if(pWnd) {
        pWnd->Detach();
        delete pWnd;
    }
    
    if(pDlg) {
		delete(pDlg);
	}

    FC_RELEASE_PTR(pStation);
	return hr;
}
Пример #24
0
// Create the help window.
BOOL CPmHelpWindow::Create(LPCSTR pszHelpFile, CWnd* pParentWnd, UINT nIDTemplate, UINT nStyle, UINT uID, int nNavigationTabWidth) 
{
	// Save a pointer to the window we want to notify.
	m_hwndNotify = pParentWnd->GetSafeHwnd();

	// Create the dialog bar.
	BOOL fResult = CDialogBar::Create(pParentWnd, nIDTemplate, nStyle, uID);

	// Save our ID.
	m_uID = uID;

	// Save the width for the navigation tab.
	m_nNavigationTabWidth = nNavigationTabWidth;

	if (fResult)
	{
		// Hide the window by default. It will be shown later if needed.
		ShowWindow(SW_HIDE);

		// Clip children.
		ModifyStyle(0, WS_CLIPCHILDREN);

		// Set titlebar text (floating only)
		CString strTitle = "@@N Help";
		GetConfiguration()->ReplaceText(strTitle);
		SetWindowText(strTitle);

		// Replace the dummy control in the template with the Html Help control.
		CWnd* pOldControl = GetDlgItem(IDC_HELP_CONTROL);
		if (pOldControl != NULL)
		{
			fResult = TRUE;

			// Get the size and position of the dummy control.
			CRect crBounds;
			pOldControl->GetWindowRect(crBounds);
			ScreenToClient(crBounds);

			// Compute the sizes of the border area around the
			// help control within the dialog bar. As the dialog
			// bar is resizes, these borders sizes are retained.
			m_crBorder.left = crBounds.left;
			m_crBorder.top = crBounds.top;
			m_crBorder.right = m_sizeDefault.cx-crBounds.right;
			m_crBorder.bottom = m_sizeDefault.cy-crBounds.bottom;

			CRect crCloseButton;
			crCloseButton.SetRect(0, 0, 12, 12);	// size of bitmap
			m_btnClose.Create(crCloseButton, this, ID_VIEW_HELPWINDOW);
			m_btnClose.SetBitmaps("HELP_CLOSE_U", "HELP_CLOSE_D", pOurPal);
			m_btnClose.SetTransparentColor(RGB(255,0,255));

			// Restore the previous size of the help window.
			CRect crHelpWindow;
			CIniFile IniFile(GET_PMWAPP()->m_pszProfileName);

			// Restore the previous Expand/Contract state.
			m_fExpanded = IniFile.GetInteger("HelpWindow", "Expanded", FALSE);

			if (IniFile.GetWindowPosition("HelpWindow", NULL, NULL, crHelpWindow))
			{
				if (!crHelpWindow.IsRectEmpty())
				{
					m_sizeDefault.cx = crHelpWindow.Width();
					m_sizeDefault.cy = crHelpWindow.Height();
				}
			}

			m_czFloating = m_czDocked = m_sizeDefault;

			TRY
			{
				// Remember the name of the help.
				m_csHelpFile = pszHelpFile;
			}
			END_TRY

			if ((m_csHelpFile.IsEmpty()) || (!Util::FileExists(m_csHelpFile)))
			{
				// Can't use the help file.
				m_csHelpFile.Empty();
			}
			else
			{
				// Load the Html Help control.
				if (m_HtmlHelpControl.Load())
				{
					// Initialize all structure members to zero.
					HH_WINTYPE HHWinType;
					ZeroMemory(&HHWinType, sizeof(HHWinType));

					// Structure size in bytes.
					HHWinType.cbStruct = sizeof(HHWinType);

					// Properties of the HTML window.
					HHWinType.fsWinProperties =
						HHWIN_PROP_TRI_PANE |		// use a tri-pane window
						HHWIN_PROP_TAB_SEARCH |		// show a "Search" tab in navigation pane
						HHWIN_PROP_AUTO_SYNC |		// automatically sync contents and index
						HHWIN_PROP_TRACKING |		// send tracking notification messages
						HHWIN_PROP_NOTB_TEXT |		// no text on toolbar buttons
						HHWIN_PROP_NOTITLEBAR |		
						HHWIN_PROP_NODEF_STYLES |	// no default window styles (only HH_WINTYPE.dwStyles)
						HHWIN_PROP_NODEF_EXSTYLES;	// no default extended window styles (only HH_WINTYPE.dwExStyles)

					// Window styles.
					HHWinType.dwStyles =
						WS_VISIBLE |
						WS_CLIPSIBLINGS |
						WS_CHILD;

					// Extended window styles.
					HHWinType.dwExStyles =
						WS_EX_WINDOWEDGE;

					// Buttons on toolbar pane.
					HHWinType.fsToolBarFlags =
						HHWIN_BUTTON_EXPAND |		// expand/contract button
						HHWIN_BUTTON_BACK |			// back button
						HHWIN_BUTTON_HOME |			// home button
//						HHWIN_BUTTON_ZOOM |			// font button -- too flakey at the moment!
						HHWIN_BUTTON_PRINT;			// print button

					// Full Paths or CHM locations of various files.
					CString csInitialTopic;
					CString csHomePage;
					CString csTableOfContents;
					CString csIndex;

					TRY
					{
						csInitialTopic = "contents.htm";

						csHomePage = m_csHelpFile;
						csHomePage += "::/contents.htm";

						csTableOfContents = m_csHelpFile;
						csTableOfContents += "::/toc.hhc";

						csIndex = m_csHelpFile;
						csIndex += "::/index.hhk";
					}
					END_TRY

					HHWinType.pszFile = csInitialTopic;
					HHWinType.pszHome = csHomePage;
					HHWinType.pszToc = csTableOfContents;
					HHWinType.pszIndex = csIndex;
					
					// Expansion width of navigation pane (left pane).
					HHWinType.iNavWidth = m_nNavigationTabWidth;

					// Initial display state:
					HHWinType.nShowState = SW_RESTORE;

					// TOC should be activated.
					HHWinType.curNavType = HHWIN_NAVTYPE_TOC;

					// Position of navigation tabs.
					HHWinType.tabpos = HHWIN_NAVTAB_TOP;

					// ID to use in WPARAM in WM_NOTIFY.
					HHWinType.idNotify = m_uID;

					// Title of Help Window
					HHWinType.pszCaption= "PrintMaster 7.0 Help Window";

					// Initial state is not expanded.
					HHWinType.fNotExpanded = !m_fExpanded;

					// Indicate which fields in structure are valid.
					HHWinType.fsValidMembers =
						HHWIN_PARAM_STYLES |			// valid dwStyles
						HHWIN_PARAM_PROPERTIES |	// valid fsWinProperties
						HHWIN_PARAM_RECT |			// valid rcWindowPos
						HHWIN_PARAM_TB_FLAGS |		// valid fsToolBarFlags
						HHWIN_PARAM_NAV_WIDTH |		// valid iNavWidth
						HHWIN_PARAM_SHOWSTATE |		// valid nShowState
						HHWIN_PARAM_TABPOS |			// valid tabpos
						HHWIN_PARAM_EXPANSION |		// valid fNotExpanded
						HHWIN_PARAM_CUR_TAB;			// valid curNavType	

					// Specify the name of the new window type.
					HHWinType.pszType = PM_HELP_TYPE;

					// Allow any derived classes to modify the window type information.
					PreSetWinType(&HHWinType);

					// This call creates the new window type from the values in
					// the HH_WINTYPE structure.
					m_HtmlHelpControl.SetWinType(&HHWinType);

					// Display the default topic.
					HWND hWnd = NULL;

					CString csHelpFile;
					TRY
					{
						csHelpFile = m_csHelpFile;
						csHelpFile += ">" PM_HELP_TYPE;

						hWnd = m_HtmlHelpControl.DisplayContents(GetSafeHwnd(), csHelpFile);
					}
					END_TRY

					// If we have successfully created a new help window,
					// then get rid of the old window.
					if (hWnd != NULL)
					{
						// Get rid of the old control.
						if (pOldControl->DestroyWindow())
						{
#if 0
							// remove the "Flat" style in the toolbar
							CWnd HelpWindow;
							HelpWindow.Attach(hWnd);

							CToolBarCtrl* pToolBar = (CToolBarCtrl*)(HelpWindow.GetWindow(GW_CHILD));
							pToolBar->ModifyStyle(TBSTYLE_FLAT, 0);

							HelpWindow.Detach();
#endif
							// Signal that all the cached size information is accurate.
							m_fSizesValid = TRUE;

							fResult = TRUE;
						}
					}
				}
			}

			ASSERT(fResult);
			if (!fResult)
			{
				// We failed, clean up.
			}
		}
Пример #25
0
INT_PTR CALLBACK CHdrPropSheet::DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch (msg) {
	case WM_INITDIALOG:
		{
			PROPSHEETPAGE *pPSP = reinterpret_cast<PROPSHEETPAGE *>(lParam);
			::SetWindowLongPtr(hwnd, DWLP_USER, pPSP->lParam);
			CAnalyzer ana;
			if (ana.Open(hwnd, reinterpret_cast<CHdrPropSheet *>(pPSP->lParam)->m_szPath)) {
				ana.Close();
				HWND hwndHdrList = ::GetDlgItem(hwnd, IDC_HDR_LIST);
				HWND hwndDirList = ::GetDlgItem(hwnd, IDC_DIR_LIST);
				HWND hwndSecList = ::GetDlgItem(hwnd, IDC_SEC_LIST);
				::ShowWindow(hwndHdrList, SW_NORMAL);
				::ShowWindow(hwndDirList, SW_HIDE);
				::ShowWindow(hwndSecList, SW_HIDE);
				ana.AnalyzeExeHdrInit(hwndHdrList, hwndDirList, hwndSecList);
				ana.AnalyzeExeHdr(hwndHdrList, hwndDirList, hwndSecList);
			}
		}
		return TRUE;
//	case WM_DESTROY:
//		reinterpret_cast<CImpPropSheet *>(::GetWindowLongPtr(hwnd, DWLP_USER))->Release();
//		return TRUE;
	case WM_COMMAND:
		if (HIWORD(wParam) == BN_CLICKED) {
			switch (LOWORD(wParam)) {
			case IDC_HDR:
				::ShowWindow(::GetDlgItem(hwnd, IDC_HDR_LIST), SW_NORMAL);
				::ShowWindow(::GetDlgItem(hwnd, IDC_DIR_LIST), SW_HIDE);
				::ShowWindow(::GetDlgItem(hwnd, IDC_SEC_LIST), SW_HIDE);
				return TRUE;
			case IDC_DIR:
				::ShowWindow(::GetDlgItem(hwnd, IDC_HDR_LIST), SW_HIDE);
				::ShowWindow(::GetDlgItem(hwnd, IDC_DIR_LIST), SW_NORMAL);
				::ShowWindow(::GetDlgItem(hwnd, IDC_SEC_LIST), SW_HIDE);
				return TRUE;
			case IDC_SEC:
				::ShowWindow(::GetDlgItem(hwnd, IDC_HDR_LIST), SW_HIDE);
				::ShowWindow(::GetDlgItem(hwnd, IDC_DIR_LIST), SW_HIDE);
				::ShowWindow(::GetDlgItem(hwnd, IDC_SEC_LIST), SW_NORMAL);
				return TRUE;
			case IDC_SAVE:
				{
					CWnd wnd;
					wnd.Attach(hwnd);
					CString strWork;
					strWork.LoadString(IDS_FILE_MATCH);
					CFileDialog dlg(FALSE, NULL, NULL, OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT | OFN_NOCHANGEDIR, strWork, &wnd);
					if (dlg.DoModal() == IDOK) {
						CStdioFile file;
						if (file.Open(dlg.GetPathName(), CFile::modeCreate | CFile::modeWrite | CFile::shareExclusive | CFile::typeText)) {
							try {
								file.WriteString(GetText(hwnd, false));
							} catch (CException *e) {
								e->Delete();
							}
							file.Close();
						}
					}
					wnd.Detach();
					return TRUE;
				}
			case IDC_COPY:
				SetClipboardText(hwnd, GetText(hwnd, true));
				return TRUE;
			}
		}
		break;
	}
	return FALSE;
}
Пример #26
0
BOOL CALLBACK CShellExt::PageDlgProc_vqf(HWND hDlg,UINT uMessage,WPARAM wParam,LPARAM lParam)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());

	TRACE(_T("PageDlgProc_avi(mes=%08x,wParam=%08x,lParam=%08x\r\n"),uMessage,wParam,lParam);
	LPCSHELLEXT	lpcs = (CShellExt *)GetWindowLongPtr(hDlg,DWLP_USER);

	switch(uMessage){
	case WM_INITDIALOG:
		{
			lpcs = (LPCSHELLEXT )((LPPROPSHEETPAGE )lParam)->lParam;
			lpcs->m_hwndPage = hDlg;
			SetWindowLongPtr(hDlg, DWLP_USER, (LONG_PTR)lpcs);
			lpcs->m_bApply = FALSE;

			//Ver情報
			SetDlgItemText(hDlg,IDC_STATIC_VER_INFO,SOFT_NAME);
			//タイトル
			SetDlgItemText(hDlg,IDC_EDIT_FILENAME,getFileName(lpcs->m_strSelectFile));
			//アイコンを表示
			SHFILEINFO sfi;
			if(SHGetFileInfo(lpcs->m_strSelectFile,0,&sfi,sizeof(sfi),SHGFI_ICON))
			{
				Static_SetImage_Icon(GetDlgItem(hDlg,IDC_ICON1),sfi.hIcon);
			}

			//オーナードローボタンの初期化
/*			RECT rect;
			SetRect(&rect,145,208,145,75);//ボタン位置の基準
			MapDialogRect(hDlg,&rect);
			SetWindowPos(GetDlgItem(hDlg,IDC_BUTTON_REW),NULL,rect.left+25*0,rect.top,23,23,SWP_NOZORDER | SWP_SHOWWINDOW);
			SetWindowPos(GetDlgItem(hDlg,IDC_BUTTON_PLAY),NULL,rect.left+25*1,rect.top,23,23,SWP_NOZORDER | SWP_SHOWWINDOW);
			SetWindowPos(GetDlgItem(hDlg,IDC_BUTTON_PAUSE),NULL,rect.left+25*2,rect.top,23,23,SWP_NOZORDER | SWP_SHOWWINDOW);
			SetWindowPos(GetDlgItem(hDlg,IDC_BUTTON_STOP),NULL,rect.left+25*3,rect.top,23,23,SWP_NOZORDER | SWP_SHOWWINDOW);
			SetWindowPos(GetDlgItem(hDlg,IDC_BUTTON_FFW),NULL,rect.left+25*4,rect.top,23,23,SWP_NOZORDER | SWP_SHOWWINDOW);
*/			//情報を表示
			DispInfo(hDlg,lpcs);
			
		}
		break;

	case WM_TIMER:
		switch(wParam){
		case REW_TIMER:
			SendMessage(hDlg,WM_COMMAND,
				MAKEWPARAM((UINT )IDC_BUTTON_REW,(UINT )BN_CLICKED),
				0);
			break;
		case FFW_TIMER:
			SendMessage(hDlg,WM_COMMAND,
				MAKEWPARAM((UINT )IDC_BUTTON_FFW,(UINT )BN_CLICKED),
				0);
			break;
		}
		break;

	// オーナー描画コントロール
	case WM_DRAWITEM:
		DrawControl(hDlg,(LPDRAWITEMSTRUCT )lParam);
		break;

	case WM_COMMAND:
		switch(LOWORD(wParam)){
		case IDC_EDIT_NAM:
		case IDC_EDIT_ART:
		case IDC_EDIT_FILE:
		case IDC_EDIT_COP:
		case IDC_EDIT_CMT:
			if((HIWORD(wParam) == EN_CHANGE) &&
				(IsWindowEnabled((HWND )lParam)) )
			{
				PropSheet_Changed(GetParent(hDlg),hDlg);
				lpcs->m_bApply = TRUE;
			}
			break;
		case IDC_BUTTON_PLAY:
			{
				PlayWinamp(hDlg,lpcs->m_strSelectFile);
				break;
			}
		case IDC_BUTTON_PAUSE:
			{
				PauseWinamp();
				break;
			}
		case IDC_BUTTON_STOP:
			{
				StopWinamp();
				break;
			}
		case IDC_BUTTON_REW:
			{
				Rew5Winamp();
				break;
			}
		case IDC_BUTTON_FFW:
			{
				Ffw5Winamp();
				break;
			}
		case IDC_CHECK_AOT:
			if(IsDlgButtonChecked(hDlg,IDC_CHECK_AOT) == BST_CHECKED)
			{
				lpcs->m_bPropAOT = TRUE;
				SetWindowPos(GetParent(hDlg),HWND_TOPMOST,0,0,0,0,
					SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOOWNERZORDER|SWP_NOSIZE);
			}
			else
			{
				lpcs->m_bPropAOT = FALSE;
				SetWindowPos(GetParent(hDlg),HWND_NOTOPMOST,0,0,0,0,
					SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOOWNERZORDER|SWP_NOSIZE);
			}
			regSetDword(HKEY_CURRENT_USER,MP3INFP_REG_ENTRY,_T("PropAOT"),(DWORD )lpcs->m_bPropAOT);
			break;
		case IDC_SETUP:
			OpenConfigPage(hDlg,5);
			break;
		case IDC_HELPVIEW:
			lpcs->OpenHtmlHelp(hDlg,_T("extension.htm"));
			break;
		DLG_CLIPBOARD_MACRO(lpcs->m_strSelectFile);
		}
		break;
	// コンテキストメニュー
	case WM_CONTEXTMENU:
		DlgContextMenu(hDlg,lParam,lpcs->m_Vqf.IsEnable());
		break;
	//状況依存ヘルプ
	case WM_HELP:
		OpenAboutDlg(hDlg);
		break;

	case WM_NOTIFY:
		switch(((NMHDR FAR *)lParam)->code){
//		case PSN_SETACTIVE:
//			break;
		case PSN_APPLY:
			//保存
			if(lpcs->m_bApply && lpcs->m_Vqf.IsEnable())
			{
				//ファイルが書き込み可能か調べる
				if(GetFileAttributes(lpcs->m_strSelectFile) & (FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_READONLY))
				{
					//「このファイルは「読み込み専用」です」
					AfxMessageBox(IDS_PAGE_THIS_READONLY,MB_ICONINFORMATION);
					//適用ボタンは引き続き有効
					SetWindowLongPtr(hDlg,DWLP_MSGRESULT,PSNRET_INVALID);
					break;
				}
				lpcs->m_bApply = FALSE;

				CString strTmp;
				CWnd wnd;

				wnd.Attach(hDlg);

				wnd.GetDlgItemText(IDC_EDIT_NAM,strTmp);
				lpcs->m_Vqf.SetField('N','A','M','E',strTmp);

				wnd.GetDlgItemText(IDC_EDIT_ART,strTmp);
				lpcs->m_Vqf.SetField('A','U','T','H',strTmp);

				wnd.GetDlgItemText(IDC_EDIT_FILE,strTmp);
				lpcs->m_Vqf.SetField('F','I','L','E',strTmp);

				wnd.GetDlgItemText(IDC_EDIT_COP,strTmp);
				lpcs->m_Vqf.SetField('(','c',')',' ',strTmp);

				wnd.GetDlgItemText(IDC_EDIT_CMT,strTmp);
				lpcs->m_Vqf.SetField('C','O','M','T',strTmp);

				wnd.Detach();

				//タイムスタンプを保存
				lpcs->PushTimeStamp(lpcs->m_strSelectFile);

				DWORD dwRet = lpcs->m_Vqf.Save(lpcs->m_strSelectFile);
				if(dwRet != ERROR_SUCCESS)
				{
					lpcs->m_bApply = TRUE;
					if(dwRet == -1)
						//「ファイルを正しく更新できませんでした。」
						AfxMessageBox(IDS_PAGE_BROKEN,MB_ICONINFORMATION);
					else
						//システムエラーを表示
						errMessageBox(hDlg,dwRet);
					//適用ボタンは引き続き有効
					SetWindowLongPtr(hDlg,DWLP_MSGRESULT,PSNRET_INVALID);
					break;
				}

				//タイムスタンプを復元
				if(lpcs->m_bSaveTimeStamp)
				{
					lpcs->PopTimeStamp(lpcs->m_strSelectFile);
				}

				//情報を表示
				DispInfo(hDlg,lpcs);

				SetWindowLongPtr(hDlg,DWLP_MSGRESULT,PSNRET_NOERROR);
				
				//シェルに変更を通知
				SHChangeNotify(SHCNE_UPDATEITEM,SHCNF_PATH,lpcs->m_strSelectFile,NULL);
			}
			break;
		default:
			break;
		}
		break;

	default:
		return FALSE;
	
	}

	return TRUE;
}
Пример #27
0
BOOL CALLBACK CShellExt::PageDlgProc_ogg(HWND hDlg,UINT uMessage,WPARAM wParam,LPARAM lParam)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());

	LPCSHELLEXT	lpcs = (CShellExt *)GetWindowLongPtr(hDlg,DWLP_USER);

	switch(uMessage){
	case WM_INITDIALOG:
		{
			lpcs = (LPCSHELLEXT )((LPPROPSHEETPAGE )lParam)->lParam;
			lpcs->m_hwndPage = hDlg;
			SetWindowLongPtr(hDlg, DWLP_USER, (LONG_PTR)lpcs);
			lpcs->m_bApply = FALSE;

			//Ver情報
			SetDlgItemText(hDlg,IDC_STATIC_VER_INFO,SOFT_NAME);
			//タイトル
			SetDlgItemText(hDlg,IDC_EDIT_FILENAME,getFileName(lpcs->m_strSelectFile));
			//アイコンを表示
			SHFILEINFO sfi;
			if(SHGetFileInfo(lpcs->m_strSelectFile,0,&sfi,sizeof(sfi),SHGFI_ICON))
			{
				Static_SetImage_Icon(GetDlgItem(hDlg,IDC_ICON1),sfi.hIcon);
			}

			//コンボボックスの初期化
			ComboBox_AddString(GetDlgItem(hDlg,IDC_EDIT_GNR), _T(""));
			for(int i=0; i<256; i++)
			{
				if(lpcs->m_Id3tagv1.GenreNum2String((unsigned char)i).GetLength())
					ComboBox_AddString(GetDlgItem(hDlg,IDC_EDIT_GNR),
							lpcs->m_Id3tagv1.GenreNum2String((unsigned char)i));
			}
			//オーナードローボタンの初期化
/*			RECT rect;
			SetRect(&rect,145,208,145,75);//ボタン位置の基準
			MapDialogRect(hDlg,&rect);
			SetWindowPos(GetDlgItem(hDlg,IDC_BUTTON_REW),NULL,rect.left+25*0,rect.top,23,23,SWP_NOZORDER | SWP_SHOWWINDOW);
			SetWindowPos(GetDlgItem(hDlg,IDC_BUTTON_PLAY),NULL,rect.left+25*1,rect.top,23,23,SWP_NOZORDER | SWP_SHOWWINDOW);
			SetWindowPos(GetDlgItem(hDlg,IDC_BUTTON_PAUSE),NULL,rect.left+25*2,rect.top,23,23,SWP_NOZORDER | SWP_SHOWWINDOW);
			SetWindowPos(GetDlgItem(hDlg,IDC_BUTTON_STOP),NULL,rect.left+25*3,rect.top,23,23,SWP_NOZORDER | SWP_SHOWWINDOW);
			SetWindowPos(GetDlgItem(hDlg,IDC_BUTTON_FFW),NULL,rect.left+25*4,rect.top,23,23,SWP_NOZORDER | SWP_SHOWWINDOW);
*/			
			//情報を表示
			DispInfo(hDlg,lpcs);
			DispInfoExt(hDlg,lpcs);
			
			return FALSE;
		}
		break;

	case WM_TIMER:
		switch(wParam){
		case REW_TIMER:
			SendMessage(hDlg,WM_COMMAND,
				MAKEWPARAM((UINT )IDC_BUTTON_REW,(UINT )BN_CLICKED),
				0);
			break;
		case FFW_TIMER:
			SendMessage(hDlg,WM_COMMAND,
				MAKEWPARAM((UINT )IDC_BUTTON_FFW,(UINT )BN_CLICKED),
				0);
			break;
		}
		break;
	// オーナー描画コントロール
	case WM_DRAWITEM:
		DrawControl(hDlg,(LPDRAWITEMSTRUCT )lParam);
		break;
	case WM_COMMAND:
	switch(LOWORD(wParam)){
		case IDC_BUTTON_ADD_VALUE:
			//値追加
			{
				CDlg_ogg_exttag dlg;
				if(dlg.DoModal() == IDOK)
				{
					COggExt *oggExt = new COggExt(dlg.m_strName,dlg.m_strValue);
					long index = ListBox_AddString(GetDlgItem(hDlg,IDC_LIST_VALUE),oggExt->Get1LineDisp());
					if(index == LB_ERR)
					{
						delete oggExt;
					}
					else
					{
						ListBox_SetItemData(GetDlgItem(hDlg,IDC_LIST_VALUE),index,oggExt);
					}
				
					PropSheet_Changed(GetParent(hDlg),hDlg);
					lpcs->m_bApply = TRUE;
				}
			}
			break;
		case IDC_BUTTON_DEL_VALUE:
			//値削除
			{
				long item = ListBox_GetCurSel(GetDlgItem(hDlg,IDC_LIST_VALUE));
				if(item == LB_ERR)
					break;
				
				COggExt *oggExt = (COggExt *)ListBox_GetItemData(GetDlgItem(hDlg,IDC_LIST_VALUE),item);
				if(oggExt)
				{
					delete oggExt;
				}
				ListBox_DeleteString(GetDlgItem(hDlg,IDC_LIST_VALUE),item);
				
				PropSheet_Changed(GetParent(hDlg),hDlg);
				lpcs->m_bApply = TRUE;
			}
			break;
		case IDC_LIST_VALUE:
			if(HIWORD(wParam) == LBN_DBLCLK)
			{
				//ダブルクリック - 編集
				long item = ListBox_GetCurSel(GetDlgItem(hDlg,IDC_LIST_VALUE));
				if(item == LB_ERR)
					break;
				
				COggExt *oggExt = (COggExt *)ListBox_GetItemData(GetDlgItem(hDlg,IDC_LIST_VALUE),item);
				if(oggExt == NULL)
					break;
				
				CDlg_ogg_exttag dlg;

				dlg.m_strName = oggExt->GetName();
				dlg.m_strValue = oggExt->GetValue();
				if(dlg.DoModal() == IDOK)
				{
					oggExt->SetName(dlg.m_strName);
					oggExt->SetValue(dlg.m_strValue);
					ListBox_DeleteString(GetDlgItem(hDlg,IDC_LIST_VALUE),item);
					ListBox_InsertString(GetDlgItem(hDlg,IDC_LIST_VALUE),item,oggExt->Get1LineDisp());
					ListBox_SetItemData(GetDlgItem(hDlg,IDC_LIST_VALUE),item,oggExt);
					
					PropSheet_Changed(GetParent(hDlg),hDlg);
					lpcs->m_bApply = TRUE;
				}
			}
			break;
		case IDC_EDIT_SBJ:
		case IDC_EDIT_TRK:
		case IDC_EDIT_ART:
		case IDC_EDIT_PRD:
		case IDC_EDIT_AART:
		case IDC_EDIT_DISC:
		case IDC_EDIT_CRD:
		case IDC_EDIT_CMT:
			if((HIWORD(wParam) == EN_CHANGE) &&
				(IsWindowEnabled((HWND )lParam)) )
			{
				PropSheet_Changed(GetParent(hDlg),hDlg);
				lpcs->m_bApply = TRUE;
			}
			break;
		case IDC_EDIT_GNR:
			if( ((HIWORD(wParam) == CBN_SELENDOK) || (HIWORD(wParam) == CBN_EDITCHANGE)) &&
				(IsWindowEnabled((HWND )lParam)) )
			{
				PropSheet_Changed(GetParent(hDlg),hDlg);
				lpcs->m_bApply = TRUE;
			}
			break;
		case IDC_BUTTON_PLAY:
			{
				PlayWinamp(hDlg,lpcs->m_strSelectFile);
				break;
			}
		case IDC_BUTTON_PAUSE:
			{
				PauseWinamp();
				break;
			}
		case IDC_BUTTON_STOP:
			{
				StopWinamp();
				break;
			}
		case IDC_BUTTON_REW:
			{
				Rew5Winamp();
				break;
			}
		case IDC_BUTTON_FFW:
			{
				Ffw5Winamp();
				break;
			}
		case IDC_CHECK_AOT:
			if(IsDlgButtonChecked(hDlg,IDC_CHECK_AOT) == BST_CHECKED)
			{
				lpcs->m_bPropAOT = TRUE;
				SetWindowPos(GetParent(hDlg),HWND_TOPMOST,0,0,0,0,
					SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOOWNERZORDER|SWP_NOSIZE);
			}
			else
			{
				lpcs->m_bPropAOT = FALSE;
				SetWindowPos(GetParent(hDlg),HWND_NOTOPMOST,0,0,0,0,
					SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOOWNERZORDER|SWP_NOSIZE);
			}
			regSetDword(HKEY_CURRENT_USER,MP3INFP_REG_ENTRY,_T("PropAOT"),(DWORD )lpcs->m_bPropAOT);
			break;
		case IDC_SETUP:
			OpenConfigPage(hDlg,8);
			break;
		case IDC_HELPVIEW:
			lpcs->OpenHtmlHelp(hDlg,_T("extension.htm"));
			break;
		DLG_CLIPBOARD_MACRO(lpcs->m_strSelectFile);
		}
		break;
	case WM_DESTROY:
		{
			//後始末
			long items = ListBox_GetCount(GetDlgItem(hDlg,IDC_LIST_VALUE));
			if(items != LB_ERR)
			{
				for(int i=0; i<items; i++)
				{
					COggExt *oggExt = (COggExt *)ListBox_GetItemData(GetDlgItem(hDlg,IDC_LIST_VALUE),i);
					if(oggExt)
					{
						delete oggExt;
					}
				}
			}
		}
		return TRUE;
	// コンテキストメニュー
	case WM_CONTEXTMENU:
		DlgContextMenu(hDlg,lParam,lpcs->m_Ogg.IsEnable());
		break;
	//状況依存ヘルプ
	case WM_HELP:
		OpenAboutDlg(hDlg);
		break;

	case WM_NOTIFY:
		switch(((NMHDR FAR *)lParam)->code){
//		case PSN_SETACTIVE:
//			break;
		case PSN_APPLY:
			//保存
			if(lpcs->m_bApply)
			{
				TRACE(_T("WM_NOTIFY(PSN_APPLY) - 保存\n"));
				//ファイルが書き込み可能か調べる
				if(GetFileAttributes(lpcs->m_strSelectFile) & (FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_READONLY))
				{
					//「このファイルは「読み込み専用」です」
					AfxMessageBox(IDS_PAGE_THIS_READONLY,MB_ICONINFORMATION);
					//適用ボタンは引き続き有効
					SetWindowLongPtr(hDlg,DWLP_MSGRESULT,PSNRET_INVALID);
					break;
				}
				lpcs->m_bApply = FALSE;

				CString strTmp;
				CWnd wnd;
				//いったんリセット
				lpcs->m_Ogg.Release();

				wnd.Attach(hDlg);

				wnd.GetDlgItemText(IDC_EDIT_SBJ,strTmp);
				lpcs->m_Ogg.AddComment(_T("TITLE"),strTmp);

				wnd.GetDlgItemText(IDC_EDIT_TRK,strTmp);
				lpcs->m_Ogg.AddComment(_T("TRACKNUMBER"),strTmp);

				wnd.GetDlgItemText(IDC_EDIT_ART,strTmp);
				lpcs->m_Ogg.AddComment(_T("ARTIST"),strTmp);

				wnd.GetDlgItemText(IDC_EDIT_PRD,strTmp);
				lpcs->m_Ogg.AddComment(_T("ALBUM"),strTmp);

				wnd.GetDlgItemText(IDC_EDIT_AART,strTmp);
				lpcs->m_Ogg.AddComment(_T("ALBUMARTIST"),strTmp);

				wnd.GetDlgItemText(IDC_EDIT_DISC,strTmp);
				lpcs->m_Ogg.AddComment(_T("DISCNUMBER"),strTmp);

				wnd.GetDlgItemText(IDC_EDIT_CRD,strTmp);
				lpcs->m_Ogg.AddComment(_T("DATE"),strTmp);

				wnd.GetDlgItemText(IDC_EDIT_GNR,strTmp);
				lpcs->m_Ogg.AddComment(_T("GENRE"),strTmp);

				wnd.GetDlgItemText(IDC_EDIT_CMT,strTmp);
				lpcs->m_Ogg.AddComment(_T("COMMENT"),strTmp);

				wnd.Detach();

				//その他分を保存
				long items = ListBox_GetCount(GetDlgItem(hDlg,IDC_LIST_VALUE));
				if(items != LB_ERR)
				{
					for(int i=0; i<items; i++)
					{
						COggExt *oggExt = (COggExt *)ListBox_GetItemData(GetDlgItem(hDlg,IDC_LIST_VALUE),i);
						if(oggExt)
						{
							lpcs->m_Ogg.AddComment(oggExt->GetName(),oggExt->GetValue());
						}
					}
				}

				//タイムスタンプを保存
				lpcs->PushTimeStamp(lpcs->m_strSelectFile);

				DWORD dwRet = lpcs->m_Ogg.Save(lpcs->m_strSelectFile);
				if(dwRet != ERROR_SUCCESS)
				{
					lpcs->m_bApply = TRUE;
					if(dwRet == -1)
						//「ファイルを正しく更新できませんでした。」
						AfxMessageBox(IDS_PAGE_BROKEN,MB_ICONINFORMATION);
					else
						//システムエラーを表示
						errMessageBox(hDlg,dwRet);
					//適用ボタンは引き続き有効
					SetWindowLongPtr(hDlg,DWLP_MSGRESULT,PSNRET_INVALID);
					break;
				}

				//タイムスタンプを復元
				if(lpcs->m_bSaveTimeStamp)
				{
					lpcs->PopTimeStamp(lpcs->m_strSelectFile);
				}

				//情報を表示
				lpcs->m_Ogg.Load(lpcs->m_strSelectFile);
				DispInfo(hDlg,lpcs);
				DispInfoExt(hDlg,lpcs);

				SetWindowLongPtr(hDlg,DWLP_MSGRESULT,PSNRET_NOERROR);

				//シェルに変更を通知
				SHChangeNotify(SHCNE_UPDATEITEM,SHCNF_PATH,lpcs->m_strSelectFile,NULL);
			}
			break;
		default:
			break;
		}
		break;

	default:
		return FALSE;
	
	}

	return TRUE;
}
Пример #28
0
LRESULT __stdcall DefWindowProc1(HWND hWnd,UINT Msg,WPARAM wParam, 
								 LPARAM lParam )
{
	CPoint pt;
	CDrawButton *pButton=(CDrawButton*)GetWindowLong(hWnd,GWL_USERDATA);
	switch (Msg)
	{
	case 0x0128:
	case WM_LBUTTONDBLCLK:  //屏蔽双击事件
		{
			return TRUE;
			break;
		}
		case WM_PAINT:
			{
				if (pButton->m_Style>0)
					return pButton->OnPaint( hWnd);
				else
					return  CallWindowProc(pButton->m_OldProc, hWnd,Msg,wParam,lParam);
				break;
			}
		case WM_LBUTTONDOWN:
			{
				pt.x = LOWORD(lParam);
				pt.y = HIWORD(lParam);
				if (pButton->m_Style>0)
					return pButton->OnLButtonDown( hWnd, 0, pt );
				else
					return  CallWindowProc(pButton->m_OldProc, hWnd,Msg,wParam,lParam);
				break;
			}
		case WM_LBUTTONUP:
			{
				pt.x = LOWORD(lParam);
				pt.y = HIWORD(lParam);
				if (pButton->m_Style>0)
					return pButton->OnLButtonUp( hWnd, 0,pt );
				else
					return  CallWindowProc(pButton->m_OldProc, hWnd,Msg,wParam,lParam);
				break;
			}
		case WM_MOUSEMOVE:
			{

				pt.x = LOWORD(lParam);
				pt.y = HIWORD(lParam);
				if (pButton->m_Style>0)
					return pButton->OnMouseMove(hWnd,0, pt);
				else
					return  CallWindowProc(pButton->m_OldProc, hWnd,Msg,wParam,lParam);

				break;
			}

		case WM_DESTROY:
			{				
			  	 WNDPROC procOld=pButton->m_OldProc;
				 SetWindowLong(hWnd,GWL_WNDPROC,(long)procOld); //恢复原来的窗口函数

				 CWnd* pWnd = ::CWnd::FromHandle(hWnd);  //将按钮对象与句柄分离
				 if (pWnd)
				 {
					pWnd->Detach();
				 }
				 pButton->m_Flag = 1;
				 return 1;//ret;
			}
		default :
			{
				break;
			}
	}
	return CallWindowProc(pButton->m_OldProc, hWnd, Msg, wParam, lParam );
}
Пример #29
0
BOOL Cwinlirc::InitInstance() {

	AfxInitRichEdit();

#ifdef _DEBUG
	RedirectIOToConsole();
#endif

	// set current directory for plugins from exe path

	{
		//=====================
		CString	fullPath;
		int		indexOfLastSep;
		//=====================

		GetModuleFileName(nullptr, fullPath.GetBufferSetLength(MAX_PATH+1), MAX_PATH);
		indexOfLastSep = fullPath.ReverseFind(_T('\\'));
		
		if(!SetCurrentDirectory(fullPath.Left(indexOfLastSep) + _T("\\plugins\\"))) {
			SetCurrentDirectory(fullPath.Left(indexOfLastSep) + _T("\\"));
		}
	}

	config.readINIFile();

	//
	// command line stuff
	//

	if(_tcsstr(m_lpCmdLine,_T("/e")) || _tcsstr(m_lpCmdLine,_T("/E"))) {
		config.exitOnError = TRUE;
	}

	if(_tcsstr(m_lpCmdLine,_T("/t")) || _tcsstr(m_lpCmdLine,_T("/T"))) {
		config.showTrayIcon = FALSE;
	}

	CString mutexName;
	mutexName.Format(_T("WinLIRC Multiple Instance Lockout_%i"),config.serverPort);

	if(!CreateMutex(0,FALSE,mutexName) || GetLastError()==ERROR_ALREADY_EXISTS) {

		//=======
		HWND tmp;
		//=======

		tmp=FindWindow(nullptr,_T("WinLIRC"));

		if(!tmp)
		{
			MessageBox(nullptr,_T("WinLIRC is already running"),_T("WinLIRC"),MB_OK);
		}
		else
		{
			// bring it to the top

			//===========
			CWnd winlirc;
			CWnd *last;
			//===========

			winlirc.Attach(tmp);

			last = winlirc.GetLastActivePopup();

			if(!winlirc.IsWindowVisible()) {
				winlirc.ShowWindow(SW_SHOW);
			}

			winlirc.SetForegroundWindow();
			last->SetForegroundWindow();

			winlirc.Detach();
		}
		return FALSE;
	}

	//
	//Process initialization and sanity checks
	//
	if(SetPriorityClass(GetCurrentProcess(),HIGH_PRIORITY_CLASS)==0 || SetThreadPriority(THREAD_PRIORITY_IDLE)==0) {
		MessageBox(nullptr,_T("Could not set thread priority."),_T("WinLIRC"),MB_OK|MB_ICONERROR);
		return FALSE;
	}
	
	if(server.startServer()==false) {
		MessageBox(nullptr,_T("Server could not be started. Try checking the port."),_T("WinLIRC"),MB_OK|MB_ICONERROR);
	}

	WL_DEBUG("Creating main dialog...\n");

	dlg = new Cdrvdlg();

	if(!dlg->Create(IDD_DIALOG,nullptr)) {
		delete dlg;
		dlg = nullptr;
		MessageBox(nullptr,_T("Program exiting."),_T("WinLIRC"),MB_OK|MB_ICONERROR);
		return FALSE;
	}

	dlg->ShowWindow(SW_HIDE);	
	dlg->UpdateWindow();
	m_pMainWnd = dlg;
	
	return TRUE;
}
Пример #30
-1
BOOL CImageWindow::Create(CWnd *pwndParent, const CRect rtPosition)
{
	ASSERT(pwndParent);

	CRect rectDummy(0, 0, 0, 0);
	if(rtPosition.IsRectEmpty() || rtPosition.IsRectNull())
	{
		pwndParent->GetClientRect(&rectDummy);
	}
	else
	{
		rectDummy = rtPosition;
	}

	AFX_MANAGE_STATE(AfxGetStaticModuleState());

	CWnd tmpWnd;
	tmpWnd.Attach(pwndParent->GetSafeHwnd());

	if(!CWnd::Create(NULL, NULL, WS_VISIBLE, rectDummy, &tmpWnd, 0, NULL))
	{
		tmpWnd.Detach();
		return FALSE;
	}

	tmpWnd.Detach();

	return TRUE;
}