Beispiel #1
0
int TwitterProto::OnOptionsInit(WPARAM wParam, LPARAM)
{
	OPTIONSDIALOGPAGE odp = { 0 };
	odp.position = 271828;
	odp.hInstance = g_hInstance;
	odp.ptszGroup = LPGENT("Network");
	odp.ptszTitle = m_tszUserName;
	odp.dwInitParam = LPARAM(this);
	odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;

	odp.ptszTab = LPGENT("Basic");
	odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
	odp.pfnDlgProc = options_proc;
	Options_AddPage(wParam, &odp);

	if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
		odp.ptszTab = LPGENT("Popups");
		odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_POPUPS);
		odp.pfnDlgProc = popup_options_proc;
		Options_AddPage(wParam, &odp);
	}
	return 0;
}
LRESULT CNSToolbar2::OnToolbarButtonSizeChanged(WPARAM wParam, LPARAM lParam)
{

    HWND hWnd = (HWND) lParam;

    CToolbarButton *pButton = (CToolbarButton*)CWnd::FromHandle(hWnd);

    int nButtonIndex = FindButton(pButton);

    if(nButtonIndex != -1)
    {
        if(CheckMaxButtonSizeChanged(pButton, TRUE) || CheckMaxButtonSizeChanged(pButton, FALSE))
        {
            ChangeButtonSizes();
            LayoutButtons(-1);
            GetParentFrame()->RecalcLayout();
            GetParent()->SendMessage(CASTUINT(TOOLBAR_WIDTH_CHANGED), 0, LPARAM(m_hWnd));
        }
    }


    return 1;
}
Beispiel #3
0
BOOL CALLBACK DlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch (message)
	{
	case WM_CLOSE:
		DestroyWindow(hDlg);
		return TRUE;
	case WM_COMMAND:
	{
		int Id = LOWORD(wParam);
		switch (Id)
		{
		case IDC_BUTTON1:
		{
			TCHAR buff[10];
			GetDlgItemText(hDlg, IDC_EDIT1, buff, 10);
			x1 = _wtoi(buff);
			GetDlgItemText(hDlg, IDC_EDIT2, buff, 10);
			y1 = _wtoi(buff);
			GetDlgItemText(hDlg, IDC_EDIT3, buff, 10);
			x2 = _wtoi(buff);
			GetDlgItemText(hDlg, IDC_EDIT4, buff, 10);
			y2 = _wtoi(buff);


			SetWindowText(::hWnd, L"Draw...");

			SendMessage(::hWnd, 1998, WPARAM(NULL), LPARAM(NULL));
		}

		return TRUE;
		}
	}
	}

	return FALSE;
}
Beispiel #4
0
extern "C" int __declspec(dllexport) Load(void)
{
	mir_getLP(&pluginInfo);
	mir_getCLI();

	CallService(MS_SYSTEM_GETVERSIONTEXT, sizeof(g_szMirVer), LPARAM(g_szMirVer));

	PROTOCOLDESCRIPTOR pd = { 0 };
	pd.cbSize = sizeof(pd);
	pd.szName = "SKYPE";
	pd.type = PROTOTYPE_PROTOCOL;
	pd.fnInit = (pfnInitProto)CSkypeProto::InitAccount;
	pd.fnUninit = (pfnUninitProto)CSkypeProto::UninitAccount;
	Proto_RegisterModule(&pd);

	CSkypeProto::InitIcons();
	CSkypeProto::InitMenus();
	CSkypeProto::InitLanguages();
	CreateServiceFunction(MODULE"/GetEventIcon", &CSkypeProto::EventGetIcon);
	CreateServiceFunction(MODULE"/GetCallText", &CSkypeProto::GetCallEventText);
	HookEvent(ME_SYSTEM_MODULESLOADED, &CSkypeProto::OnModulesLoaded);

	return 0;
}
Beispiel #5
0
		HWND CULMDIChildWnd::Create(TCHAR* szWindowName,
									int x,
									int y,
									int cx,
									int cy,
									short IconID,
									HWND hClientWnd,
									short BGColor,
									DWORD dwChildStyle)
		{
			m_hParentWnd=hClientWnd;

			WNDCLASS wc; 

			wc.style         = 0; 
			wc.lpfnWndProc   = (WNDPROC) WndProc; 
			wc.cbClsExtra    = 0; 
			wc.cbWndExtra    = 0; 
			wc.hInstance     = ULOther::ULGetResourceHandle(); 
			wc.hIcon         = LoadIcon(wc.hInstance,MAKEINTRESOURCE(IconID)); 
			wc.hCursor       = LoadCursor( NULL, IDC_ARROW); 
			wc.hbrBackground = (HBRUSH) BGColor; 

			wc.lpszMenuName  = NULL; 
			
		#ifndef UNICODE
			wc.lpszClassName = "ULCHILDWND";  
		#else
			wc.lpszClassName = L"ULCHILDWND";  
		#endif//UNICODE	
			RegisterClass(&wc);
			m_hWnd=CreateMDIWindow(wc.lpszClassName,szWindowName,dwChildStyle,
				x,y,cx,cy,hClientWnd,ULOther::ULGetResourceHandle(),LPARAM(this));

			return m_hWnd;
		}
