레이블이 visual studio인 게시물을 표시합니다. 모든 게시물 표시
레이블이 visual studio인 게시물을 표시합니다. 모든 게시물 표시

2018년 3월 7일 수요일

compact framework to .net framework project

## delete on compact framework project file
ProjectTypeGuids
ProjectTypeGuids
PlatformFamilyName
PlatformID
OSVersion
DeployDirSuffix
NativePlatformName
NoStdLib
NoConfig
$(PlatformFamilyName)
RequiredTargetFramework

## replace on compact framework project file
$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets
to
$(MSBuildToolsPath)\Microsoft.CSharp.targets

## rebuild for .net framework
...

2018년 2월 1일 목요일

Install Visual Studio 6.0 with Windows 10


  1. Visual Studio 6.0 Enterprise - Custom
  2. Data Acess check box is not selected
  3. Enterprise Tools > Change Option
  4. Visual Studio 6.0 Enterprise - Enterprise Tools > Options
  5. Visual Studio Analyzer check box is not selected

2017년 9월 8일 금요일

how to for Compact framework project build Speed improvement

c:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.CompactFramework.Common.targets

    <Target
        Name="PlatformVerificationTask" Condition="'$(SkipPlatform Verification)' == 'true'">
        <PlatformVerificationTask
            PlatformFamilyName="$(PlatformFamilyName)"
            PlatformID="$(PlatformID)"
            SourceAssembly="@(IntermediateAssembly)"
            ReferencePath="@(ReferencePath)"
            TreatWarningsAsErrors="$(TreatWarningsAsErrors)"
            PlatformVersion="$(TargetFrameworkVersion)"/>
    </Target>

2016년 2월 18일 목요일

CString to wchar_t on MFC

first ansi to uncode

#include <atlbase.h>

...
CString path = m_filename;
pfile = _wfopen(CT2W(path) , L"wb");

2015년 12월 11일 금요일

how to use log4cplus with Visual Studio 2012

download
http://sourceforge.net/projects/log4cplus/

\log4cplus-1.2.0-rc3\msvc10
build with Visual Studo 2012

log4cplus_configure.ini

###################################
########Define log Levels##########
###################################

#All classes - except those in log4cplus.logger.* - use DEBUG level to print information on file
log4cplus.rootLogger=DEBUG, MyFileAppender

#For MemoryCheck class I need to inspect all the details, and I want print information even to the console
log4cplus.logger.MemoryCheck=TRACE, MyConsoleAppender

#For database stuff, I don't need to logging everything, it's enough printing only errors!
log4cplus.logger.DatabaseOperations=ERROR

###################################
########Define the Appenders#######
###################################

#MyConsoleAppender:
log4cplus.appender.MyConsoleAppender=log4cplus::ConsoleAppender
log4cplus.appender.MyConsoleAppender.layout=log4cplus::PatternLayout
log4cplus.appender.MyConsoleAppender.layout.ConversionPattern=[%-5p][%d] %m%n

#MyFileAppender
log4cplus.appender.MyFileAppender=log4cplus::RollingFileAppender
log4cplus.appender.MyFileAppender.File=logging.txt
log4cplus.appender.MyFileAppender.MaxFileSize=16MB
log4cplus.appender.MyFileAppender.MaxBackupIndex=1
log4cplus.appender.MyFileAppender.layout=log4cplus::PatternLayout
log4cplus.appender.MyFileAppender.layout.ConversionPattern=[%-5p][%D{%Y/%m/%d %H:%M:%S:%q}][%-l][%t] %m%n

stdafx.h

#include <log4cplus/logger.h>
#include <log4cplus/loggingmacros.h>
#include <log4cplus/configurator.h>
#include <iomanip>

using namespace log4cplus;

extern Logger g_logger;

stdafx.cpp
#include "stdafx.h"

Logger g_logger;


AppDemoDlg.cpp
BOOL CAppDemoDlg::OnInitDialog()
{
CDialog::OnInitDialog();

        initialize();
PropertyConfigurator::doConfigure("log4cplus_configure.ini");

g_logger = Logger::getInstance(LOG4CPLUS_TEXT("main"));
g_logger.setLogLevel(TRACE_LOG_LEVEL);
LOG4CPLUS_INFO(g_logger, "OnInitDialog");

return TRUE;
}

