本文整理汇总了C++中LPCSTR函数的典型用法代码示例。如果您正苦于以下问题:C++ LPCSTR函数的具体用法?C++ LPCSTR怎么用?C++ LPCSTR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LPCSTR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitWindow
//--------------------------------------------------------------------------------------
// Регистрация класса и создание окна
//--------------------------------------------------------------------------------------
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: SetSelectTarget
/*
// 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: SetMaxZoom
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: memset
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: Section
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;
}
示例6: MessageBeep
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();
}
示例7: _T
/**
@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: _splitpath
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;
}
示例9: atoi
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();
}
示例10: strcpy
////////////////////////////////////////////////////////////////////////////////
// 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);
}
示例11: CString
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();
}
}
示例12: LoadShaders
//--------------------------------------------------------------------------------------
// Создание буфера вершин, шейдеров (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;
}
示例13: Initialize
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;
}
示例14: PREF_SetBoolPref
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;
}
示例15: MultiByteToWideChar
//
// 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;
}