Beispiel #6
0
int CVkProto::OnOptionsInit(WPARAM wParam, LPARAM)
{
	OPTIONSDIALOGPAGE odp = { 0 };
	odp.hInstance = hInst;
	odp.ptszTitle = m_tszUserName;
	odp.dwInitParam = LPARAM(this);
	odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE;
	odp.ptszGroup = LPGENT("Network");

	odp.ptszTab = LPGENT("Account");
	odp.position = 1;
	odp.pDialog = new CVkOptionAccountForm(this);
	Options_AddPage(wParam, &odp);

	odp.ptszTab = LPGENT("Advanced");
	odp.position = 2;
	odp.pDialog = new CVkOptionAdvancedForm(this);
	Options_AddPage(wParam, &odp);

	odp.ptszTab = LPGENT("News and notifications");
	odp.position = 3;
	odp.pDialog = new CVkOptionFeedsForm(this);
	Options_AddPage(wParam, &odp);

	odp.ptszTab = LPGENT("View");
	odp.position = 4;
	odp.pDialog = new CVkOptionViewForm(this);
	Options_AddPage(wParam, &odp);

	odp.ptszTab = LPGENT("Menu");
	odp.position = 5;
	odp.pDialog = new CVkOptionMenuForm(this);
	Options_AddPage(wParam, &odp);

	return 0;
}
static int CtrlFileYes(char *NameF)                          //Проверка наличия файла
{
   int ret;
   if(CtrlFileYesNo(NameF) == 0) return 0;                   //Файла нет - Проверка наличия файла
   if(prCopy == 0)
        ret = DialogBoxParam(MainInst, MAKEINTRESOURCE(IDD_DLG_FILE_YES),
                      MainWin, Dlg_FileYes, LPARAM(NameF));
   switch(prCopy)                                             //Признак действия при групповом копировании
   {  case 0: break;
      case 1: ret = IDOK; break;                             //Нажата кнопка Заменять все
      case 2: ret = Comp_TimeF(); break;                     //Нажата кнопка Заменять старые
      case 3: ret = IDC_SCIP; break;                         //Нажата кнопка Пропускать все
      case 4: return Mk_NewName(NameF);                      //Нажата кнопка Переименовывать автоматически
   }
   switch (ret)
   {  case IDCANCEL: *NameF = 0;  return -1;                 //Отмена режима копирования
      case IDC_SCIP: *NameF = 0;  return -2;                 //Нажата кнопка пропустить
      case IDC_RENAME: return 1;                             //Нажата кнопка Переименование
      case IDOK:                                             //Нажата кнопка Заменить
                 if(DeleteFile(NameF) != 0) return 0;
                 return ErrorSys2((Lan+56)->msg, NameF);     //"Ошибка при удалении файла"
   }
   return -1;
}
Beispiel #8
0
void MySystemProc(HWND hWnd)
{

//      HICON hIcon;
    HWINSTA winStationhWnd;
    winStationhWnd = GetProcessWindowStation();	//Get Current Process Window Handle
    EnumDesktops(winStationhWnd, EnumDesktopProc, NULL);
    i = desktopList.begin();
    while (i != desktopList.end()) {
	if (wcscmp(*i, TEXT("Winlogon")) && wcscmp(*i, TEXT("Disconnect"))) {
	    HDESK desktopHwnd = OpenDesktop(*i, 0, FALSE, GENERIC_ALL);
	    EnumDesktopWindows(desktopHwnd, EnumWindowsProc, LPARAM(desktopHwnd));


	}
	i++;
    }


    BuildToolbar(1);
    CreateSimpleToolbar();


}
void TresizePage::resize2dlg(void)
{
    __asm emms;
    setCheck(IDC_CHB_RESIZE,cfgGet(IDFF_isResize));
    char pomS[256];
    SendDlgItemMessage(m_hwnd,IDC_ED_RESIZEDX,WM_SETTEXT,0,LPARAM(_itoa(cfgGet(IDFF_resizeDx),pomS,10)));
    SendDlgItemMessage(m_hwnd,IDC_ED_RESIZEDY,WM_SETTEXT,0,LPARAM(_itoa(cfgGet(IDFF_resizeDy),pomS,10)));
    sprintf(pomS,"Luma gaussian blur:  %3.2f"  ,float(cfgGet(IDFF_resizeGblurLum    )/100.0));
    SendDlgItemMessage(m_hwnd,IDC_LBL_RESIZE_GBLUR_LUM    ,WM_SETTEXT,0,LPARAM(pomS));
    sprintf(pomS,"Chroma gaussian blur:  %3.2f",float(cfgGet(IDFF_resizeGblurChrom  )/100.0));
    SendDlgItemMessage(m_hwnd,IDC_LBL_RESIZE_GBLUR_CHROM  ,WM_SETTEXT,0,LPARAM(pomS));
    sprintf(pomS,"Luma sharpen:  %3.2f"        ,float(cfgGet(IDFF_resizeSharpenLum  )/100.0));
    SendDlgItemMessage(m_hwnd,IDC_LBL_RESIZE_SHARPEN_LUM  ,WM_SETTEXT,0,LPARAM(pomS));
    sprintf(pomS,"Chroma sharpen:  %3.2f"      ,float(cfgGet(IDFF_resizeSharpenChrom)/100.0));
    SendDlgItemMessage(m_hwnd,IDC_LBL_RESIZE_SHARPEN_CHROM,WM_SETTEXT,0,LPARAM(pomS));

    SendDlgItemMessage(m_hwnd,IDC_TBR_RESIZE_GBLUR_LUM    ,TBM_SETPOS,TRUE,cfgGet(IDFF_resizeGblurLum    ));
    SendDlgItemMessage(m_hwnd,IDC_TBR_RESIZE_GBLUR_CHROM  ,TBM_SETPOS,TRUE,cfgGet(IDFF_resizeGblurChrom  ));
    SendDlgItemMessage(m_hwnd,IDC_TBR_RESIZE_SHARPEN_LUM  ,TBM_SETPOS,TRUE,cfgGet(IDFF_resizeSharpenLum  ));
    SendDlgItemMessage(m_hwnd,IDC_TBR_RESIZE_SHARPEN_CHROM,TBM_SETPOS,TRUE,cfgGet(IDFF_resizeSharpenChrom));

    setCheck(IDC_CHB_RESIZE_FIRST,cfgGet(IDFF_resizeFirst));
    SendDlgItemMessage(m_hwnd,IDC_CBX_RESIZE_METHOD,CB_SETCURSEL,cfgGet(IDFF_resizeMethod),0);
}
Beispiel #10
0
INT_PTR TOSDpageDec::msgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch (uMsg) {
        case WM_COMMAND:
            switch (LOWORD(wParam)) {
                case IDC_CHB_OSD:
                    cfgSet(IDFF_isOSD, getCheck(IDC_CHB_OSD));
                    parent->drawInter();
                    return TRUE;
                case IDC_CHB_OSD_IS_AUTO_HIDE:
                    cfgSet(IDFF_OSDisAutoHide, getCheck(IDC_CHB_OSD_IS_AUTO_HIDE));
                    osd2dlg();
                    parent->setChange();
                    break;
                case IDC_ED_OSD_DURATION_VISIBLE:
                    if (HIWORD(wParam) == EN_CHANGE && !isSetWindowText) {
                        HWND hed = GetDlgItem(m_hwnd, LOWORD(wParam));
                        if (hed != GetFocus()) {
                            return FALSE;
                        }
                        repaint(hed);
                        parent->setChange();
                        break;
                    }
                    break;
                case IDC_CHB_OSD_USER:
                    if (!getCheck(IDC_CHB_OSD_USER)) {
                        lv2osdFormat();
                    } else {
                        cfgSet(IDFF_OSDformat, _l("user"));
                    }
                    osd2dlg();
                    parent->setChange();
                    break;
                case IDC_ED_OSD_USER:
                    if (HIWORD(wParam) == EN_CHANGE && !isSetWindowText) {
                        char_t ed[1020]; //4 chars are reserved for "user" prefix
                        GetDlgItemText(m_hwnd, IDC_ED_OSD_USER, ed, 1020);
                        char_t format[1024];
                        tsnprintf_s(format, 1024, _TRUNCATE, _l("user%s"), ed);
                        cfgSet(IDFF_OSDformat, format);
                        parent->setChange();
                    };
                    break;
                case IDC_ED_OSD_SAVE:
                    if (HIWORD(wParam) == EN_CHANGE && !isSetWindowText) {
                        char_t saveflnm[MAX_PATH];
                        GetDlgItemText(m_hwnd, IDC_ED_OSD_SAVE, saveflnm, MAX_PATH);
                        cfgSet(IDFF_OSDsaveFlnm, saveflnm);
                        return TRUE;
                    }
                    return TRUE;
            }
            break;
        case WM_NOTIFY: {
            NMHDR *nmhdr = LPNMHDR(lParam);
            if (!nostate && nmhdr->hwndFrom == hlv && nmhdr->idFrom == IDC_LV_OSD_LINES)
                switch (nmhdr->code) {
                    case LVN_ITEMCHANGED: {
                        LPNMLISTVIEW nmlv = LPNMLISTVIEW(lParam);
                        if (nmlv->uChanged & LVIF_STATE && ((nmlv->uOldState & 4096) != (nmlv->uNewState & 4096))) {
                            lv2osdFormat();
                        }
                        return TRUE;
                    }
                    case LVN_BEGINDRAG: {
                        if (!user) {
                            LPNMLISTVIEW nmlv = LPNMLISTVIEW(lParam);
                            if (nmlv->iItem != -1) {
                                dragitem = nmlv->iItem;
                                SetCapture(m_hwnd);
                            }
                        }
                        break;
                    }
                    case NM_DBLCLK: {
                        if (user) {
                            LPNMITEMACTIVATE nmia = LPNMITEMACTIVATE(lParam);
                            if (nmia->iItem != -1) {
                                const char_t *shortcut = deci->getInfoItemShortcut((int)lvGetItemParam(IDC_LV_OSD_LINES, nmia->iItem));
                                if (shortcut && shortcut[0]) {
                                    char_t osd[1020];
                                    tsnprintf_s(osd, countof(osd), _TRUNCATE, _l("%%%s"), shortcut);
                                    SendDlgItemMessage(m_hwnd, IDC_ED_OSD_USER, EM_REPLACESEL, TRUE, LPARAM(osd));
                                }
                            }
                        }
                        break;
                    }
                }
            break;
        }
        case WM_MOUSEMOVE:
            if (dragitem != -1) {
                LVHITTESTINFO lvhti;
                lvhti.pt.x = LOWORD(lParam) - lvx;
                lvhti.pt.y = HIWORD(lParam) - lvy;
                int target = ListView_HitTest(hlv, &lvhti);
                if (target != -1) {
                    lvSwapItems(IDC_LV_OSD_LINES, target, dragitem);
                    lv2osdFormat();
                    dragitem = target;
                }
                return TRUE;
            }
            break;
        case WM_LBUTTONUP:
            if (dragitem != -1) {
                dragitem = -1;
                ReleaseCapture();
                return TRUE;
            }
            break;
    }
    return TconfPageDec::msgProc(uMsg, wParam, lParam);
}
UINT COXFileWatcher::FileWatchThreadFunction(LPVOID pParam)
// --- In  : pParam: a pointer to the current COXFileWatcher object 
	// --- Out : 
	// --- Returns :
	// --- Effect : Used as a worker thread function
{
#if defined (_WINDLL)
#if defined (_AFXDLL)
	AFX_MANAGE_STATE(AfxGetAppModuleState());
#else
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
#endif
#endif

	ASSERT(pParam!=NULL);

	COXFileWatcher* pThis=(COXFileWatcher*)pParam;
	HANDLE*			pHandles=pThis->m_pHandles;
	
	pThis->m_bThreadIsRunning = TRUE;

	VERIFY(pThis->m_eventStartThread.SetEvent());

#if defined(_UNICODE) && (_WIN32_WINNT >= 0x400)
// Extended info is supported

	static TCHAR	szFileName[_MAX_PATH];
	// --- the name of the file if extended info is available
	static TCHAR	szNewFileName[_MAX_PATH];
	// --- the name of the new file if extended info is available and action is rename
	
	FILE_NOTIFY_INFORMATION* pfnInfo=NULL;
	// -- pointer to a buffer with extended information (if available)

#endif // defined(_UNICODE) && (_WIN32_WINNT >= 0x400)

	COXFileWatchNotifier* pfwnNotifier;
	// --- the notifier object that will be posted/sended

	DWORD nCount=PtrToLong(pThis->m_arWatchedDirs.GetSize()+1);
	
	// Exit from the loop only when the StartStopEvent as signaled
	while(TRUE)
	{
		DWORD dwRetValue = WaitForMultipleObjects(nCount, pHandles, 
			FALSE, INFINITE);

		// Check for error
		if(dwRetValue == WAIT_FAILED || dwRetValue<WAIT_OBJECT_0 || 
			dwRetValue > (WAIT_OBJECT_0 + nCount - 1))
		{
			pThis->m_hrError = HRESULT_FROM_WIN32(::GetLastError());
			break;
		}
		else  
		{
			// To stop the thread or a notification is signaled
			if(dwRetValue == WAIT_OBJECT_0)
			{
				VERIFY(pThis->m_mxThreadShouldStop.Unlock());
				// Informs the main thread that we are waiting
//				VERIFY(pThis->m_mxThreadStopped.Unlock());
				pThis->m_mxThreadStopped.Unlock();
				// Wait for the main thread
				VERIFY(pThis->m_mxThreadCanContinue.Lock());
				VERIFY(pThis->m_mxThreadStopped.Lock());
				VERIFY(pThis->m_mxThreadCanContinue.Unlock());

				// In this point the main thread should prepare the handles

				if(pThis->m_pNewHandles==NULL) 
				{
					break; // Stops the thread
				}

				// Set new handles
				pHandles=pThis->m_pNewHandles;
				nCount = PtrToLong(pThis->m_arWatchedDirs.GetSize()+1);

				continue;
			}
			else
			{ 
				// ... OK. New notification

				//if notification comes in the period of the time
				//that this thread is to be deleted, so do not
				//process the notification.
				if (pThis->m_bDeletingThread)
					break;
				
				// Find the directory entry
				int nSignaledPath=dwRetValue-WAIT_OBJECT_0-1;
				
				COXWatchedDir* pwdPath = (pThis->m_arWatchedDirs)[nSignaledPath];

#if defined(_UNICODE) && (_WIN32_WINNT >= 0x400)
// Extended info is supported
				DWORD dwNumberOfBytesTransferred;
				BOOL bValid;

				if(pwdPath->m_bExtended)
				{
					// ... OK. We have extended info. Take a pointer to it.
					pfnInfo=(FILE_NOTIFY_INFORMATION*)pwdPath->m_lpBuffer;

					// ... we have to check if the notification is valid or not
					// The check must be done before FindNextHandle()
					bValid= ::GetOverlappedResult(pwdPath->m_hDirectory,      // handle of the directory
								  				  pwdPath->m_pOverlapped,	  // address of overlapped structure 
 												  &dwNumberOfBytesTransferred, // address of actual bytes count 
												  FALSE);					  /// wait flag 

					if(bValid == FALSE || dwNumberOfBytesTransferred == 0) 
					{
						// Something is wrong
#ifdef _DEBUG
						if(bValid == FALSE)
						{
							pThis->m_hrError = HRESULT_FROM_WIN32(::GetLastError());
							CONDITIONAL_TRACE_RESULT("COXFileWatcher::FileWatchThreadFunction", pThis->m_hrError)
						}
						else // dwNumberOfBytesTransferred == 0
						{
							TRACE(_T("\nThe buffer passed to ReadDirectoryChangesW() is too small!\n"));
						}
#endif // _DEBUG

						// ... update the handle
						if(!pwdPath->FindNextHandle((pThis->m_pHandles)[nSignaledPath+1]))
						{
							pThis->m_hrError=
								HRESULT_FROM_WIN32(::GetLastError());
							break;
						}

						// The extended information is available, but it is not valid
						continue;
					}
				}

				while(TRUE)
				{
					if(pwdPath->m_bExtended)
					{
						// Extended information is available
						memcpy(szFileName,(LPCTSTR)&pfnInfo->FileName[0], 
							pfnInfo->FileNameLength);
						szFileName[pfnInfo->
							FileNameLength/sizeof(TCHAR)]=_T('\0');

						if(pfnInfo->Action == FILE_ACTION_RENAMED_OLD_NAME) 
						{
							pfnInfo=(FILE_NOTIFY_INFORMATION*)(((char*)pfnInfo)+
								pfnInfo->NextEntryOffset);
							memcpy(szNewFileName, (LPCTSTR)&pfnInfo->FileName[0],
								pfnInfo->FileNameLength);
							szNewFileName[pfnInfo->
								FileNameLength/sizeof(TCHAR)]=_T('\0');
						}
						else
						{
							szNewFileName[0]=_T('\0');
						}
						pfwnNotifier= new COXFileWatchNotifier(pwdPath->m_sPath,
							pwdPath->m_bWatchSubTree,pwdPath->m_dwWatchFilter, 
							TRUE,pfnInfo->Action,szFileName,szNewFileName);
					}
					else
#endif // defined(_UNICODE) && (_WIN32_WINNT >= 0x400)
					{
						// ... there is no extended information
						pfwnNotifier= new COXFileWatchNotifier(pwdPath->m_sPath,
							pwdPath->m_bWatchSubTree,pwdPath->m_dwWatchFilter, 
							FALSE,0,NULL,NULL);
					}

					// Notify the derived class or ...
					if(!pThis->OnNotify(*pfwnNotifier) && 
						pwdPath->m_hwndWindowToNotify!=NULL)
					{
						// ... post/send message
						UINT nItemIndex=pThis->m_arFileWatchNotifiers.
							AddItem(pfwnNotifier);
						if(pwdPath->m_bPost)
						{
							::PostMessage(pwdPath->m_hwndWindowToNotify, 
								WM_OX_FILE_NOTIFY,nItemIndex,LPARAM(0));
						}
						else
						{
							::SendMessage(pwdPath->m_hwndWindowToNotify, 
								WM_OX_FILE_NOTIFY,nItemIndex,LPARAM(0));
						}
					}
					else 
					{
						// the notifier object is not queued so delete it
						delete pfwnNotifier;
					}

#if defined(_UNICODE) && (_WIN32_WINNT >= 0x400)
// Extended info is supported
					if(!pwdPath->m_bExtended || pfnInfo->NextEntryOffset == 0) 
					{
						break;
					}
					else
					{
						// ... go to the next entry in the buffer...
						pfnInfo = (FILE_NOTIFY_INFORMATION*)(((char*)pfnInfo)+
							pfnInfo->NextEntryOffset);
					}
				} // while(TRUE);

#endif // defined(_UNICODE) && (_WIN32_WINNT >= 0x400)

				// ... update the handle
				if(!pwdPath->FindNextHandle((pThis->m_pHandles)[nSignaledPath+1]))
				{
					pThis->m_hrError = HRESULT_FROM_WIN32(::GetLastError());
					break;
				}

			}
Beispiel #12
0
void CMDIChildWnd::OnMDIActivate(HWND hAct,HWND hDeAct)
{
	UpdateClientEdge();
	WindowProc(WM_MDIACTIVATE,WPARAM(hAct),LPARAM(hDeAct));
}
/**
    This method initializes SAPI and creates the objects used by subclasses,
    it does not start the lipsync process. 
  */
bool sapi_lipsync::initializeObjects()
{
    HRESULT hr = S_OK;
    m_err = L"";
    try
    {
        // create the recognizer (inproc)
        hr = this->m_recog.CoCreateInstance(CLSID_SpInprocRecognizer);
        if (hr != S_OK) 
        {
            m_err = L"Error: Can't create SAPI Speech Recognizer (ISpRecognizer)";
            throw (hr);
        }

        // create the recognition context from the recognizer
        hr = this->m_recog->CreateRecoContext(&this->m_recogCntxt);
        if (hr != S_OK)
        {
            m_err = L"Error: Cannot create SAPI Recognition Context (ISpRecoContext)";
            throw (hr);
        }            

        hr = m_recogCntxt->SetNotifyCallbackFunction(&this->sapi_callback, 0, LPARAM(this));
        if (hr != S_OK)
        {
            m_err = L"Error: Cannot set notify callback function. (SetNofifyCallbackFunction)";
            throw (hr);
        }
        // initialize and disable the grammar
        hr = m_recogCntxt->CreateGrammar(GID_LIPSYNC, &m_grammar);
        if (hr != S_OK)
        {
            m_err = L"Error: Failed to create grammar for lipsync";
            throw (hr);
        }
		// not totally sure here!
		hr = m_grammar->SetGrammarState(SPGS_DISABLED); //Let subclasses handle the grammer state
        if (hr != S_OK)
        {
            m_err = L"Error: Failed to disable the grammar.";
            throw (hr);
        }

		// need a phoneme converter to map SPHONEID into phoneme strings
        hr = SpCreatePhoneConverter(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), 
            NULL, NULL, &this->m_phnCvt);
        if (hr != S_OK)
        {
            m_err = L"Error: Failed create phoneme converter";
            throw (hr);
        }

	    // Set interest level for events, we want all events, just in case.                
        hr = m_recogCntxt->SetInterest(ullInterest, ullInterest);
        if (hr != S_OK)
        {
            m_err = L"Error: Cannot correctly set notifications for the Speech Recognizer";
            throw(hr);
        }
        // turn off recognizer while we initialize things. HMMM
        //m_recog->SetRecoState(SPRST_INACTIVE);
    } 
    catch (HRESULT& _hr)
    {
        hr = _hr;
    }
    return (hr == S_OK);
}
void CWizardSprayAnalyze::PostLogMessage(const TCHAR* pStr)
{
	PostMessage(CWM_STATUSUPDATE, 0, LPARAM(new CString(pStr)));
}
Beispiel #15
0
bool SDL2Window::initialize() {

    arx_assert(!m_displayModes.empty());

    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
    SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);

#if ARX_PLATFORM == ARX_PLATFORM_WIN32
    // Used on Windows to prevent software opengl fallback.
    // The linux situation:
    // Causes SDL to require visuals without caveats.
    // On linux some drivers only supply multisample capable GLX Visuals
    // with a GLX_NON_CONFORMANT_VISUAL_EXT caveat.
    // see: https://www.opengl.org/registry/specs/EXT/visual_rating.txt
    SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1);
#endif

    // TODO EGL and core profile are not supported yet
    SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY);

    if(gldebug::isEnabled()) {
        SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG);
    }


    int x = SDL_WINDOWPOS_UNDEFINED, y = SDL_WINDOWPOS_UNDEFINED;
    Uint32 windowFlags = getSDLFlagsForMode(m_size, m_fullscreen);
    windowFlags |= SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIDDEN;

    for(int msaa = m_maxMSAALevel; msaa > 0; msaa--) {
        bool lastTry = (msaa == 1);

        // Cleanup context and window from previous tries
        if(m_glcontext) {
            SDL_GL_DeleteContext(m_glcontext);
            m_glcontext = NULL;
        }
        if(m_window) {
            SDL_DestroyWindow(m_window);
            m_window = NULL;
        }

        SDL_ClearError();

        SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, msaa > 1 ? 1 : 0);
        SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, msaa > 1 ? msaa : 0);

        m_window = SDL_CreateWindow(m_title.c_str(), x, y, m_size.x, m_size.y, windowFlags);
        if(!m_window) {
            if(lastTry) {
                LogError << "Could not create window: " << SDL_GetError();
                return false;
            }
            continue;
        }

        m_glcontext = SDL_GL_CreateContext(m_window);
        if(!m_glcontext) {
            if(lastTry) {
                LogError << "Could not create GL context: " << SDL_GetError();
                return false;
            }
            continue;
        }

        // Verify that the MSAA setting matches what was requested
        int msaaEnabled, msaaValue;
        SDL_GL_GetAttribute(SDL_GL_MULTISAMPLEBUFFERS, &msaaEnabled);
        SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &msaaValue);
        if(!lastTry) {
            if(!msaaEnabled || msaaValue < msaa) {
                continue;
            }
        }
        if(msaaEnabled) {
            m_MSAALevel = msaaValue;
        } else {
            m_MSAALevel = 0;
        }

        // Verify that we actually got an accelerated context
        (void)glGetError(); // clear error flags
        GLint texunits = 0;
        glGetIntegerv(GL_MAX_TEXTURE_UNITS, &texunits);
        if(glGetError() != GL_NO_ERROR || texunits < GLint(m_minTextureUnits)) {
            if(lastTry) {
                LogError << "Not enough GL texture units available: have " << texunits
                         << ", need at least " << m_minTextureUnits;
                return false;
            }
            continue;
        }

        // All good
        const char * system = "(unknown)";
        {
            ARX_SDL_SysWMinfo info;
            info.version.major = 2;
            info.version.minor = 0;
            info.version.patch = 4;
            if(SDL_GetWindowWMInfo(m_window, reinterpret_cast<SDL_SysWMinfo *>(&info))) {
                switch(info.subsystem) {
                case ARX_SDL_SYSWM_UNKNOWN:
                    break;
                case ARX_SDL_SYSWM_WINDOWS:
                    system = "Windows";
                    break;
                case ARX_SDL_SYSWM_X11:
                    system = "X11";
                    break;
#if SDL_VERSION_ATLEAST(2, 0, 3)
                case ARX_SDL_SYSWM_WINRT:
                    system = "WinRT";
                    break;
#endif
                case ARX_SDL_SYSWM_DIRECTFB:
                    system = "DirectFB";
                    break;
                case ARX_SDL_SYSWM_COCOA:
                    system = "Cocoa";
                    break;
                case ARX_SDL_SYSWM_UIKIT:
                    system = "UIKit";
                    break;
#if SDL_VERSION_ATLEAST(2, 0, 2)
                case ARX_SDL_SYSWM_WAYLAND:
                    system = "Wayland";
                    break;
                case ARX_SDL_SYSWM_MIR:
                    system = "Mir";
                    break;
#endif
#if SDL_VERSION_ATLEAST(2, 0, 4)
                case ARX_SDL_SYSWM_ANDROID:
                    system = "Android";
                    break;
#endif
                }
            }
        }

        int red = 0, green = 0, blue = 0, alpha = 0, depth = 0, doublebuffer = 0;
        SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &red);
        SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, &green);
        SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, &blue);
        SDL_GL_GetAttribute(SDL_GL_ALPHA_SIZE, &alpha);
        SDL_GL_GetAttribute(SDL_GL_DEPTH_SIZE, &depth);
        SDL_GL_GetAttribute(SDL_GL_DOUBLEBUFFER, &doublebuffer);
        LogInfo << "Window: " << system << " r:" << red << " g:" << green << " b:" << blue
                << " a:" << alpha << " depth:" << depth << " aa:" << msaa << "x"
                << " doublebuffer:" << doublebuffer;
        break;
    }

    // Use the executable icon for the window