2015년 11월 19일 목요일

unicode file write

Big-endian : 0xFEFF ( unicode )
Little-endian : 0xFFFE

if (pGSFile == NULL) {
pGSFile = _wfopen(L"ch_gsensor.dat", L"wb");
WORD mark = 0xFEFF;
fwrite(&mark, sizeof(WORD), 1, pGSFile);
}

2015년 11월 18일 수요일

manifest setting with visual studio 2012

c#
project > new item add > app.manifest
edit app.manifest
      <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
        <!-- UAC 매니페스트 옵션
        <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
      </requestedPrivileges>

c++
project > properties > linker > manifest file
UAC Execution Level => "requireAdministrator (/level='requireAdministrator')"

2015년 10월 15일 목요일

SAP Connector with ASP.NET

requirement
NCo3016_Net20_x86.msi
add reference ( C:\Program Files (x86)\SAP\SAP_DotNetConnector3_Net20_x86 )
sapnco.dll, sapnco_utils.dll

source code for c# with asp.net
DataSet ds = new DataSet("T_DATA");
try
{
    RfcDestination rfcDestination = null;
    IDestinationConfiguration destinationConfig = null;
    string destinationName = "SAP.LogonControl.1";

    destinationConfig = new SAPDestinationConfig();
    destinationConfig.GetParameters(destinationName);
    if (RfcDestinationManager.TryGetDestination(destinationName) == null)
    {
        RfcDestinationManager.RegisterDestinationConfiguration(destinationConfig);

        rfcDestination = RfcDestinationManager.GetDestination(destinationName);
        if (rfcDestination != null)
        {
            rfcDestination.Ping();
        }

        RfcRepository rfcRepository = rfcDestination.Repository;
        IRfcFunction rfcFunction = rfcRepository.CreateFunction("Z_XXXXX_ORDER");
        rfcFunction.SetValue("I_AXXXX", sWO);
        rfcFunction.Invoke(rfcDestination);

        ds.Tables.Add(ConvertToDotNetTable(rfcFunction.GetTable("T_DATA")));

        RfcDestinationManager.UnregisterDestinationConfiguration(destinationConfig);
    }
}
catch (Exception ex)
{
    throw new Exception(ex.Message);
}

return ds;

2015년 10월 11일 일요일

mp4 save with ffmpeg

ip cam -> raw data(encoded) -> mp4 save

  AVCodec *ce;
  AVFormatContext *fc;
  AVOutputFormat *of;
  AVCodecContext *pcc;
  AVStream *pst;
  int vi;
  AVPacket pkt;

BOOL CCodec_Encoder_h264::FileInit(char *fname, int nWidth, int nHeight)
{
av_register_all();
avcodec_register_all();

of = av_guess_format(0, fname, 0);
fc = avformat_alloc_context();
fc->oformat = of;
strcpy(fc->filename, fname);

pst = avformat_new_stream(fc, 0);
vi = pst->index;

ce = avcodec_find_decoder(CODEC_ID_H264);

pcc = pst->codec;
avcodec_get_context_defaults3(pcc, ce);
pcc->codec_type = AVMEDIA_TYPE_VIDEO;
pcc->codec_id = CODEC_ID_H264;
pcc->profile= FF_PROFILE_H264_BASELINE;
pcc->bit_rate = 1280 * 960 * 2;
pcc->width = nWidth;
pcc->height = nHeight;
pcc->time_base.num = 1;
pcc->time_base.den = 30;
pcc->qcompress = 0.6;
pcc->qmin = 0;
pcc->qmax = 9;
pcc->pix_fmt = PIX_FMT_YUV420P;
pcc->gop_size = 150;

if ( !( fc->oformat->flags & AVFMT_NOFILE ) )
avio_open( &fc->pb, fc->filename, AVIO_FLAG_WRITE );

avformat_write_header(fc, NULL);

m_nFrmCnt = 0;

waitkey = 1;

return TRUE;
}

