示例#1
0
//--------------------------------------------------------------------------------------
// Регистрация класса и создание окна
//--------------------------------------------------------------------------------------
HRESULT InitWindow(HINSTANCE hInstance, int nCmdShow)
{
  // Регистрация класса
  WNDCLASSEX wcex;
  wcex.cbSize = sizeof(WNDCLASSEX);
  wcex.style = CS_HREDRAW | CS_VREDRAW;
  wcex.lpfnWndProc = WndProc;
  wcex.cbClsExtra = 0;
  wcex.cbWndExtra = 0;
  wcex.hInstance = hInstance;
  wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_ICON1);
  wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
  wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
  wcex.lpszMenuName = NULL;
  wcex.lpszClassName = LPCSTR("TorusWindowClass");
  wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_ICON1);

  if(!RegisterClassEx(&wcex))
    return E_FAIL;

  // Создание окна
  g_hInst = hInstance;
  RECT rc = { 0, 0, WINDOW_SIZE_WIDTH, WINDOW_SIZE_HEIGHT };
  AdjustWindowRect(&rc, WS_OVERLAPPEDWINDOW, FALSE);

  g_hWnd = CreateWindow(LPCSTR("TorusWindowClass"), LPCSTR(WINDOW_TITLE), WS_OVERLAPPEDWINDOW,
                        CW_USEDEFAULT, CW_USEDEFAULT, rc.right - rc.left, rc.bottom - rc.top, NULL, NULL, hInstance,
                        NULL);
  if(!g_hWnd)
    return E_FAIL;

  ShowWindow(g_hWnd, nCmdShow);
  return S_OK;
}
示例#2
0
/*
// Seleciona um target
static int SetSelectTarget(lua_State *L) // SetSelectTarget(id_target)
{
	int id_target = (int)luaL_checknumber(L, 1);

	__try
	{
		__asm
		{
		   // Select Target (GetTarget)
		   mov eax, TargetHandlerLoL
		   add eax, offset_targetselect;
		   mov ebx, id_target
		   mov dword ptr ds:[eax], ebx
		}
	}
	__except(EXCEPTION_EXECUTE_HANDLER)
	{
		MessageBox(0, LPCSTR("SetSelectTarget() failed - exception"), LPCSTR("Exception Error"), 0);
	}
}

// Captura o ID do Target Selecionado
static int GetSelectIDTarget(lua_State *L)
{
	int tmp;
	__try
	{
		__asm
		{
		   // Select Target (GetTarget)
		   mov eax, TargetHandlerLoL
		   add eax, offset_targetselect;
		   mov ebx, dword ptr ds:[eax]
		   mov tmp, ebx
		}

		if(tmp != 0x00)
		{
			ObjectTarget.SelectTargetID = tmp;
		}
	}
	__except(EXCEPTION_EXECUTE_HANDLER)
	{
	 MessageBox(0, LPCSTR("GetSelectTarget() failed - exception"), LPCSTR("Exception Error"), 0);
	}

	lua_pushnumber(L, tmp);
	return 1;// Returno TMP for LUA ...
}
*/
void AutoCursorTarget()
{
	if(TargetHandlerLoL == 0x00)
	 TargetHandlerLoL = GetModuleLoL();

	int tmp;
	if(StatAutoCursorTarget)
	{
		__try
		{
		 __asm
		 {
			// Mouse Target
			mov eax, TargetHandlerLoL
			add eax, 0x29828A4			// 27/02/2014	**********************************
			mov ebx, dword ptr ds:[eax]
			mov tmp, ebx
		 }
		 if(tmp != 0x00)
		 {
		  __asm
		  {
		    // Select Target
			mov eax, TargetHandlerLoL
		    add eax, offset_targetselect;
			mov dword ptr ds:[eax], ebx
		  }
	     }
		}
		__except(EXCEPTION_EXECUTE_HANDLER)
		{
			MessageBox(0, LPCSTR("SetAutoCursorTarget(true) failed - exception"), LPCSTR("Exception Error"), 0);
		}
	}
示例#3
0
int SetMaxZoom(lua_State *L) // SetMaxZoom(ValueZoom)
{
    if(OtherHandlerLoL == 0x00)
        OtherHandlerLoL = GetModuleLoL();

    float zoom = (float)luaL_checknumber(L, 1);
    __try
    {
        pVirtualProtect = (unsigned char*)OtherHandlerLoL+0x0CD11FC;
        VirtualProtect(pVirtualProtect, 4, PAGE_EXECUTE_READWRITE, &lpflOldProtect);
        __asm
        {
            mov eax, OtherHandlerLoL
            add eax, 0x0CD11FC 			// 28/02/2014	**********************************
            mov ebx, zoom
            mov dword ptr ds:[eax], ebx
        }
    }
    __except(EXCEPTION_EXECUTE_HANDLER)
    {
        MessageBox(0, LPCSTR("SetMaxZoom(ValueZoom) failed - exception"), LPCSTR("Exception Error"), 0);
    }

    return 0;
}
示例#4
0
void CStartTargetDB::OnSuOk() 
{
	// TODO: Add your control notification handler code here
	int i, maxcount = m_ListDB.GetCount();
	CString	tmpString;
	bool bResult;
	char sSucDB[1024];
	memset( sSucDB, 0x00, sizeof( sSucDB ) );
	CString msg;

	for (i = 0; i < maxcount; i++) {
		if (m_ListDB.GetSel(i) > 0) {
			m_ListDB.GetText(i, tmpString);
			bResult = cCUBRID->bStartCUBRID((char *)LPCSTR( tmpString ) );
TRACE2( "Start DB( %s ) : %s\n", (char *)LPCSTR( tmpString ), bResult?"TRUE":"FALSE" );

			if( bResult )
			{
				if( strlen( sSucDB ) <= 0 ) sprintf( sSucDB, "%s", (char *)LPCSTR( tmpString ) );
				else                        sprintf( sSucDB, "%s, %s", sSucDB, (char *)LPCSTR( tmpString ) );
			}
		}
	}

//	msg.Empty();
//	msg.Format(theLang.GetMessage(MSG_START), sSucDB);
//	AfxMessageBox(msg, MB_OK | MB_ICONINFORMATION);

	CDialog::OnOK();
	
}
示例#5
0
BOOL CHandoutDoc::ParseHandoutSection(CString &strSection)
{
    CParseBuffer Section(strSection);
    Section.IgnoreLineFeeds();
    while( Section.IsEmpty() == FALSE )
    {
        CString strKey = Section.ExtractQuotedString();
        CString strValue = Section.ExtractQuotedString();
        if( Section.IsUnderflow() == FALSE && Section.IsParseError() == FALSE )
        {
            if( strKey.CompareNoCase( "Template" ) == 0 ) m_strSheet = strValue; else
            if( strnicmp( strKey, "TEXT", 4 ) == 0 )
            {
                int i = atoi( LPCSTR(strKey)+4 );
                if( i >= 0 && i < MAX_HANDOUT_TEXT_FIELDS ) m_strStrings[i] = strValue;
            }
            else
            if( strnicmp( strKey, "PICTURE", 7 ) == 0 )
            {
                int i = atoi( LPCSTR(strKey)+7 );
                if( i >= 0 && i < MAX_HANDOUT_PICTURE_FIELDS ) m_strPictures[i] = strValue;
            }
        }
        else
            return FALSE;
    }

    return TRUE;

}
void CRootDlg::OnOK() 
{
	CString result;

	if(m_BtnPrev.GetCheck()){
		m_PrevList.GetText(m_PrevList.GetCurSel(), result);
	}
	else{
		m_CustomName.GetWindowText(result);
		if(result==""){
			MessageBeep(MB_ICONERROR);
			return;
		}

		char full[MAX_PATH];
		_fullpath(full, LPCSTR(result), MAX_PATH);
		result = CString(full);

		result.Replace('/', '\\');
		if(result[result.GetLength()-1]!='\\') result += '\\';
		m_CustomName.SetWindowText(result);
	}

	// check whether the filename lies within this folder
	if(m_Filename!=""){
		CString filename = m_Filename;
		filename.Replace('/', '\\');
		if(result!=filename.Left(result.GetLength())){
			MessageBox("Folder '" + result + "' is not a parent folder of file '" + m_Filename + "'.", "Error", MB_ICONERROR);
			return;
		}
	}


	DWORD attr = GetFileAttributes(LPCSTR(result));
	if(attr == 0xFFFFFFFF || (attr & FILE_ATTRIBUTE_DIRECTORY) == 0){
		if(MessageBox("Folder '" + result + "' doesn't exist.\nDo you want to create it?", NULL, MB_ICONQUESTION|MB_OKCANCEL)!=IDOK) return;

		result = MakePath(result);
		if(result==""){
			MessageBox("The specified folder cannot be created.", "Error", MB_ICONERROR);
			return;
		}
	}
/*
	CFileFind finder;
	if(!finder.FindFile(result + "startup.settings")){
		if(MessageBox("This doesn't appear to be a valid root folder (the 'startup.settings' file was not found).\n\nDo you want to continue anyway?", "Warning", MB_ICONWARNING|MB_YESNO)!=IDYES) return;
	}
*/
	CFileFind finder;
	if(!finder.FindFile(result + "*.wpr")){
		if(MessageBox("This doesn't appear to be a valid root folder (no project file was found).\n\nDo you want to continue anyway?", "Warning", MB_ICONWARNING|MB_YESNO)!=IDYES) return;
	}
	
	m_SelectedFolder = result;

	
	CDialog::OnOK();
}
/**
	@brief	Assigned Load의 RouteGroup을 원상복귀

	@author KHS	

	@date 2009-05-26 오전 10:25:21	

	@param	

	@return		
**/
int CCableRouteAssignTOLoadDlg::MoveToOriginalRouteGroup(void)
{
	for(map<CELoadItem*,string>::iterator itr = m_LoadRouteGroupMap.begin();itr != m_LoadRouteGroupMap.end();++itr)
	{
		itr->first->prop()->SetValue(_T("Cable Route") , _T("Route Group") , itr->second);
	}

	DisplayRouteGroupData();
	
	CString rLoadArea, rBusId;
	int nSelItem = m_wndLoadAreaCombo.GetCurSel();
	if( -1 != nSelItem) m_wndLoadAreaCombo.GetLBText(nSelItem , rLoadArea);

	nSelItem = m_wndSortByBusCombo.GetCurSel();
	if(-1 != nSelItem) m_wndSortByBusCombo.GetLBText(nSelItem, rBusId);

	if(m_wndRouteGrListCtrl.GetItemCount() > 0)
	{
		const string rRouteGroup = m_wndRouteGrListCtrl.GetItemText(0 , 0);
		m_wndRouteGrListCtrl.SetFocus();
		// Turn off hilight for previous drop target
		m_wndRouteGrListCtrl.SetItemState(0, LVIS_FOCUSED | LVIS_SELECTED, LVIS_FOCUSED | LVIS_SELECTED);
		// Redraw previous item
		m_wndRouteGrListCtrl.RedrawItems (0, 0);
		
		DisplayLoadHasRouteGroup(m_wndAssignLoadListCtrl , rRouteGroup, rLoadArea.operator LPCSTR(), rBusId.operator LPCSTR());
	}
	DisplayLoadHasRouteGroup(m_wndNotAssignLoadListCtrl , _T(""), rLoadArea.operator LPCSTR(), rBusId.operator LPCSTR());

	return ERROR_SUCCESS;
}
示例#8
0
// Timeout of press and hold ALT and also WIN
void timerTick()
{
	StopTimeOut();
	if (LAltDown)
	{
		OutputDebugStringA(LPCSTR("timerTick : LAltDown ==> kill_tab = false \n"));
		kill_Tab = FALSE;
		//kill_LAlt = FALSE; // just kill TAB so Alt - LEFT = back
		//SendKey(VK_LMENU);
		return;
	}
	
	if (LWinDown)
	{
		OutputDebugStringA(LPCSTR("timerTick : re-send VK_LWIN down\n"));
		kill_LWin = FALSE;
		LWinDown = FALSE;
		SendKey(VK_LWIN);
		return;
	}
	if (RButtonDown)
	{
		OutputDebugStringA(LPCSTR("timerTick : re-send WM_RBUTTONDOWN \n"));
		RButtonDown = FALSE;
		SendMouseClick(MOUSEEVENTF_RIGHTDOWN, 0, 0, NULL, NULL);
		return;
	}
}
CString CUtils::MakePath(CString Path)
{
	char drive[_MAX_DRIVE+1];
	char path[_MAX_PATH+1];
	int i;
	CString result;

	if(Path[Path.GetLength()-1] != '\\')
	{
		_splitpath(LPCSTR(Path), drive, path, NULL, NULL);
		Path = CString(drive) + CString(path);
	}
	if(Path[Path.GetLength()-1] != '\\') Path += '\\';


	for(i = 0; i<Path.GetLength(); i++)
		if(Path[i] == '/') Path.SetAt(i, '\\');

	for(i = 0; i<Path.GetLength(); i++)
		if(i == 0 || Path[i] != '\\' || (Path[i] == '\\' && Path[i-1] != '\\')){
			result += Path[i];
			if(Path[i] == '\\'){
				CreateDirectory(LPCSTR(result), NULL);
				DWORD attr = GetFileAttributes(LPCSTR(result));
				if(attr == 0xFFFFFFFF || (attr & FILE_ATTRIBUTE_DIRECTORY) == 0) return "";
			}

		}

		return result;
}
示例#10
0
void CUCPDetail::OnUcpdApply()
{
CString	tempstr;

	m_ucpd_broker.GetWindowText(m_ucinfo->m_broker);
	if (m_ucpd_service.GetCheck() == 0) {
		m_ucinfo->m_service = false;
	} else {
		m_ucinfo->m_service = true;
	}
	m_ucinfo->m_appl_server = m_ucpd_appl_server.GetCurSel();
	m_ucpd_broker_port.GetWindowText(m_ucinfo->m_broker_port);
	m_ucpd_appl_server_shm_id.GetWindowText(m_ucinfo->m_appl_server_shm_id);
	if (m_ucpd_auto_add_appl_server.GetCheck() == 0) {
		m_ucinfo->m_auto_add_appl_server = false;
	} else {
		m_ucinfo->m_auto_add_appl_server = true;
	}
	m_ucpd_min_num_appl_server.GetWindowText(tempstr);
	m_ucinfo->m_min_num_appl_server = atoi(LPCSTR(tempstr));
	m_ucpd_max_num_appl_server.GetWindowText(tempstr);
	m_ucinfo->m_max_num_appl_server = atoi(LPCSTR(tempstr));
	m_ucpd_appl_server_max_size.GetWindowText(tempstr);
	m_ucinfo->m_appl_server_max_size = atoi(LPCSTR(tempstr));

	CheckFile(m_ucpd_log_dir, false);
	m_ucpd_log_dir.GetWindowText(m_ucinfo->m_log_dir);
	if (m_ucpd_log_backup.GetCheck() == 0) {
		m_ucinfo->m_log_backup = false;
	} else {
		m_ucinfo->m_log_backup = true;
	}
	if (m_ucpd_sql_log.GetCheck() == 0) {
		m_ucinfo->m_sql_log = false;
	} else {
		m_ucinfo->m_sql_log = true;
	}
	if (m_ucpd_access_log.GetCheck() == 0) {
		m_ucinfo->m_access_log = false;
	} else {
		m_ucinfo->m_access_log = true;
	}

	if (m_ucpd_security.GetCheck() == 0) {
		m_ucinfo->m_security = false;
	} else {
		m_ucinfo->m_security = true;
	}
	CheckFile(m_ucpd_access_list);
	m_ucpd_access_list.GetWindowText(m_ucinfo->m_access_list);

	CheckFile(m_ucpd_source_env);
	m_ucpd_source_env.GetWindowText(m_ucinfo->m_source_env);
	m_ucpd_time_to_kill.GetWindowText(m_ucinfo->m_time_to_kill);
	m_ucpd_session_timeout.GetWindowText(m_ucinfo->m_session_timeout);
	m_ucpd_job_queue_size.GetWindowText(m_ucinfo->m_job_queue_size);

	CDialog::OnOK();
}
示例#11
0
////////////////////////////////////////////////////////////////////////////////
// Saves the file strFilePath after getting it from the ars server
CFieldValuePair::DumpAttachment(CARSConnection &arsConnect, CString Form, 
								CEntryId EntryId, ARInternalId arsFieldId,
								CString strFilePath)
{
	ARNameType arsFormName; // working variable
	AREntryIdList arsEntryId; // working variable
	ARLocStruct arsLocStruct; // working variable
	ARStatusList arsStatusList; // working variable

	// Build ARNameType formName
	strcpy( (char*)arsFormName, LPCSTR(Form.Left(sizeof(ARNameType))) ); // copy form name, truncating if necessary
	if(Form.GetLength() > sizeof(ARNameType))
	{
		// Output truncation to log file
		CString strLog("CFieldValuePair::DumpAttachment()");
		strLog += "\tForm name truncated due because size exceeded limits.  Original name: ";
		strLog += Form;
		strLog += INDENT;
		strLog += "Truncated name: ";
		strLog += (char*)arsFormName;
//		Log(strLog);
	}
	// Build AREntryIdList entryId. Will be entry id to get blob for
	if(!FillEntryId(EntryId, &arsEntryId))
	{
		// output to error log here
		CString strLog;
		strLog = "\tAttachment \"";
		strLog += strFilePath;
		strLog += "\" not saved because FillEntryId() failed.\t";
		strLog += "CFieldValuePair::DumpAttachment()";
		Log(strLog);
		ThrowARSException(LPCSTR(strLog), "CFieldValuePair::DumpAttachment()");
	}

	// Build ARLocStruct. Will hold the filename to save the attachment to.
	if(!FillARLocStruct(strFilePath, arsLocStruct))
	{
		// output to error log here
		CString strLog;
		strLog = "\tAttachment \"";
		strLog += strFilePath;
		strLog += "\" not saved because FillARLocStruct() failed.\t";
		strLog += "CFieldValuePair::DumpAttachment()";
		Log(strLog);
		ThrowARSException(LPCSTR(strLog), "CFieldValuePair::DumpAttachment()");
	}

	// Call ARGetEntryBLOB to dump the attachment
	if(ARGetEntryBLOB(&arsConnect.LoginInfo, arsFormName, &arsEntryId,
					  arsFieldId, &arsLocStruct, &arsStatusList) > AR_RETURN_OK)
	{
		ThrowARSException(arsStatusList, "CFieldValuePair::DumpAttachment");
	}

	// Free up heap memory
	FreeAREntryIdList(&arsEntryId, FALSE);
	FreeARLocStruct(&arsLocStruct, FALSE);
}
void CSpritePage::OnAddFrame() 
{
	CString ret = "";
	CBGame* Game = m_View->m_Sprite->Game;

	CString InitFile="";
	if(m_View->m_SelectedSubframe) InitFile = m_View->m_SelectedSubframe->m_Surface->m_Filename;

	// make absolute path
	Game->m_FileManager->RestoreCurrentDir();
	for(int i=0; i<Game->m_FileManager->m_SinglePaths.GetSize(); i++){
		CString NewPath = CString(Game->m_FileManager->m_SinglePaths[i]) + InitFile;
		CFileFind finder;
		if(finder.FindFile(NewPath)){
			InitFile = NewPath;
			break;
		}
	}

	CString Filter = "Image files (*.bmp; *.tga; *.png; *.jpg)|*.bmp;*.tga;*.png;*.jpg|All Files (*.*)|*.*||";
	CFileDialog dlg(TRUE, NULL, InitFile, OFN_ALLOWMULTISELECT|OFN_HIDEREADONLY|OFN_ENABLESIZING|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST|OFN_NOCHANGEDIR, Filter, this);
	char NameBuffer[32768+1] = "";
	dlg.m_ofn.lpstrFile = NameBuffer;
	dlg.m_ofn.nMaxFile = 32768;
	if(InitFile=="") InitFile = CString(Game->m_FileManager->m_BasePath);
	dlg.m_ofn.lpstrInitialDir = LPCSTR(InitFile);
	
	if(dlg.DoModal()==IDOK){
		m_View->SetUndoState("Add frame(s)");
		POSITION pos = dlg.GetStartPosition();
		while(pos){
			CString filename = dlg.GetNextPathName(pos);
			char* str = new char[filename.GetLength()+1];
			strcpy(str, LPCSTR(filename));
			Game->m_FileManager->MakeRelativePath(str);

			CBSurface* surf = Game->m_SurfaceStorage->AddSurface(str);
			if(surf){
				CBFrame* frame = ::new CBFrame(Game);
				CBSubFrame* subframe = ::new CBSubFrame(Game);
				subframe->m_Surface = surf;
				subframe->SetDefaultRect();
				frame->m_Subframes.Add(subframe);

				int i = m_View->m_Sprite->m_CurrentFrame+1;
				if(i<m_View->m_Sprite->m_Frames.GetSize())
					m_View->m_Sprite->m_Frames.InsertAt(i, frame);
				else{
					m_View->m_Sprite->m_Frames.Add(frame);					
				}
				m_View->m_Sprite->m_CurrentFrame=i;
				m_View->m_SelectedSubframe = subframe;
			}
			else MessageBox("Error loading image \"" + filename + "\".", NULL, MB_OK|MB_ICONERROR);
			delete [] str;
		}
		Redraw();
	}
}
示例#13
0
//--------------------------------------------------------------------------------------
// Создание буфера вершин, шейдеров (shaders) и описания формата вершин (input layout)
//--------------------------------------------------------------------------------------
HRESULT LoadShaders()
{
  HRESULT hr = S_OK;

  // Компиляция вершинного шейдера из файла
  ID3DBlob* pVSBlob = NULL; // Вспомогательный объект
  hr = CompileShaderFromFile(LPCSTR("shaders.fx"), "VS", "vs_4_0", &pVSBlob);
  if (FAILED(hr))
  {
    MessageBox(NULL, LPCSTR("Невозможно скомпилировать файл FX. Пожалуйста, запустите данную программу из папки, содержащей файл FX."), LPCSTR("Ошибка"), MB_OK);
    return hr;
  }

  // Создание вершинного шейдера
  hr = g_pd3dDevice->CreateVertexShader(pVSBlob->GetBufferPointer(), pVSBlob->GetBufferSize(), NULL, &g_pVertexShader);
  if (FAILED(hr))
  {  
    pVSBlob->Release();
    return hr;
  }

  // Определение шаблона вершин
  D3D11_INPUT_ELEMENT_DESC layout[] =
  {
    { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
    { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 },
  };
  UINT numElements = ARRAYSIZE(layout);

  // Создание шаблона вершин
  hr = g_pd3dDevice->CreateInputLayout(layout, numElements, pVSBlob->GetBufferPointer(),
                                       pVSBlob->GetBufferSize(), &g_pVertexLayout);
  pVSBlob->Release();
  if (FAILED(hr))
    return hr;

  // Подключение шаблона вершин
  g_pImmediateContext->IASetInputLayout(g_pVertexLayout);

  // Компиляция пиксельного шейдера из файла
  ID3DBlob* pPSBlob = NULL;
  hr = CompileShaderFromFile(LPCSTR("shaders.fx"), "PS", "ps_4_0", &pPSBlob);

  if(FAILED(hr))
  {
    MessageBox(NULL, LPCSTR("Невозможно скомпилировать файл FX. Пожалуйста, запустите данную программу из папки, содержащей файл FX."), LPCSTR("Ошибка"), MB_OK);
    return hr;
  }

  // Создание пиксельного шейдера
  hr = g_pd3dDevice->CreatePixelShader(pPSBlob->GetBufferPointer(), pPSBlob->GetBufferSize(), NULL, &g_pPixelShader);
  pPSBlob->Release();

  if (FAILED(hr))
    return hr;

  return hr;
}
bool CFilterScript::Initialize(CPackageBuilder::TPackage* Package)
{
	m_Document->PrioritizePackage(Package->Name);
	m_Game->m_Registry->SetIniName((char*)LPCSTR(m_Document->GetPathName()));
	m_Game->m_FileManager->SetBasePath((char*)LPCSTR(m_Document->m_ProjectRoot));
	m_Game->m_ScEngine->EmptyScriptCache();

	return true;
}
示例#15
0
BOOL
CPublishPrefs::ApplyChanges()
{
    PREF_SetBoolPref("editor.publish_keep_links",(XP_Bool)m_bAutoAdjustLinks);
    PREF_SetBoolPref("editor.publish_keep_images",(XP_Bool)m_bKeepImagesWithDoc);
    PREF_SetCharPref("editor.publish_location",LPCSTR(m_strPublishLocation));
	PREF_SetCharPref("editor.publish_browse_location",LPCSTR(m_strBrowseLocation));
	return TRUE;
}
示例#16
0
//
// CStringA转CStringW  Unicode环境下
//
CStringW CDesktopDlg::CStrA2CStrW(const CStringA &cstrSrcA)
{
	int len = MultiByteToWideChar(CP_ACP, 0, LPCSTR(cstrSrcA), -1, NULL, 0);
	wchar_t *wstr = new wchar_t[len];
	memset(wstr, 0, len*sizeof(wchar_t));
	MultiByteToWideChar(CP_ACP, 0, LPCSTR(cstrSrcA), -1, wstr, len);
	CStringW cstrDestW = wstr;
	delete[] wstr;
	return cstrDestW;
}
示例#17
0
void CSysConfig::OnBnClickedOk()
{
	// TODO: 在此添加控件通知处理程序代码
	UpdateData(TRUE);


//	FilePath=".\\config\\config.ini";

	CString strSection = _T("PathofDatabase");
	CString strSectionKey  = _T("DataFile");
	CString strValue  = _T("");
	GetDlgItemText(IDC_EDIT_FILEPATH,strValue);
    WritePrivateProfileString(LPCSTR(strSection),LPCSTR(strSectionKey),LPCSTR(strValue), FilePath);

	strSectionKey = _T("Password");
	strValue  = _T("");
	GetDlgItemText(IDC_EDIT_DATAPASSWORD, strValue);
	strValue = CCrypt::Encrypt(strValue, 2005);
	WritePrivateProfileString(LPCSTR(strSection),LPCSTR(strSectionKey),LPCSTR(strValue), FilePath);

	if(m_bTip&&!m_bTip2)
		strValue=_T("1");
	else if(!m_bTip&&m_bTip2)
        strValue=_T("2");
	else
		strValue=_T("0");


	strSectionKey = _T("Tips");
	WritePrivateProfileString(LPCSTR(strSection),LPCSTR(strSectionKey),LPCSTR(strValue), FilePath);
//	EndDialog(IDOK); // 关闭对话框
	UpdateData(FALSE);
	OnOK();

}
示例#18
0
bool CEnv::CheckUniCAS()
{
    CString	unicas = GetUniCAS() + "\\";
    CString	tmpStr;

    tmpStr = unicas + DIR_UC_BIN;
    if (_access(LPCSTR(tmpStr), 0)) return false;
    tmpStr = unicas + DIR_UC_CONF;
    if (_access(LPCSTR(tmpStr), 0)) return false;

    return true;
}
LPCSTR Menu::GetNstr(int n){
	int j=0;
	int i;
	tmpstr[0]=0;
	if(!int(items))return LPCSTR(&tmpstr);
	for(i=0;j<n&&items[i]!=0;i++)
	{
		if(items[i]=='|')j++;
	};
	if(j!=n)return LPCSTR(&tmpstr);
	for(int k=0;items[i]!=0&&items[i]!='|';i++,k++)
		tmpstr[k]=items[i];
	tmpstr[k]=0;
	return LPCSTR(&tmpstr);
};
示例#20
0
void CWaitingUserInfo::HandleReply( CHotlineTransaction* pTrans, class CHotlineConnection* pConnection )
	{
	ASSERT_VALID( pTrans );
	ASSERT( pConnection );
	if ( pTrans->GetError( ) )
		{
		CItem* pErrorMessage = pTrans->GetItemByType( HLO_ERRORMSG );
		pConnection->UserInfoReceived( false, m_iUserSocket, NULL, ( pErrorMessage ) ? LPCSTR( pErrorMessage->AsString( ) ) : NULL );
		}
	else
		{
		CItem* pInfo = pTrans->GetItemByType( HLO_MESSAGE );
		pConnection->UserInfoReceived( true, m_iUserSocket, ( pInfo ) ? LPCSTR( pInfo->AsString( ) ) : NULL );
		}
	}
示例#21
0
//***************************************************************
// create ListCtrl-head
int CColorListCtrl::InitCtrl(CStringArray *phead, CByteArray *pProcent)
{
    if ( (!phead)||(!pProcent)) return 1;
	LV_COLUMN lvc;
	int cx=0;
    int count = phead->GetSize(); 
    if (count!=m_columnSize) return 2;
    if (pProcent->GetSize() != count) return 3;
    for (int x=0; x<count; x++) cx+=pProcent->GetAt(x);
    if (cx!=100) return 4;

	CRect rect_listbox;

	lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
	GetWindowRect( rect_listbox );
	cx=int((rect_listbox.right-rect_listbox.left)-20); //some Pixel for Scrollbar

    //set head-columns in ListBox
	lvc.iSubItem = 0;
	lvc.fmt = LVCFMT_LEFT ;		
	
    for (x=0; x<count; x++)
    {
        lvc.cx = int(cx*pProcent->GetAt(x)/100);
	    lvc.pszText = (char*)LPCSTR(phead->GetAt(x));
	    CListCtrl::InsertColumn(x,&lvc);
    }
    return 0;
}
示例#22
0
bool PluginInfo::loadLibrary(PluginRegistry* p)
{
	if(!loaded)
	{
		QString filename(dll_filename.c_str());
		hinst=LoadLibrary(filename.toStdWString().c_str());
		if(!hinst)
		{
			wprintf(TEXT("Failure in LoadLibrary(%s: error code %i): check for missing dependencies\n"),filename.toStdWString().c_str(),GetLastError()); 
		}
		else
		{
			PLUGIN_DLL_FUNC registerPlugin = (PLUGIN_DLL_FUNC)GetProcAddress(hinst, LPCSTR("RegisterNervePlugin"));
			if(registerPlugin)
			{
				factoryMap.clear();
			    registerPlugin(p);
				loaded=true;
			}
			else
			{
				loaded=false;
				FreeLibrary(hinst);
			}			
		}
	}
	return hinst!=0;
}
示例#23
0
BOOL
CEditorPrefs::ApplyChanges()
{
    // TODO: Need TrimLeft() and TrimRight() or just Trim() functions for CString
    PREF_SetCharPref("editor.author",LPCSTR(m_strAuthor));
	PREF_SetCharPref("editor.html_editor",LPCSTR(m_strHTML_Editor));
	PREF_SetCharPref("editor.image_editor",LPCSTR(m_strImageEditor));
    
    if ( m_bAutoSave ){
		PREF_SetIntPref("editor.auto_save_delay",m_iAutoSaveMinutes);
    } else {
		PREF_SetIntPref("editor.auto_save_delay",0);
    }
    PREF_SetIntPref("editor.fontsize_mode", (int32)m_iFontSizeMode);
    return TRUE;
}
示例#24
0
/*
bool CORDBList::WriteDBInfo()
{
CDBInfo *db;
CString	element;
int		count;

	if (m_List.IsEmpty()) return false;

	TRY {
		m_File.Open(m_ordblist, CFile::modeWrite);
	} 
	CATCH_ALL(e)
	{
		m_File.Abort();
		return false;
	}
	END_CATCH_ALL

	count = m_List.GetCount();
	for (int i = 0; i < count; i++) {
		db = (CDBInfo *)m_List.GetAt(m_List.FindIndex(i));
		element.Format("%s %s %s %s %s\n", db->m_dbname, db->m_dbpath, db->m_host, db->m_logpath, db->m_permanent ? "1" : "0");
		m_File.WriteString(LPCSTR(element));
	}

	m_File.Close();

	return false;
}
*/
bool CORDBList::WriteDBInfo()
{
CDBInfo *db;
CStdioFile infofile;
CString	element;
CFileException	e;
int		count;

	if (m_List.IsEmpty()) return false;

	if (infofile.Open(m_ordbinfo, CFile::modeCreate | CFile::modeWrite, &e)) {
		count = (int) m_List.GetCount();
		for (int i = 0; i < count; i++) {
			db = (CDBInfo *)m_List.GetAt(m_List.FindIndex(i));
			if (!db->m_permanent) continue;
			element.Format("%s %s\n", db->m_dbname, db->m_permanent ? "1" : "0");
			infofile.WriteString(LPCSTR(element));
		}
		infofile.Close();
	} else {
		return false;
	}

	return true;
}
示例#25
0
void CChunkRenderText::StoreSamples(const std::vector<const CDSample*> &Samples)
{
	// Store DPCM samples in file, assembly format
	CStringA str;
	str.Format("\n; DPCM samples (located at DPCM segment)\n");
	WriteFileString(str, m_pFile);

	if (Samples.size() > 0) {
		str.Format("\n\t.segment \"DPCM\"\n");
		WriteFileString(str, m_pFile);
	}

	unsigned int Address = CCompiler::PAGE_SAMPLES;
	for (size_t i = 0; i < Samples.size(); ++i) {
		const CDSample *pDSample = Samples[i];
		const unsigned int SampleSize = pDSample->GetSize();
		const char *pData = pDSample->GetData();
		
		CStringA label;
		label.Format(CCompiler::LABEL_SAMPLE, i);
		str.Format("%s: ; %s\n", LPCSTR(label), pDSample->GetName());
		StoreByteString(pData, SampleSize, str, DEFAULT_LINE_BREAK);
		Address += SampleSize;

		// Adjust if necessary
		if ((Address & 0x3F) > 0) {
			int PadSize = 0x40 - (Address & 0x3F);
			Address	+= PadSize;
			str.Append("\n\t.align 64\n");
		}

		str.Append("\n");
		WriteFileString(str, m_pFile);
	}
}
CPackagerFilter::TProcessedType CFilterScript::ProcessFile(CString FullFilename, CString Filename, CString OutputPath, CString& NewFilename, BYTE* Buffer, DWORD Size, BYTE** NewBuffer, DWORD* NewSize)
{
	NewFilename = Filename;
	*NewSize = 0;
	*NewBuffer = NULL;

	m_CurrentFile = Filename;
	DWORD CompSize = 0;
	BYTE* CompBuffer = m_Game->m_ScEngine->GetCompiledScript((char*)LPCSTR(Filename), &CompSize, true);
	if(CompBuffer==NULL){
		return CPackagerFilter::PROC_ERROR;
	}
	else{
		/*
		*NewBuffer = new BYTE[CompSize+Size];
		memcpy(*NewBuffer, CompBuffer, CompSize);
		memcpy(*NewBuffer+CompSize, Buffer, Size);

		*NewSize = CompSize + Size;
		*/

		*NewBuffer = new BYTE[CompSize];
		memcpy(*NewBuffer, CompBuffer, CompSize);
		*NewSize = CompSize;

		return CPackagerFilter::PROC_USE_BUFFER;
	}
}
void CSpritePage::OnAddSubframe() 
{
	CBFrame* frame = m_View->m_Sprite->m_Frames[m_View->m_Sprite->m_CurrentFrame];

	CString OrigFile;
	if(m_View->m_SelectedSubframe->m_Surface && m_View->m_SelectedSubframe->m_Surface->m_Filename) OrigFile = CString(m_View->m_SelectedSubframe->m_Surface->m_Filename);
	CString NewFile = GetRelativeFilename(frame->Game, OrigFile, "Image Files (*.bmp; *.tga; *.png; *.jpg)|*.bmp;*.tga;*.png;*.jpg", ((CSpriteEditApp*)AfxGetApp())->m_LastDirImage, this);
	if(NewFile!=""){
		m_View->SetUndoState("Add subframe");
		CBSurface* surf = frame->Game->m_SurfaceStorage->AddSurface((char*)LPCSTR(NewFile));
		if(surf){
			int i;
			for(i=0; i<frame->m_Subframes.GetSize(); i++){
				if(frame->m_Subframes[i]==m_View->m_SelectedSubframe) break;
			}
			i++;

			CBSubFrame* subframe = ::new CBSubFrame(frame->Game);
			subframe->m_Surface = surf;
			subframe->SetDefaultRect();

			if(i<frame->m_Subframes.GetSize())
				frame->m_Subframes.InsertAt(i, subframe);
			else
				frame->m_Subframes.Add(subframe);

			frame->m_EditorExpanded = true;
			m_View->m_SelectedSubframe = subframe;

			Redraw();
		}
		else MessageBox("Error loading image \"" + NewFile + "\".", NULL, MB_OK|MB_ICONERROR);		
	}
}
示例#28
0
BOOL KGameserverEyes::ExecuteMappedGMCmd(e2l_gmmapcmd* pCmd)
{
	QCONFIRM_RET_FALSE(pCmd);
	INT nSession = pCmd->nSession;
	BYTE byAsker = pCmd->byAsker;
	LPCSTR pszKey = pCmd->szCmdKey;
	LPCSTR pszData = LPCSTR(pCmd + 1);

	ScriptSafe rScript = g_cScriptManager.GetSafeScript();

	rScript->CallTableFunction("GM", "DoMappedCmdKingEye", 2, "sdds", pszKey, nSession, byAsker, pszData);

	INT nRet = rScript->GetInt(-2);
	LPCSTR pszResult = rScript->GetStr(-1);
	if (nRet != 1)
	{
		PostGmResult(pCmd->nSession,
			static_cast<BYTE>(emKGMCMD_RESULT_WRONGCMD),
			1,
			pCmd->byAsker,
			pszResult ? pszResult : "");
		return FALSE;
	}
	return TRUE;
}
示例#29
0
void gen(HWND hw)
{
	int		j;
	char	ser[128];
	__int64	d=(__int64)rand()*(__int64)rand()*(__int64)rand()*(__int64)rand()*(__int64)rand();
	sprintf(ser, "0x%16I64x", d);
	for(j=0; j<18; j++)
		if(ser[j]==' ')
			ser[j]='0';
	SetDlgItemText(hw, IDR_DISP, ser);
	if(OpenClipboard(NULL))
	{
		HGLOBAL	clipbuffer;
		char	*buffer;
		EmptyClipboard();
		clipbuffer=GlobalAlloc(GMEM_DDESHARE, strlen(ser)+1);
		if(clipbuffer)
		{
			buffer=(char*)GlobalLock(clipbuffer);
			if(buffer)
			{
				strcpy(buffer, LPCSTR(ser));
				GlobalUnlock(clipbuffer);
				SetClipboardData(CF_TEXT, clipbuffer);
			}
		}
		CloseClipboard();
	}
	
}
示例#30
0
void CCmgTextArea::DrawText(CDC* pDC,CPoint DrawPoint)
{
    CFont aaa;
    CFont* OldFont;
    BOOL ret;


    switch (m_nTextFont)
    {
    case TEXTFONT_WIN_LOOSE:
        ret=aaa.CreateFont(20,10,0,0,FW_BOLD,0,0,0,ANSI_CHARSET,OUT_CHARACTER_PRECIS,
                           CLIP_DEFAULT_PRECIS,PROOF_QUALITY,FIXED_PITCH,CString("Courier New"));
        break;
    case TEXTFONT_FIELD:
        ret=aaa.CreateFont(12,0,0,0,FW_REGULAR,0,0,0,ANSI_CHARSET,OUT_CHARACTER_PRECIS,
                           CLIP_DEFAULT_PRECIS,PROOF_QUALITY,FIXED_PITCH,CString("Verdana"));
        break;

    case TEXTFONT_FIELD_B:
        ret=aaa.CreateFont(12,0,0,0,FW_BOLD,0,0,0,ANSI_CHARSET,OUT_CHARACTER_PRECIS,
                           CLIP_DEFAULT_PRECIS,PROOF_QUALITY,FIXED_PITCH,CString("Verdana"));
        break;

    case TEXTFONT_SCORE:
        ret=aaa.CreateFont(14,0,0,0,FW_REGULAR,0,0,0,ANSI_CHARSET,OUT_CHARACTER_PRECIS,
                           CLIP_DEFAULT_PRECIS,PROOF_QUALITY,FIXED_PITCH,CString("Courier New"));
        break;

    case TEXTFONT_SCORE_B:
        ret=aaa.CreateFont(14,0,0,0,FW_BOLD,0,0,0,ANSI_CHARSET,OUT_CHARACTER_PRECIS,
                           CLIP_DEFAULT_PRECIS,PROOF_QUALITY,FIXED_PITCH,CString("Courier New"));
        break;

    default:
        ASSERT(0);
    }

    if (ret)
        OldFont=pDC->SelectObject(&aaa);

    COLORREF OldTextColor=pDC->SetTextColor(m_nTextColor);
    COLORREF OldBkColor=pDC->SetBkColor(m_nBkColor);

    pDC->SetBkMode(TRANSPARENT);

    CPoint p1=m_rArea.TopLeft();
    p1.x-=DrawPoint.x;
    p1.y-=DrawPoint.y;
#ifdef WIN32
    pDC->ExtTextOut(p1.x,p1.y,0,m_rArea,m_sText,NULL);
#else
    pDC->ExtTextOut(p1.x,p1.y,0,m_rArea,LPCSTR(m_sText),m_sText.GetLength(),NULL);
#endif

    pDC->SetBkColor(OldBkColor);
    pDC->SetTextColor(OldTextColor);

    if (ret)
        pDC->SelectObject(OldFont);
}