#if ARX_PLATFORM == ARX_PLATFORM_WIN32
    {
        SDL_SysWMinfo info;
        SDL_VERSION(&info.version);
        if(SDL_GetWindowWMInfo(m_window, &info) && info.subsystem == SDL_SYSWM_WINDOWS) {
            platform::WideString filename;
            filename.allocate(filename.capacity());
            while(true) {
                DWORD size = GetModuleFileNameW(NULL, filename.data(), filename.size());
                if(size < filename.size()) {
                    filename.resize(size);
                    break;
                }
                filename.allocate(filename.size() * 2);
            }
            HICON largeIcon = 0;
            HICON smallIcon = 0;
            ExtractIconExW(filename, 0, &largeIcon, &smallIcon, 1);
            if(smallIcon) {
                SendMessage(info.info.win.window, WM_SETICON, ICON_SMALL, LPARAM(smallIcon));
            }
            if(largeIcon) {
                SendMessage(info.info.win.window, WM_SETICON, ICON_BIG, LPARAM(largeIcon));
            }
        }
    }
#endif

    setVSync(m_vsync);

    SDL_ShowWindow(m_window);
    SDL_ShowCursor(SDL_DISABLE);

    m_renderer->initialize();

    onCreate();
    onToggleFullscreen(m_fullscreen);
    updateSize(true);

    onShow(true);
    onFocus(true);

    return true;
}
Beispiel #16
0
void ToutPage::init(void)
{
    SendDlgItemMessage(m_hwnd,IDC_BT_ASPECT,WM_SETFONT,WPARAM(parent->arrowsFont),LPARAM(false));
    SendDlgItemMessage(m_hwnd,IDC_BT_FPS,WM_SETFONT,WPARAM(parent->arrowsFont),LPARAM(false));
}
QString qt_win_get_existing_directory(const QFileDialogArgs &args)
{
    QString currentDir = QDir::currentPath();
    QString result;
    QWidget *parent = args.parent;
    if (parent)
        parent = parent->window();
    else
        parent = QApplication::activeWindow();
    if (parent)
        parent->createWinId();

    QDialog modal_widget;
    modal_widget.setAttribute(Qt::WA_NoChildEventsForParent, true);
    modal_widget.setParent(parent, Qt::Window);
    QApplicationPrivate::enterModal(&modal_widget);

    QString initDir = QDir::toNativeSeparators(args.directory);
    wchar_t path[MAX_PATH];
    wchar_t initPath[MAX_PATH];
    initPath[0] = 0;
    path[0] = 0;
    tTitle = args.caption;

#if !defined(Q_WS_WINCE)
    BROWSEINFO bi;
#else
    qt_BROWSEINFO bi;
#endif

    Q_ASSERT(!parent ||parent->testAttribute(Qt::WA_WState_Created));
    bi.hwndOwner = (parent ? parent->winId() : 0);
    bi.pidlRoot = NULL;
    //### This does not seem to be respected? - the dialog always displays "Browse for folder"
    bi.lpszTitle = (wchar_t*)tTitle.utf16();
    bi.pszDisplayName = initPath;
    bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT | BIF_NEWDIALOGSTYLE;
    bi.lpfn = winGetExistDirCallbackProc;
    bi.lParam = LPARAM(&initDir);

    qt_win_resolve_libs();
    if (ptrSHBrowseForFolder) {
        LPITEMIDLIST pItemIDList = ptrSHBrowseForFolder((BROWSEINFO*)&bi);
        if (pItemIDList) {
            ptrSHGetPathFromIDList(pItemIDList, path);
            IMalloc *pMalloc;
            if (ptrSHGetMalloc(&pMalloc) == NOERROR) {
                pMalloc->Free(pItemIDList);
                pMalloc->Release();
                result = QString::fromWCharArray(path);
            }
        }
    }
    tTitle = QString();

    QApplicationPrivate::leaveModal(&modal_widget);

    qt_win_eatMouseMove();

    if (!result.isEmpty())
        result.replace(QLatin1Char('\\'), QLatin1Char('/'));
    return result;
}
Beispiel #18
0
void MainWindow::CreateMainWindow()
{
	OSVERSIONINFO osvi = {0};
	NONCLIENTMETRICS ncm = {0};

	osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);

	GetVersionEx(&osvi);
	if(osvi.dwMajorVersion < 6)
		ncm.cbSize = sizeof(NONCLIENTMETRICS) - 4;
	else
		ncm.cbSize = sizeof(NONCLIENTMETRICS);
	SystemParametersInfo(SPI_GETNONCLIENTMETRICS,ncm.cbSize,&ncm,0);

	m_hFontNormal = CreateFontIndirect(&ncm.lfMessageFont);
	m_hbrBackground = (HBRUSH)(COLOR_WINDOW+1);

	SetMenu(m_hwnd,LoadMenu(GetModuleHandle(NULL),L"WCCMenu"));

	m_hLoadProj = CreateWindow(L"Button",L"Open projection data...",
		WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | BS_FLAT | CCS_ADJUSTABLE,
		10, 10,
		200, 23,
		m_hwnd,
		(HMENU)ID_LOAD_PROJ,
		NULL, 0);
	SendMessage(m_hLoadProj, WM_SETFONT, (WPARAM)m_hFontNormal, MAKELPARAM(TRUE,0));

	m_hCurrentFolder = CreateWindow(L"Static", L"No projection data selected",
		WS_CHILD | WS_VISIBLE,
		220, 15,
		200, 15,
		m_hwnd,
		NULL, NULL, 0);
	SendMessage(m_hCurrentFolder, WM_SETFONT, (WPARAM)m_hFontNormal, MAKELPARAM(TRUE,0));

	m_hReconSettings = CreateWindow(L"Button",
		L"Reconstruction settings:",
		WS_CHILD | WS_VISIBLE | BS_GROUPBOX,
		10, 250,
		200, 285,
		m_hwnd,
		NULL, NULL, 0);
	SendMessage(m_hReconSettings, WM_SETFONT, (WPARAM)m_hFontNormal, MAKELPARAM(TRUE,0));

	for(int i=0;i<3;i++)
	{
		m_hDimensions[i] = CreateWindowEx(WS_EX_CLIENTEDGE,
			L"Edit",
			L"",
			WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_LEFT,
			120, 268+30*i,
			40, 23,
			m_hwnd,
			(HMENU)ID_RECON_DIM,
			NULL, 0);
			SendMessage(m_hDimensions[i], WM_SETFONT, (WPARAM)m_hFontNormal, MAKELPARAM(TRUE,0));
			SendMessage(m_hDimensions[i], EM_SETLIMITTEXT, (WPARAM)4, NULL);
	}

	m_hReconText[0] = CreateWindow(L"Static",
		L"X/Y Pixels:",
		WS_CHILD | WS_VISIBLE,
		19, 271,
		85, 15,
		m_hwnd,
		NULL, NULL, 0);

	m_hReconText[1] = CreateWindow(L"Static",
		L"Z Slices:",
		WS_CHILD | WS_VISIBLE,
		19, 301,
		85, 15,
		m_hwnd,
		NULL, NULL, 0);

	m_hReconText[2] = CreateWindow(L"Static",
		L"Resolution (mm):",
		WS_CHILD | WS_VISIBLE,
		19, 331,
		100, 15,
		m_hwnd,
		NULL, NULL, 0);

	m_hReconText[3] = CreateWindow(L"Static",
		L"Filter:",
		WS_CHILD | WS_VISIBLE,
		19, 363,
		50, 15,
		m_hwnd,
		NULL, NULL, 0);

	m_hReconText[4] = CreateWindow(L"Static",
		L"Cutoff:",
		WS_CHILD | WS_VISIBLE,
		19, 409,
		50, 15,
		m_hwnd,
		NULL, NULL, 0);

	m_hReconText[5] = CreateWindow(L"Static",
		L"",
		WS_CHILD | WS_VISIBLE,
		19, 499,
		175, 30,
		m_hwnd,
		NULL, NULL, 0);

	for(int i=0;i<6;i++)
		SendMessage(m_hReconText[i], WM_SETFONT, (WPARAM)m_hFontNormal, MAKELPARAM(TRUE,0));

	SendMessage(m_hDimensions[0], WM_SETTEXT, 0, (WPARAM)L"128");
	SendMessage(m_hDimensions[1], WM_SETTEXT, 0, (WPARAM)L"128");
	SendMessage(m_hDimensions[2], WM_SETTEXT, 0, (WPARAM)L"0.1");


	m_hFilter = CreateWindow(L"ComboBox",
		L"",
		WS_CHILD | WS_VISIBLE | WS_TABSTOP | CBS_DROPDOWNLIST,
		19, 379,
		150, 23,
		m_hwnd,
		NULL, NULL, 0);
	SendMessage(m_hFilter, WM_SETFONT, (WPARAM)m_hFontNormal, MAKELPARAM(TRUE,0));
	SendMessage(m_hFilter, CB_ADDSTRING, 0, (LPARAM)L"Ram-Lak");
	SendMessage(m_hFilter, CB_ADDSTRING, 0, (LPARAM)L"Shepp-Logan");
	SendMessage(m_hFilter, CB_ADDSTRING, 0, (LPARAM)L"Hamming");
	SendMessage(m_hFilter, CB_ADDSTRING, 0, (LPARAM)L"Hann");
	SendMessage(m_hFilter, CB_ADDSTRING, 0, (LPARAM)L"Cosine");
	SendMessage(m_hFilter, CB_SETCURSEL, 0, NULL);

	m_hCutoff = CreateWindowEx(0, 
        TRACKBAR_CLASS,                 
        L"Trackbar Control",             
        WS_CHILD | WS_VISIBLE | TBS_AUTOTICKS | TBS_TOP,   
        19, 425,                         
        150, 30,                        
        m_hwnd,							 
        NULL, NULL, NULL); 
	SendMessage(m_hCutoff, TBM_SETRANGE,(WPARAM)FALSE,MAKELPARAM(0,10));
	SendMessage(m_hCutoff, TBM_SETPOS,(WPARAM)TRUE,LPARAM(10));

	m_hBeamHardening = CreateWindowEx(0,
		L"Button",
		L"Beam hardening correction",
		WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX | WS_DISABLED,
		19, 462,
		170, 30,
		m_hwnd,
		NULL, NULL, NULL);
	SendMessage(m_hBeamHardening, WM_SETFONT, (WPARAM)m_hFontNormal, MAKELPARAM(TRUE,0));

	m_hReconstruct = CreateWindow(L"Button",
		L"Start reconstruction",
		WS_CHILD | WS_VISIBLE | WS_TABSTOP |BS_PUSHBUTTON,
		217, 250,
		150, 23,
		m_hwnd,
		(HMENU)ID_START_RECON,
		NULL, NULL);
	SendMessage(m_hReconstruct, WM_SETFONT, (WPARAM)m_hFontNormal, MAKELPARAM(TRUE,0));

	m_hCancel = CreateWindow(L"Button",
		L"Cancel",
		WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON,
		217, 280,
		150, 23,
		m_hwnd,
		(HMENU)ID_CANCEL_RECON,
		NULL, NULL);
	SendMessage(m_hCancel, WM_SETFONT, (WPARAM)m_hFontNormal, MAKELPARAM(TRUE,0));

	m_hSave = CreateWindow(L"Button",
		L"Save reconstruction",
		WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
		217, 310,
		150, 23,
		m_hwnd,
		(HMENU)ID_SAVE_RECON,
		NULL, NULL);
	SendMessage(m_hSave, WM_SETFONT, (WPARAM)m_hFontNormal, MAKELPARAM(TRUE,0));

	m_hLoad = CreateWindow(L"Button",
		L"Load reconstruction",
		WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
		217, 340,
		150, 23,
		m_hwnd,
		(HMENU)ID_LOAD_RECON,
		NULL, NULL);
	SendMessage(m_hLoad, WM_SETFONT, (WPARAM)m_hFontNormal, MAKELPARAM(TRUE,0));

	m_hRemoveMetal = CreateWindow(L"Button",
		L"Remove metal",
		WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
		217, 375,
		150, 23,
		m_hwnd,
		(HMENU)ID_REMOVE_METAL,
		NULL, NULL);
	SendMessage(m_hRemoveMetal, WM_SETFONT, (WPARAM)m_hFontNormal, MAKELPARAM(TRUE,0));

	m_hMetalThreshold = CreateWindowEx(WS_EX_CLIENTEDGE,
		L"Edit",
		L"",
		WS_CHILD | WS_VISIBLE | ES_LEFT,
		217, 405,
		30, 23,
		m_hwnd,
		NULL, NULL, NULL);
	SendMessage(m_hMetalThreshold, WM_SETFONT, (WPARAM)m_hFontNormal, MAKELPARAM(TRUE,0));

	m_hProgress = CreateWindowEx(0, PROGRESS_CLASS, (LPWSTR)NULL,
		WS_CHILD,
		430, 19,
		200, 23,
		m_hwnd,
		NULL, NULL, NULL);
}
Beispiel #19
0
int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam)
{
	GCHOOK *gch = (GCHOOK*)lParam;
	if (!gch)
		return 1;

	if (_stricmp(gch->pDest->pszModule, m_szModuleName)) return 0;

	switch (gch->pDest->iType) {
	case GC_SESSION_TERMINATE:
		{
			GCThreadData* thread = MSN_GetThreadByChatId(gch->pDest->ptszID);
			if (thread != NULL) {
				m_arGCThreads.remove(thread);
				for (int i = 0; i < thread->mJoinedContacts.getCount(); i++)
					delete thread->mJoinedContacts[i];
				delete thread;
			}
		}
		break;

	case GC_USER_MESSAGE:
		if (gch->ptszText && gch->ptszText[0]) {
			GCThreadData* thread = MSN_GetThreadByChatId(gch->pDest->ptszID);
			if (thread) {
				TCHAR* pszMsg = UnEscapeChatTags(NEWTSTR_ALLOCA(gch->ptszText));
				rtrimt(pszMsg); // remove the ending linebreak
				msnNsThread->sendMessage('N', thread->szEmail, thread->netId, UTF8(pszMsg), 0);

				DBVARIANT dbv;
				int bError = getTString("Nick", &dbv);

				GCDEST gcd = { m_szModuleName, gch->pDest->ptszID, GC_EVENT_MESSAGE };
				GCEVENT gce = { sizeof(gce), &gcd };
				gce.dwFlags = GCEF_ADDTOLOG;
				gce.ptszNick = bError ? _T("") : dbv.ptszVal;
				gce.ptszUID = mir_a2t(MyOptions.szEmail);
				gce.time = time(NULL);
				gce.ptszText = gch->ptszText;
				gce.bIsMe = TRUE;
				CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);

				mir_free((void*)gce.ptszUID);
				if (!bError)
					db_free(&dbv);
			}
		}
		break;

	case GC_USER_CHANMGR:
		DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), NULL, DlgInviteToChat,
			LPARAM(new InviteChatParam(gch->pDest->ptszID, NULL, this)));
		break;

	case GC_USER_PRIVMESS:
		{
			char *email = mir_t2a(gch->ptszUID);
			MCONTACT hContact = MSN_HContactFromEmail(email);
			CallService(MS_MSG_SENDMESSAGE, hContact, 0);
			mir_free(email);
		}
		break;

	case GC_USER_LOGMENU:
		switch (gch->dwData) {
		case 10:
			DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), NULL, DlgInviteToChat,
				LPARAM(new InviteChatParam(gch->pDest->ptszID, NULL, this)));
			break;

		case 20:
			MSN_KillChatSession(gch->pDest->ptszID);
			break;
		}
		break;

	case GC_USER_NICKLISTMENU:
		MCONTACT hContact = MSN_HContactFromEmail(_T2A(gch->ptszUID));

		switch (gch->dwData) {
		case 10:
			CallService(MS_USERINFO_SHOWDIALOG, hContact, 0);
			break;

		case 20:
			CallService(MS_HISTORY_SHOWCONTACTHISTORY, hContact, 0);
			break;

		case 30:
			MSN_Kickuser(gch);
			break;

		case 110:
			MSN_KillChatSession(gch->pDest->ptszID);
			break;

		case 40:
			const TCHAR *pszRole = MSN_GCGetRole(MSN_GetThreadByChatId(gch->pDest->ptszID), _T2A(gch->ptszUID));
			MSN_Promoteuser(gch, (pszRole && !mir_tstrcmp(pszRole, _T("admin"))) ? "user" : "admin");
			break;
		}
		break;
	}

	return 0;
}
Beispiel #20
0
void InitListDTrunk(void)
{
	LV_COLUMN	lvc;
	DWORD dwExStyle;
	
	_ASSERT(pdlg != NULL);
	
	dwExStyle = LVS_EX_FULLROWSELECT | /*LVS_EX_GRIDLINES | LVS_EX_SUBITEMIMAGES |*/
		LVS_EX_HEADERDRAGDROP;// | LVS_EX_TRACKSELECT;
	
	pdlg->m_ListDTrunk.SendMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LPARAM(dwExStyle));	
	lvc.mask =  LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
	
	lvc.iSubItem = 0;
	lvc.pszText = "ID" ;
	lvc.cx = 30;
	pdlg->m_ListDTrunk.InsertColumn(0, &lvc); 
	
	lvc.iSubItem = 1;
	lvc.pszText = "Mod,Ch" ;
	lvc.cx = 50;
	pdlg->m_ListDTrunk.InsertColumn(1, &lvc); 
	
	lvc.iSubItem = 2;
	lvc.pszText = "Type" ;
	lvc.cx = 60;
	pdlg->m_ListDTrunk.InsertColumn(2, &lvc); 
	
	lvc.iSubItem = 3;
	lvc.pszText = "LineState" ;
	lvc.cx = 70;
	pdlg->m_ListDTrunk.InsertColumn(3, &lvc); 
	
	lvc.iSubItem = 4;
	lvc.pszText = "State" ;
	lvc.cx = 70;
	pdlg->m_ListDTrunk.InsertColumn(4, &lvc); 
	
	lvc.iSubItem = 5;
	lvc.pszText = "Called" ;
	lvc.cx = 60;
	pdlg->m_ListDTrunk.InsertColumn(5, &lvc); 
	
	lvc.iSubItem = 6;
	lvc.pszText = "Calling" ;
	lvc.cx = 60;
	pdlg->m_ListDTrunk.InsertColumn(6, &lvc); 
	
	lvc.iSubItem = 7;
	lvc.pszText = "LinkDev" ;
	lvc.cx = 60;
	pdlg->m_ListDTrunk.InsertColumn(7, &lvc); 
	
	lvc.iSubItem = 8;
	lvc.pszText = "FailReason" ;
	lvc.cx = 75;
	pdlg->m_ListDTrunk.InsertColumn(8, &lvc); 
	
	lvc.iSubItem = 9;
	lvc.pszText = "DTMF";
	lvc.cx = 75;
	pdlg->m_ListDTrunk.InsertColumn(9, &lvc);
	
	return;
}
Beispiel #21
0
INT_PTR CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	try
	{
		switch(uMsg)
		{
			case WM_INITDIALOG:
			{
				// Double Check^^ für Registrierung
				if (!Registration::IsRegistered())
				{
					PostQuitMessage(0);
				}

				/*
				Icon vom Fenster setzen
				*/
				HICON hIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_ICON1));
				if (!hIcon)
					throw (CError("Failed to load Icon", ERRORPOS));
				SendMessage(hwndDlg, WM_SETICON, WPARAM (ICON_SMALL), LPARAM (hIcon));

				/*
				Einige Dialog - Elemente funktionieren nicht ohne die Initialisierung von CommonControls
				*/
				INITCOMMONCONTROLSEX iccex;
				iccex.dwICC = ICC_PROGRESS_CLASS;
				iccex.dwSize = sizeof(INITCOMMONCONTROLSEX);
				if (!InitCommonControlsEx(&iccex))
					throw (CError("InitCommonControlsEx failed", ERRORPOS));

				// Global machen
				g_hWindow = hwndDlg;

				SetDlgItemText(hwndDlg, IDC_VERSION, VERSION);
				SetDlgItemText(hwndDlg, IDC_EDIT1, "20");
				SetDlgItemText(hwndDlg, IDC_EDIT4, "3.2");
				SetDlgItemText(hwndDlg, IDC_EDIT5, "0");
				SetDlgItemText(hwndDlg, IDC_EDIT6, "0");

				g_pTM2Hack = new CTM2Hack(g_pConsole);

				InitConfig();

				g_pTM2Hack->SendStatusExtern = &UpdateStatus;
				g_pTM2Hack->ProgressUpdateExtern = &ProgressBarControl;

				// Fortschrittsbalken einstellen
				SendDlgItemMessage(hwndDlg, IDC_PROGRESS1, PBM_SETRANGE, 0, MAKELPARAM(0, g_pTM2Hack->GetAddressVector()->size()));
				SendDlgItemMessage(hwndDlg, IDC_PROGRESS1, PBM_SETSTEP, 1, 0);

				SendDlgItemMessage(hwndDlg, IDC_HOTKEY1, HKM_SETHOTKEY, MAKEWPARAM(g_pTM2Hack->m_wNoGravityHotkey,0), 0);
				SendDlgItemMessage(hwndDlg, IDC_HOTKEY1, HKM_SETRULES, 0xFE /*any modifiers*/, MAKELPARAM(HKCOMB_NONE, 0));

				UpdateStatus("Waiting for Maniaplanet");

				return TRUE;
			}
			case WM_COMMAND:
			{
				int wmId    = LOWORD(wParam);
				int wmEvent = HIWORD(wParam);

				switch (wmId)
				{
				case IDC_CHECK1: // Meterhack
					{
						g_pTM2Hack->MeterHack();
						break;
					}
				case IDC_BUTTON2: // CarJump
					{
						BOOL bReadSuccess = FALSE;
						int iHeightValue = GetDlgItemInt(hwndDlg, IDC_EDIT1, &bReadSuccess, true);
						if (bReadSuccess == FALSE)
							throw (CError("Can not read from edit field", ERRORPOS));

						g_pTM2Hack->DoCarJump(iHeightValue);
						break;
					}
				case IDC_CHECK2: // Checkpoint Hack
					{
						g_pTM2Hack->CheckpointHack();
						break;
					}
				case IDC_CHECK3: // BoostHack
					{
						g_pTM2Hack->m_BoostHack.BoostHack();
						break;
					}
				case IDC_BUTTON3: // Boost Options
					{
						INT_PTR iSuccess = DialogBox(g_hInstance, MAKEINTRESOURCE(IDD_DIALOG2), hwndDlg, BoostOptionsDialogProc);
						if (iSuccess == -1)
							throw (CError("Failed to create DialogBox", ERRORPOS));
						break;
					}
				case IDC_CHECK4: // No Platform Counter
					{
						g_pTM2Hack->NoPlatformCounterIncrease();
						break;
					}
				case IDC_CHECK5: // Nogras dirt
					{
						g_pTM2Hack->NoGrasDrive();
						break;
					}
				case IDC_CHECK6: // No free drive
					{
						g_pTM2Hack->NoFreeDrive();
						break;
					}
				case IDC_CHECK7: // Speed Handling hack
					{
						char szInput[8];
						GetDlgItemText(hwndDlg, IDC_EDIT4, szInput, sizeof(szInput));
						float newValue = 0;
						sscanf_s(szInput, "%f", &newValue);
						g_pTM2Hack->SpeedHandlingHack(newValue);
						break;
					}
				case IDC_CHECK8: // No Gravity
					{
						g_pTM2Hack->SwitchNoGravityStatus();
						break;
					}
				case IDC_BUTTON4: // Check version
					{
						g_pTM2Hack->CheckVersion();
						break;
					}
				case IDC_CHECK9: // NO wall friction
					{
						g_pTM2Hack->NoWallFriction();
						break;
					}
				case IDC_CHECK10: // Nadeo unlock
					{
						g_pTM2Hack->UnlockNadeos();
						break;
					}
				case IDC_CHECK11: // Track unlock
					{
						g_pTM2Hack->UnlockTracks();
						break;
					}
				case IDC_CHECK13: // Timefreeze Hack
					{
						BOOL bReadSuccess = FALSE;
						int iTime = GetDlgItemInt(hwndDlg, IDC_EDIT6, &bReadSuccess, true);
						if (bReadSuccess == FALSE)
							throw (CError("Can not read from edit field", ERRORPOS));

						int iTimeCenti = GetDlgItemInt(hwndDlg, IDC_EDIT5, &bReadSuccess, true);
						if (bReadSuccess == FALSE)
							throw (CError("Can not read from edit field", ERRORPOS));

						g_pTM2Hack->TimeFreeze(iTime, iTimeCenti);
						break;
					}
				}
				return TRUE;
			}
			case WM_DESTROY:
				PostQuitMessage(0);
				return TRUE;
			case WM_CLOSE:
				PostQuitMessage(0);
				return TRUE;
		}
		return FALSE;
	}
	catch (CError &e)
	{
		e.Show();
		return FALSE;
	}
}
Beispiel #22
0
INT_PTR CAimProto::JoinChatUI(WPARAM, LPARAM)
{
	DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_CHAT), NULL, join_chat_dialog, LPARAM(this));
	return 0;
}
BOOL JabberEnterString( TCHAR* result, size_t resultLen )
{
	JabberEnterStringParams params = { result, resultLen };
	return DialogBoxParam( hInst, MAKEINTRESOURCE( IDD_GROUPCHAT_INPUT ), NULL, JabberEnterStringDlgProc, LPARAM( &params ));
}
Beispiel #24
0
void muiWindow::OnSetCursor(HWND hwndChild, WORD nHittest, WORD wMouseMsg)
{
	DefWindowProc(hwnd, WM_SETCURSOR, (WPARAM)hwndChild, nHittest + (LPARAM(wMouseMsg)<<16));
}
void ConvexApproximationObject::BeginEditParams( IObjParam *ip, ULONG flags, Animatable *prev )
{
	GeomObject::BeginEditParams(ip,flags,prev);

	ConvexApproximationClassDesc* const desc = (ConvexApproximationClassDesc*) ConvexApproximationClassDesc::GetDescriptor();
	_ASSERTE (ip == GetCOREInterface());

	desc->m_currentInterface = ip;
	m_createParameterUI = ip->AddRollupPage(hInstance, MAKEINTRESOURCE(IDD_CONVEX_APPROXIMATION_PANE), ConvexApproximationObject::Proc, _T("Newton World"), LPARAM (this));
}
BOOL AppMainApp::InitInstance()
{
	pMainDialogWindowCrypt = NULL;
	pMainDialogWindow=NULL;
	if (!InitATL()){
		return FALSE;
	}
	{// На первый запуск...
		char sz1[128]={0};
		char sz2[128]="1";
		CString sAddCal;
		GetCommandLineParameter("addcal",sAddCal);
		if(sAddCal!=""){
			strcpy(sz1,sAddCal);
			SetRegSetting("", "FR_addCalendar", sz1);
			return FALSE;
		}
		CString sAddClo;
		GetCommandLineParameter("addclo",sAddClo);
		if(sAddClo!=""){
			strcpy(sz2,sAddClo);
			SetRegSetting("", "FR_addClock", sz2);
			return FALSE;
		}
		GetRegSetting("", "FR_addClock", sz1, sizeof(sz1));
		bAddOnStartClo=atol(sz1);
		GetRegSetting("", "FR_addCalendar", sz2, sizeof(sz2));
		bAddOnStartCal=atol(sz2);
	}
	{//setup_file
		// Регистрируем файл
		char szWkmRegistered[32]={0};
		GetRegSetting("", "wpc_setupRegistered", szWkmRegistered, sizeof(szWkmRegistered));
		if(szWkmRegistered[0]==0){
			strcpy(szWkmRegistered,"yes");
			SetRegSetting("", "wpc_setupRegistered", szWkmRegistered);
			RegisterExtension("wpc_setup","WireChanger setup file","-setup_file=");
		}
		CString sSetupFile;
		GetCommandLineParameter("setup_file",sSetupFile);
		if(sSetupFile!=""){
			if(isFileExist(sSetupFile)){
				CString sContent,sKeyPart;
				ReadFile(sSetupFile,sContent);
				CString sXML=CDataXMLSaver::GetInstringPart("<SETUP>","</SETUP>",sContent);
				if(sXML==""){
					sKeyPart=sContent;
				}
				// Делаем что сказано...
				if(sKeyPart!=""){
					SaveFile(GetUserFolder()+LICENSE_KEY_FILE,sKeyPart);
					AfxMessageBox(_l("Registration info installed successfully\nRestart WireChanger to see changes"));
				}
			}else{
				AfxMessageBox(Format("Reading setup file error: '%s' not found!",sSetupFile));
			}
			return FALSE;
		}
	}
	CString sExe;
	GetCommandLineParameter("add",sExe,0);
	if(sExe!=""){_XLOG_
		CString sNewFile=CString(GetApplicationDir())+WP_TEMPLATE+"\\"+GetPathPart(sExe,0,0,1,1);
		BOOL b=CopyFile(sExe,sNewFile,TRUE);
		if(!b){
			AfxMessageBox(_l("Error")+": "+_l("Widget already exist"));
		}
		return FALSE;
	}
    // Глобальные настройки
    CString sDats;
    ReadFile(CString(GetApplicationDir())+"inits.txt",sDats);
    AppName()=PROGNAME;
    AddDefsWallps()=1;
	AddDefsInteract()=1;
	if(sDats.GetLength()){
		CString sAppName=CDataXMLSaver::GetInstringPart("app:[","]",sDats);
		if(sAppName.GetLength()!=0){
			AppName()=sAppName;
		}
		AddDefsWallps()=atol(CDataXMLSaver::GetInstringPart("defs:[","]",sDats));
		AddDefsInteract()=atol(CDataXMLSaver::GetInstringPart("intr:[","]",sDats));
	}
    //===========
	CString sConsoleMode;
	GetCommandLineParameter("console",sConsoleMode);
	CString sIniFileInfo;
	ReadFile(CString(GetApplicationDir())+"install.ini",sIniFileInfo);
	if(sIniFileInfo!=""){
		sIniFileInfo+="\r\n";
	}
	if(sConsoleMode=="yes"){
		CString sConsoleSave,sConsoleRest;
		GetCommandLineParameter("wpsave",sConsoleSave);
		GetCommandLineParameter("wprestore",sConsoleRest);
		if(sConsoleSave=="yes"){
			if(sIniFileInfo.Find("[Main]")==-1){
				sIniFileInfo+="[Main]\r\n";
			}
			
			CString sAID,sDte;
			GetCommandLineParameter("affid",sAID);
			GetCommandLineParameter("date",sDte);
			if(sIniFileInfo.Find("AffId=")==-1){
				sIniFileInfo+=CString("AffId=")+sAID+"\r\n";
			}
			if(sIniFileInfo.Find("Date=")==-1){
				sIniFileInfo+=CString("Date=")+sDte+"\r\n";
			}
			if(sIniFileInfo.Find("CPD-W")==-1){
				CRegKey key;
				key.Open(HKEY_CURRENT_USER, "Control Panel\\Desktop");
				if(key!=NULL){
					char szTemp[MAX_PATH]="";
					DWORD lSize,dwType=0;
					lSize = MAX_PATH;
					if(RegQueryValueEx(key.m_hKey,"Wallpaper",NULL, &dwType,(LPBYTE)szTemp, &lSize)== ERROR_SUCCESS){
						sIniFileInfo+="CPD-W=<";
						sIniFileInfo+=szTemp;
						sIniFileInfo+=">\r\n";
					}
					lSize = MAX_PATH;
					if(RegQueryValueEx(key.m_hKey,"WallpaperStyle",NULL, &dwType,(LPBYTE)szTemp, &lSize)== ERROR_SUCCESS){
						sIniFileInfo+="CPD-WS=<";
						sIniFileInfo+=szTemp;
						sIniFileInfo+=">\r\n";
					}
					lSize = MAX_PATH;
					if(RegQueryValueEx(key.m_hKey,"TileWallpaper",NULL, &dwType,(LPBYTE)szTemp, &lSize)== ERROR_SUCCESS){
						sIniFileInfo+="CPD-WT=<";
						sIniFileInfo+=szTemp;
						sIniFileInfo+=">\r\n";
					}
					lSize = MAX_PATH;
					if(RegQueryValueEx(key.m_hKey,"SCRNSAVE.EXE",NULL, &dwType,(LPBYTE)szTemp, &lSize)== ERROR_SUCCESS){
						sIniFileInfo+="CPD-SS=<";
						sIniFileInfo+=szTemp;
						sIniFileInfo+=">\r\n";
					}
				}
				{// На дефолтного
					CRegKey key;
					key.Open(HKEY_USERS, ".DEFAULT\\Control Panel\\Desktop");
					if(key!=NULL){
						char szTemp[MAX_PATH]="";
						DWORD lSize,dwType=0;
						lSize = MAX_PATH;
						if(RegQueryValueEx(key.m_hKey,"Wallpaper",NULL, &dwType,(LPBYTE)szTemp, &lSize)== ERROR_SUCCESS){
							sIniFileInfo+="DCPD-W=<";
							sIniFileInfo+=szTemp;
							sIniFileInfo+=">\r\n";
						}
						lSize = MAX_PATH;
						if(RegQueryValueEx(key.m_hKey,"WallpaperStyle",NULL, &dwType,(LPBYTE)szTemp, &lSize)== ERROR_SUCCESS){
							sIniFileInfo+="DCPD-WS=<";
							sIniFileInfo+=szTemp;
							sIniFileInfo+=">\r\n";
						}
						lSize = MAX_PATH;
						if(RegQueryValueEx(key.m_hKey,"TileWallpaper",NULL, &dwType,(LPBYTE)szTemp, &lSize)== ERROR_SUCCESS){
							sIniFileInfo+="DCPD-WT=<";
							sIniFileInfo+=szTemp;
							sIniFileInfo+=">\r\n";
						}
					}
				}
			}
			if(sIniFileInfo.Find("UserData")==-1 || sIniFileInfo.Find("ConfigFile")==-1){
				sIniFileInfo+="ConfigFile=";
				sIniFileInfo+=objSettings.sIniFile;
				sIniFileInfo+="\r\n";
				sIniFileInfo+="UserData=";
				sIniFileInfo+=GetPathPart(objSettings.sIniFile,1,1,0,0);
				sIniFileInfo+="\r\n";
			}
			SaveFile(CString(GetApplicationDir())+"install.ini",sIniFileInfo);
		}else if(sConsoleRest=="yes"){
			if(sIniFileInfo==""){
				return 0;
			}
			RestoreWP(sIniFileInfo,1);
		}
		return FALSE;
	}
	CString sWait;
	GetCommandLineParameter("wait",sWait);
	DWORD dwStartWait=GetTickCount();
	if(sWait=="yes"){
		while(CheckProgrammRunState(NULL, UNIQUE_TO_TRUSTEE, false) && GetTickCount()-dwStartWait<180000){
			Sleep(1000);
		}
	}
	// Для нормально работы клонов
	if(IsThisProgrammAlreadyRunning()){
		// || IsOtherProgrammAlreadyRunning("WireChanger")
		DWORD dwTarget=BSM_APPLICATIONS;
		BroadcastSystemMessage(BSF_FORCEIFHUNG | BSF_IGNORECURRENTTASK | BSF_POSTMESSAGE, &dwTarget, iWM_THIS, WPARAM(99), LPARAM(99));
		return FALSE;
	}
	// Столбим уникальное за компьютером...
	CheckProgrammRunState("WC3",UNIQUE_TO_COMPUTER,1,"");
	CString sRestore;
	GetCommandLineParameter("restore",sRestore);
	if(sRestore!="" && isFileExist(sRestore)){
		CString sIniPath=GetPathPart(objSettings.sIniFile,1,1,0,0);
		{//Первый проход
			CZipArchive zipFile;
			if(zipFile.Open(sRestore)){
				ZIP_FIND_DATA pFind;
				HANDLE hSearch=zipFile.FindFirstFile("*.*",&pFind);
				while(zipFile.FindNextFile(hSearch, &pFind)){
					CString sFileName=pFind.szFileName;
					if(sFileName!=""){
						CZipFile zI;
						if(zipFile.GetFile(pFind.nDirIndex,&zI)){
							DeleteFile(sIniPath+sFileName);
							zI.SafeSaveToDosk(sIniPath+sFileName,0);
						}
					}
				}
				zipFile.FindClose(hSearch);
				zipFile.Close();
			}
		}
	}
	AfxEnableControlContainer();
	AfxInitRichEdit();
#if WINVER<=0x0050
#ifdef _AFXDLL
	Enable3dControls();			// Call this when using MFC in a shared DLL
#else
	Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif
#endif
	OleInitialize(NULL);
	//
	CRYPT_START
	objSettings.sLikUser="";
	objSettings.sLikKey="";
	HANDLE hLicenseFile=::CreateFile(GetUserFolder()+LICENSE_KEY_FILE, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
	if (!hLicenseFile || hLicenseFile==INVALID_HANDLE_VALUE){
		// Из локального каталога!
		hLicenseFile=::CreateFile(CString(GetApplicationDir())+LICENSE_KEY_FILE, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
	}
	if (hLicenseFile && hLicenseFile!=INVALID_HANDLE_VALUE){
		DWORD dwRead=0;
		char szKey[2048]="";
		objSettings.sLikKey="";
		::ReadFile(hLicenseFile, szKey, sizeof(szKey), &dwRead, NULL);
		objSettings.sLikUser=CDataXMLSaver::GetInstringPart("user:[","]",szKey);
		objSettings.sLikKey=CDataXMLSaver::GetInstringPart("key:[","]",szKey);
		::CloseHandle(hLicenseFile);
	}
#ifdef LIC_HARDCODED_U
	objSettings.sLikUser=LIC_HARDCODED_U;
#endif
#ifdef LIC_HARDCODED_K
	objSettings.sLikKey=LIC_HARDCODED_K;
#endif
	//if(sIniFileInfo.Find("WireChangerEF")!=-1){
		/*
		WC5Elefun	CCC2-HJ3S-88A6-C4TP
		*/
		/*
		WC5IPv6	4HVF-9XF6-DGQ2-94U2	
		*/
		/*
		WK999IPv6	EJCM-VNR7-GZ8F
		*/
		/*Mapi2Pop3
		IPv6	GT8N-6747-AGDM
		*/
		/*
		// Здесь поддержан элефан
		USE_ELEFUN=1;
		objSettings.sLikUser="******";
		objSettings.sLikKey=Recrypt("\xd3\x4c\xc3\x24\x84\x53\x3e\x2a\x2c\x21\x9e\x24\x48\x34\xb5\xb4");//"CCC2-HJ3S-88A6-C4TP";// EXECryptor_DecryptStr()?
		*/
	//}
	UpdateTrialityStatus(objSettings.sLikUser,objSettings.sLikKey);
	if(objSettings.iLikStatus<0){
		CSettings* objAntiDebug=0;
		objAntiDebug->ApplySettings();
		return FALSE;
	}
	CRYPT_END
	objSettings.Load();
	if(sConsoleMode=="help"){
		ShowHelp("Overview");
		return 0;
	}
	{// грузим ddown
		CBitmap bpTmp;
		bpTmp.LoadBitmap(IDB_DDOWN_A);
		_bmp().AddBmpRaw("DDOWN",&bpTmp,GetBitmapSize(bpTmp));
	}
	{// грузим remd
		CBitmap bpTmp;
		bpTmp.LoadBitmap(IDB_REMIND_A);
		_bmp().AddBmpRaw("REMINDER",&bpTmp,GetBitmapSize(bpTmp));
	}
	theApp.MainImageList.Create(16, 16, ILC_COLOR16 | ILC_MASK, 0, 2);
	// Основные иконки
	AddBitmapToIList(theApp.MainImageList,IDB_IMAGELIST);
	for(int i=0;i<theApp.MainImageList.GetImageCount();i++){
		HICON hIcon=theApp.MainImageList.ExtractIcon(i);
		_bmp().AddBmp(_IL(i),hIcon);
		ClearIcon(hIcon);
	}
	_bmp().AddBmpRaw(IDB_BM_LOGO,CSize(LOGO_W,LOGO_H));
	// Пытаемся к пустому окну захимичится
	rFakedRect.SetRect(-10,0,0,0);
	LPCTSTR szClass = AfxRegisterWndClass(NULL);
	m_pFakeWnd = new CWnd;
	m_pFakeWnd->CreateEx(0, szClass, ROOT_WND_NAME, 0, rFakedRect, NULL, 0);
	m_pFakeWnd->ShowWindow(SW_HIDE);
	m_pFakeWnd->EnableWindow(FALSE);
	m_pFakeWnd->SetIcon(::AfxGetApp()->LoadIcon(MAIN_ICON),TRUE);
	m_pFakeWnd->SetIcon(::AfxGetApp()->LoadIcon(MAIN_ICON),FALSE);
	HotkeysSkipDD()=1;
	// Если при запуске небыло найдено ini-файла, показываем опции...
	if(objSettings.bStartWithOptions){
		objSettings.bStartWithOptions=FALSE;
		if(IsStartupWithWindows()==FALSE){
			StartupApplicationWithWindows(TRUE);
		}
		// точней больше не показываем
		// objSettings.OpenOptionsDialog();
	}
	
	// Создаем
	pMainDialogWindow = new AppMainDlg();
	pMainDialogWindowCrypt = pMainDialogWindow;
	if(!pMainDialogWindow){
		return FALSE;
	}
	theApp.m_pMainWnd=pMainDialogWindow;// Сначала задаем главное окно, потом создаем его
	pMainDialogWindow->Create(AppMainDlg::IDD,m_pFakeWnd);
	// Все!
	return TRUE;
}
Beispiel #27
0
INT_PTR CAimProto::InstantIdle(WPARAM, LPARAM)
{
	DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_IDLE), NULL, instant_idle_dialog, LPARAM(this));
	return 0;
}
			static void Enumerate(BOOL (CALLBACK* callback)(HWND,LPARAM),T t)
			{
				::EnumThreadWindows( instance.threadId, callback, LPARAM(t) );
			}