BOOL CCodec_Encoder_h264::FileAppend(BYTE *pData, int nSize, , DWORD key)
{
  AVPacket pkt;
  av_init_packet(&pkt);
  //pkt.flags |= (0 >= getVopType(pData, nSize )) ? AV_PKT_FLAG_KEY : 0;  
  pkt.flags |= key;
  //pkt.stream_index = m_nFrmCnt++;
  pkt.data = (uint8_t*)pData;
  pkt.size = nSize;

if ( waitkey )
if ( 0 == ( pkt.flags & AV_PKT_FLAG_KEY ) )
return TRUE;
else
waitkey = 0;

av_write_frame(fc, &pkt);

return TRUE;
}

BOOL CCodec_Encoder_h264::FileClose()
{
av_write_trailer(fc);

if ( fc->oformat && !( fc->oformat->flags & AVFMT_NOFILE ) && fc->pb )
        avio_close( fc->pb );

av_free(fc);

return TRUE;
}

c# Struct Marshal for c++ dll

c++

typedef struct
{
HANDLE aaa;
HWND bbb;
BYTE ccc[2500];

} SStruct, LPSCStruct;


BOOL __stdcall func1(LPSCStruct zzz);



c#
public struct LPSCStruct
{
    public int aaa;
    public IntPtr bbb;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2500)]
    public byte[] ccc;
}


public partial class Form1 : Form /*, IMessageFilter*/
{      
    [DllImport("test.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Auto, SetLastError = true)]
    [return: MarshalAs(UnmanagedType.I1)]
    unsafe extern public static bool func1(IntPtr zzz);
   
    public LPSCStruct sss;
    public LPSCStruct rrr;
    public IntPtr m_lpstruct;
   
    private void Form1_Load(object sender, EventArgs e)
    {
        sss = new LPSCStruct();
    }  
   
    private IntPtr MarshalToPointer(object data)
    {
        IntPtr buf = Marshal.AllocHGlobal(Marshal.SizeOf(pse));
        Marshal.StructureToPtr(data, buf, false);
        return buf;
    }

    private object MarshalToStruct(IntPtr buf, Type t)
    {
        return Marshal.PtrToStructure(buf, t);
    }  
   
    private void button1_Click(object sender, EventArgs e)
    {
        sss.bbb = FindWindow(null, "Form1");

        m_lpstruct = MarshalToPointer(sss);

        bool bRtn = func1(m_lpstruct);
        if (bRtn)
        {
            rrr = (LPSCStruct)MarshalToStruct(m_lpstruct, typeof(LPSCStruct));

            textBox1.AppendText(Encoding.Default.GetString(rrr.ccc));
        }          
    }

2015년 9월 21일 월요일

using the windows headers

https://msdn.microsoft.com/ko-kr/library/aa383745.aspx


Minimum system required Minimum value for _WIN32_WINNT and WINVER
Windows 8.1 _WIN32_WINNT_WINBLUE (0x0602)
Windows 8 _WIN32_WINNT_WIN8 (0x0602)
Windows 7 _WIN32_WINNT_WIN7 (0x0601)
Windows Server 2008 _WIN32_WINNT_WS08 (0x0600)
Windows Vista _WIN32_WINNT_VISTA (0x0600)
Windows Server 2003 with SP1, Windows XP with SP2 _WIN32_WINNT_WS03 (0x0502)
Windows Server 2003, Windows XP _WIN32_WINNT_WINXP (0x0501)

2015년 8월 5일 수요일

git use for visual studio 2012

requirement

1. Visual Studio Update 4 ( http://www.microsoft.com/en-us/download/details.aspx?id=39305 )
2. TortoiseGit ( https://code.google.com/p/tortoisegit/ )
3. Git Source Control Provider ( https://gitscc.codeplex.com/ )
4. git for windows ( https://msysgit.github.io/ )

2015년 6월 26일 금요일

LNK2029 모듈이 SAFESEH 이미지에 대해 안전하지 않습니다

os : window7 64
tool : visual studio 2012

속성 - 구성 속성 - 링커 - 고급 - 이미지에 안전한 예외 처리기 포함 : 아니요 (/SAFESEH:NO)

2015년 5월 16일 토요일

version of visual studio

브랜드 버전                  내부 버전          #define _MSC_VER 버전
Visual C++ 2005            VC8                 1400
Visual C++ 2008            VC9                 1500
Visual C++ 2010            VC10                1600
Visual C++ 2012            VC11                1700