• theApp. m_AppPath 应用程序当前路径


    void CClientWorkSpaceApp::ConfigGetAppPath()

    {

           TCHAR path[MAX_PATH];

           memset(path,0,sizeof(TCHAR)*MAX_PATH);

           GetModuleFileName( NULL,path, MAX_PATH );

           TCHAR drive[MAX_PATH],dir[MAX_PATH],fname[MAX_PATH],ext[MAX_PATH];

           _tsplitpath(path,drive,dir,fname,ext );

           m_AppPath = drive;

           m_AppPath += dir;

    }

    <Environment.h>

    #pragma once
    class CEnvironment
    {
    public:
    CEnvironment(void);
    ~CEnvironment(void);
    static CString ConfigGetAppDir(void);
    static int Init(void);
    static CString m_AppPath;
    static CString m_AppDriver;
    static CString m_AppDir;
    static CString m_AppFileName;
    static CString m_AppFileExt;
    };

    <Environment.cpp>

    #include "StdAfx.h"
    #include "Environment.h"

    CString CEnvironment::m_AppPath = _T("");
    CString CEnvironment::m_AppDriver = _T("");
    CString CEnvironment::m_AppDir = _T("");
    CString CEnvironment::m_AppFileName = _T("");
    CString CEnvironment::m_AppFileExt = _T("");

    CEnvironment::CEnvironment(void)
    {
    }


    CEnvironment::~CEnvironment(void)
    {
    }


    int CEnvironment::Init(void)
    {
    if (_T("")!=m_AppDriver)
    return 0;

    TCHAR path[MAX_PATH];
    memset(path,0,sizeof(TCHAR)*MAX_PATH);
    GetModuleFileName( NULL,path, MAX_PATH );

    TCHAR drive[MAX_PATH],dir[MAX_PATH],fname[MAX_PATH],ext[MAX_PATH];
    _tsplitpath(path,drive,dir,fname,ext );

    m_AppDriver = drive;
    m_AppDir = dir;
    m_AppFileName = fname;
    m_AppFileExt = ext;
    //m_AppPath = drive;

    return 1;
    }

    CString CEnvironment::ConfigGetAppDir(void)
    {
    Init();
    return m_AppDriver+m_AppDir;
    //m_AppPath = drive;
    //m_AppPath += dir;
    }

  • 相关阅读:
    解析三种常见分布式锁的实现
    RabbitMQ基础概念详解
    数据库事务概念
    ECIF与CRM
    MQ(消息队列)学习
    数据粒度的设计
    链表之 头节点与尾指针 区别
    牛客之错题(2016.1.15) && 带头节点与不带头的区别
    数据结构之递归回溯算法
    LeetCode--Single Number
  • 原文地址:https://www.cnblogs.com/carl2380/p/1924668.html
Copyright © 2020-2023  润新知