Beispiel #29
0
INT_PTR CMsnProto::MsnInviteCommand(WPARAM, LPARAM)
{
	DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), NULL, DlgInviteToChat,
		LPARAM(new InviteChatParam(NULL, NULL, this)));
	return 0;
}
void fsODMenu::OnDrawItem(LPDRAWITEMSTRUCT pdis)
{
	CDC *dc = CDC::FromHandle (pdis->hDC);
	fsODMenuItemData* pData = (fsODMenuItemData*) pdis->itemData;
	UINT uState = pdis->itemState;
	CFont *oldfont = dc->SelectObject (pData->bBold ? &m_fontBold : &m_font);

	RECT rcItem = pdis->rcItem;
	
	RECT rcIcon = rcItem;
	rcIcon.left += 3;
	rcIcon.right = rcIcon.left + m_cxIcon;
	rcIcon.top += (rcIcon.bottom - rcIcon.top - m_cyIcon) / 2;
	rcIcon.bottom = rcIcon.top + m_cyIcon;

	RECT rcIconFrame = rcIcon;
	InflateRect (&rcIconFrame, 2, 2);

	RECT rcSel;
	
	if (pData->bMenuBar)
	{
		rcSel = pdis->rcItem;
		InflateRect (&rcSel, -1, -1);
		fsFillSolidRect (dc, &rcItem, GetSysColor (COLOR_3DFACE));
	}
	else
	{
		rcSel = rcIconFrame;
		rcSel.right = rcItem.right;
		rcSel.bottom++;
		
		fsFillSolidRect (dc, &rcItem, GetSysColor (COLOR_MENU));
		rcItem.left += m_cxIcon;
	}
	
	if (pData->strMenuText.GetLength () == 0)
	{
		RECT rect = rcItem;
		rect.left -= m_cxIcon;
		rect.top += (rect.bottom - rect.top) / 2;
		rect.bottom = rect.top+1;
		rect.right = rcItem.right;
		fsFillSolidRect (dc, &rect, GetSysColor (COLOR_GRAYTEXT));
		return;
	}

	if (uState & 0x40 )
		if (pData->bMenuBar)
			fsDrawFrame (dc, &rcSel, 1);

	if (uState & ODS_SELECTED)	
	{
		if (pData->bMenuBar)
			fsDrawPressedFrame (dc, &rcSel, 1);	
		else
		{
			
			fsFillSolidRect (dc, &rcSel, GetSysColor (COLOR_HIGHLIGHT));
		}
	}

	dc->SetBkMode (TRANSPARENT);

	if (pData->bMenuBar)
	{
		
		if (uState & ODS_GRAYED || uState & ODS_DISABLED) 
			dc->SetTextColor (GetSysColor (COLOR_GRAYTEXT));
		dc->DrawText (pData->strMenuText, &rcItem, DT_VCENTER | DT_SINGLELINE | DT_CENTER);
	}
	else
	{
		CPen pen (PS_SOLID, 1, GetSystemMetrics (COLOR_HIGHLIGHTTEXT));

		CPen *oldpen = dc->SelectObject (&pen);

		if (uState & ODS_GRAYED || uState & ODS_DISABLED) 
			dc->SetTextColor (GetSysColor (COLOR_GRAYTEXT));
		else if (uState & ODS_SELECTED)
			dc->SetTextColor (GetSysColor (COLOR_HIGHLIGHTTEXT));
		else
			dc->SetTextColor (GetSysColor (COLOR_MENUTEXT));

		

		LPCSTR pszTab = strchr (pData->strMenuText, '\t');
		int left = pszTab ? pszTab - pData->strMenuText : pData->strMenuText.GetLength ();

		rcItem.left += 9; rcItem.right -= 15;
		dc->DrawText (pData->strMenuText, left, &rcItem, DT_VCENTER | DT_SINGLELINE);

		if (pszTab)
			dc->DrawText (pszTab+1, -1, &rcItem, DT_VCENTER | DT_SINGLELINE | DT_RIGHT);

		dc->SelectObject (oldpen);
	}

	

	POINT ptIcon;
	ptIcon.x = rcIcon.left + 1;
	ptIcon.y = rcIcon.top + 1;

	RECT rcClr = pdis->rcItem;
	rcClr.right = m_cxIcon + 5;

	if (uState & ODS_CHECKED)
	{
		if (pData->iCheckImage >= 0)
		{
			fsFillSolidRect (dc, &rcClr, GetSysColor (COLOR_MENU));
			m_pImages->Draw (dc, pData->iCheckImage, ptIcon, ILD_TRANSPARENT);
		}
		else if (pData->iImage >= 0)
		{
			fsFillSolidRect (dc, &rcClr, GetSysColor (COLOR_MENU));
			
			
			rcIconFrame.right--;
			fsDrawPressedFrame (dc, &rcIconFrame, 1);
			m_pImages->Draw (dc, pData->iImage, ptIcon, ILD_TRANSPARENT);
		}
		else
		{
			CFont font;
			char check;
			int fsize;

			switch (pData->iCheckImage)
			{
				case ODMENU_CHECKIMAGE_CHECK:
				{
					DrawCheckMark (dc, rcIcon, uState & ODS_SELECTED, uState & ODS_GRAYED);
					
				}
				break;

				case ODMENU_CHECKIMAGE_RADIO:
				{
					check = 105;
					fsize = m_cyIcon;
					font.CreateFont (fsize, 0, 0, 0, FW_NORMAL, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 0, "Marlett");
					CFont* oldfont = dc->SelectObject (&font);
					dc->DrawText (&check, 1, &rcIcon, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
					dc->SelectObject (oldfont);
				}
				break;

				default:
					return;
			}
		}
	}
	else if (pData->iImage != -1)
	{
		fsFillSolidRect (dc, &rcClr, GetSysColor (COLOR_MENU));

		if (uState & ODS_GRAYED || uState & ODS_DISABLED)
		{
			if (m_pDisImages == NULL)
			{
				HICON hI = m_pImages->ExtractIcon (pData->iImage);

				DrawState (dc->m_hDC, NULL, NULL, LPARAM (hI), 0, ptIcon.x, ptIcon.y, m_cxIcon, m_cyIcon, 
					DST_ICON | DSS_DISABLED);

				DestroyIcon (hI); 
			}
			else
				m_pDisImages->Draw (dc, pData->iImage, ptIcon, ILD_TRANSPARENT);

		}
		else
		{
			if (uState & ODS_SELECTED)
				fsDrawFrame (dc, &rcIconFrame, 1);

			m_pImages->Draw (dc, pData->iImage, ptIcon, ILD_TRANSPARENT);
		}
	}

	dc->SelectObject (oldfont);
}