Below and the attached are my code and files.
/*********************************************************************
* Name: main.h
* Purpose: Declares simple wxWidgets application with GUI
* created using wxFormBuilder.
* Author:
* Created:
* Copyright:
* License: wxWidgets license (www.wxwidgets.org)
*
* Notes: Note that all GUI creation code is declared in
* gui.h source file which is generated by wxFormBuilder.
*********************************************************************/
#ifndef __main__
#define __main__
// main wxWidgets header file
#include <wx/wx.h>
#include <wx/textfile.h>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <windows.h>
#include <c++/bits/stringfwd.h>
#include "code_trans.h"
// gui classes generated by wxFormBuilder
#include "gui.h"
////////////////////////////////////////////////////////////////////////////////
// application class declaration
////////////////////////////////////////////////////////////////////////////////
class MainApp : public wxApp
{
public:
virtual bool OnInit();
};
// declare global static function wxGetApp()
DECLARE_APP(MainApp)
////////////////////////////////////////////////////////////////////////////////
// main application frame declaration
////////////////////////////////////////////////////////////////////////////////
class MainFrame : public MainFrameBase
{
public:
MainFrame( wxWindow *parent );
virtual ~MainFrame();
protected:
// protected event handlers
char str[255];
int ifiletype;
wxTextFile infile, outfile;
// string cfilter;
virtual void OnCloseFrame( wxCloseEvent& event );
virtual void OnExitClick( wxCommandEvent& event );
void OnStart( wxCommandEvent& event );
void OnTextCtrlFocus(wxFocusEvent & event);
void processfile();
// void processLine(wxString& str);
void processLine(char* str);
};
#endif //__main__
/*********************************************************************
* Name: main.cpp
* Purpose: Implements simple wxWidgets application with GUI
* created using wxFormBuilder.
* Author:
* Created:
* Copyright:
* License: wxWidgets license (www.wxwidgets.org)
*
* Notes: Note that all GUI creation code is implemented in
* gui.cpp source file which is generated by wxFormBuilder.
*********************************************************************/
#include "main.h"
#include "code_trans.h"
#include "HandleConfig.h"
#include <wx/msgdlg.h>
#include <wx/string.h>
#include <wx/textfile.h>
#include <wx/config.h>
using namespace Code_Trans;
char cfilter[20]= {0};
wxConfig *config = new wxConfig("MyAppName");
// initialize the application
IMPLEMENT_APP(MainApp);
////////////////////////////////////////////////////////////////////////////////
// application class implementation
////////////////////////////////////////////////////////////////////////////////
bool MainApp::OnInit()
{
SetTopWindow( new MainFrame( NULL ) );
GetTopWindow()->Show();
// (MainFrame *)GetTopWindow().m_filter->SetValue("健康");
// true = enter the main loop
return true;
}
////////////////////////////////////////////////////////////////////////////////
// main application frame implementation
////////////////////////////////////////////////////////////////////////////////
MainFrame::MainFrame(wxWindow *parent) : MainFrameBase( parent )
{
wxString str;
if ( config->Read("inputfile", &str) )
// m_fileopen->SetTextCtrlValue(str);
m_fileopen->SetPath(str);
if ( config->Read("outputfile", &str) )
m_filesave->SetPath(str);
if ( config->Read("filter", &str) )
m_filter->SetValue(str);
if ( config->Read("filetype", &ifiletype) )
m_filetype->SetSelection(ifiletype);
}
MainFrame::~MainFrame()
{
}
void MainFrame::OnCloseFrame(wxCloseEvent& event)
{
config->Write("inputfile", m_fileopen->GetTextCtrlValue());
config->Write("outputfile", m_filesave->GetTextCtrlValue());
config->Write("filter", m_filter->GetValue());
config->Write("filetype", m_filetype->GetSelection());
// the changes will be written back automatically
delete config;
Destroy();
}
void MainFrame::OnExitClick(wxCommandEvent& event)
{
Destroy();
}
void MainFrame::OnStart( wxCommandEvent& event )
{
// wxString
// if ( m_fileopen->GetPath().IsEmpty() ){
// m_filter->SetValue(wxT("健康"));
// m_filter->SetValue("健康");
// wxMessageBox( m_filter->GetValue() );
// wxMessageBox( wxString::Format("%i",m_filter->GetValue().Len()) );
// wxString s1=wxT("健康小管家");
// wxString s2=wxT("健康");
//if (s1.Find(s2)!=wxNOT_FOUND) wxMessageBox( wxT("found!") );
// wxMessageBox( Unicode2ANSI(m_filter->GetValue().wc_str() ));
// wchar_t wText[10] = {L"健康"};
// char sText[20]= {0};
// WCharToMByte(wText,sText,sizeof(sText)/sizeof(sText[0]));
// wxMessageBox(sText);
// wxMessageBox(wText);
// MByteToWChar(sText,wText,sizeof(wText)/sizeof(wText[0]));
if ( m_fileopen->GetTextCtrlValue().IsEmpty() ){
wxMessageBox( wxT("please select input file!") );
m_fileopen->SetFocus();
return;
}
if ( m_filesave->GetTextCtrlValue().IsEmpty() ){
wxMessageBox( wxT("please select a output file!") );
m_filesave->SetFocus();
return;
}
if (m_filetype->GetSelection()==1 || m_filetype->GetSelection()==2) { // if "web or wap" then check the filter
if ( m_filter->GetValue().IsEmpty() ){
wxMessageBox( wxT("please set the filter!") );
m_filter->SetFocus();
return;
}
}
processfile();
// TODO: Implement OnStart
}
void MainFrame::processfile( )
{
// open the files
infile.Open(m_fileopen->GetTextCtrlValue());
outfile.Create(m_filesave->GetTextCtrlValue());
// read the first line and skip
infile.GetFirstLine();
// wxMessageBox( infile.GetFirstLine());
// outfile.AddLine("dd");
outfile.AddLine(wxT("号码"));
ifiletype = m_filetype->GetSelection();
// if (ifiletype==1 || ifiletype==2) cfilter = Unicode2ANSI(m_filter->GetValue().wc_str());
if (ifiletype==1 || ifiletype==2)
WCharToMByte(m_filter->GetValue().wc_str(),cfilter,sizeof(cfilter)/sizeof(cfilter[0]));
// wxMessageBox( cfilter );
while(!infile.Eof())
{
// if (ifiletype==1 || ifiletype==2) {
// str = wxString::Format(wxT("%s"),infile.GetNextLine().wc_str());
// str = wxString::From8BitData(infile.GetNextLine());
// str = infile.GetNextLine();
// wxMessageBox( str );
// }
// else
// str = infile.GetNextLine();
// const wchar_t * str1 = infile.GetNextLine().wc_str();
// char str2[255]= {0};
wchar2char(str, infile.GetNextLine().wc_str());
// WCharToMByte(str1,str2,sizeof(str2)/sizeof(str2[0]));
// wxMessageBox( str1 );
// mystrcpy(str,str1.c_str());
processLine(str); // placeholder, do whatever you want with the string
}
wxMessageBox( wxT("done!") );
infile.Close();
outfile.Write();
//Save your changes: notice that the changes you make to the file will not be saved automatically; calling wxTextFile::Close or doing nothing discards them! To save the changes you must explicitly call wxTextFile::Write - here, you may also change the line termination type if you wish.
outfile.Close();
}
//void MainFrame::processLine( wxString& str )
void MainFrame::processLine( char* str )
{
// m_status->SetLabel(str.substr(0, 10));
// m_status->SetLabel(str);
m_status->SetLabel( wxString::Format("reading line %i: %s",infile.GetCurrentLine(), str));
if (ifiletype == 0){ //88da 88zs
if (strlen(str)>11) outfile.AddLine(wxString(str).SubString(0, 10));
return;
}
if (ifiletype == 1){ //web
if (strlen(str)>11)
if (strstr( str, cfilter )>=0) outfile.AddLine(wxString(str).SubString(27, 37));
// if (str.Find(wxString::Format("%s",))!=wxNOT_FOUND) outfile.AddLine(str.SubString(27, 37));
return;
}
if (ifiletype == 2){ // wap
if (strlen(str)>11)
if (strstr( str, cfilter )>=0) outfile.AddLine(wxString(str).SubString(0, 10));
return;
}
}
// select all text when TextCtrl get focus
//code from http://forums.wxwidgets.org/viewtopic.php?t=35698&p=146053
void MainFrame::OnTextCtrlFocus(wxFocusEvent & event)
{
wxTextCtrl *object = (wxTextCtrl*)event.GetEventObject();
object->SetSelection(-1, -1);
event.Skip();
}
/*********************************************************************
* Name: code_trans.cpp
*********************************************************************/
#include "code_trans.h"
#include <windows.h>
//#include <wx/msgdlg.h>
//#include <wx/string.h>
namespace Code_Trans
{
char * wchar2char(char * strDest,const wchar_t * strSrc)
{
char * strDestCopy=strDest; //[3]
if ((strDest==NULL)||(strSrc==NULL)) //[1]
throw "Invalid argument(s)"; //[2]
// int iLen = strlen(strSrc);
while ((*strDest++=(char)*strSrc++)!='\0'); //[4]
return strDestCopy;
}
//http://baike.baidu.com/view/1026861.htm#3
char * mystrcpy(char * strDest,const char * strSrc)
{
char * strDestCopy=strDest; //[3]
if ((strDest==NULL)||(strSrc==NULL)) //[1]
throw "Invalid argument(s)"; //[2]
int iLen = strlen(strSrc);
while ((*strDest++=*strSrc++)!='\0'); //[4]
return strDestCopy;
}
//http://blog.csdn.net/mobidogs/article/details/3414746
int strstr(char srcstr[],char deststr[] )
{
int j=0;
for (int i=0;srcstr[i]!='\0';i++)
{
if (deststr[0]==srcstr[i])
{
while (deststr[j]!='\0'&&srcstr[i+j]!='\0')
{
j++;
if (deststr[j]!=srcstr[i+j])
{
break;
}
}
}
if (deststr[j]=='\0')
{
return i;
}
}
return -1;
}
//-------------------------------------------------------------------------------------
//Description:http://www.cppblog.com/sunraiing9/archive/2007/03/21/20281.html
// This function maps a character string to a wide-character (Unicode) string
//
//Parameters:
// lpcszStr: [in] Pointer to the character string to be converted
// lpwszStr: [out] Pointer to a buffer that receives the translated string.
// dwSize: [in] Size of the buffer
//
//Return Values:
// TRUE: Succeed
// FALSE: Failed
//
//Example:
// MByteToWChar(szA,szW,sizeof(szW)/sizeof(szW[0]));
//---------------------------------------------------------------------------------------
int MByteToWChar(LPCSTR lpcszStr, LPWSTR lpwszStr, DWORD dwSize)
{
// Get the required size of the buffer that receives the Unicode
// string.
DWORD dwMinSize;
dwMinSize = MultiByteToWideChar (CP_ACP, 0, lpcszStr, -1, NULL, 0);
if(dwSize < dwMinSize)
{
return FALSE;
}
// Convert headers from ASCII to Unicode.
MultiByteToWideChar (CP_ACP, 0, lpcszStr, -1, lpwszStr, dwMinSize);
return TRUE;
}
//-------------------------------------------------------------------------------------
//Description:
// This function maps a wide-character string to a new character string
//
//Parameters:
// lpcwszStr: [in] Pointer to the character string to be converted
// lpszStr: [out] Pointer to a buffer that receives the translated string.
// dwSize: [in] Size of the buffer
//
//Return Values:
// TRUE: Succeed
// FALSE: Failed
//
//Example:
// MByteToWChar(szW,szA,sizeof(szA)/sizeof(szA[0]));
//---------------------------------------------------------------------------------------
int WCharToMByte(LPCWSTR lpcwszStr, LPSTR lpszStr, DWORD dwSize)
{
DWORD dwMinSize;
dwMinSize = WideCharToMultiByte(CP_OEMCP,NULL,lpcwszStr,-1,NULL,0,NULL,FALSE);
if(dwSize < dwMinSize)
{
return FALSE;
}
WideCharToMultiByte(CP_OEMCP,NULL,lpcwszStr,-1,lpszStr,dwSize,NULL,FALSE);
return TRUE;
}
/*************************************************************************
* Name : Unicode2ANSI
* Description: Convert Unicode to ANSI code
* Author : huaijun.yu
* Date : 2010/05/28
************************************************************************/
string Unicode2ANSI(const wchar_t* ptszUnicode)
{
string strRet;
if (NULL == ptszUnicode)
{
return strRet;
}
int iLen = WideCharToMultiByte(CP_ACP, 0, ptszUnicode, -1, NULL, 0, 0,FALSE);
//wxMessageBox( wxString::Format("%i", iLen) );
if (iLen > 0)
{
char* pszBuf = new char[iLen+1];
if (NULL != pszBuf)
{
memset(pszBuf, 0, sizeof(char)*(iLen+1));
if (SUCCEEDED(WideCharToMultiByte(CP_ACP, 0, ptszUnicode, wcslen(ptszUnicode),
pszBuf, iLen+1, 0, FALSE)))
{
strRet = pszBuf;
}
}
delete[] pszBuf;
pszBuf = NULL;
}
return strRet;
}
/*************************************************************************
* Name : Unicode2UTF8
* Description: Convert Unicode to UTF8 code
* Author : huaijun.yu
* Date : 2010/05/27
************************************************************************/
string Unicode2UTF8(const wchar_t* ptszUnicode)
{
if (NULL == ptszUnicode)
{
return NULL;
}
int iSize = WideCharToMultiByte(CP_UTF8, 0, ptszUnicode, -1, NULL, 0, 0, FALSE);
if (iSize <= 0)
{
return NULL;
}
char *pszTemp = new char[iSize+1];
memset(pszTemp, 0, sizeof(char)*(iSize+1));
string strTemp;
if (SUCCEEDED(WideCharToMultiByte(CP_UTF8, 0, ptszUnicode, -1, pszTemp, iSize+1, 0, FALSE)))
{
strTemp = pszTemp;
}
delete[] pszTemp;
pszTemp = NULL;
return strTemp;
}
/*************************************************************************
* Name : ANSI2Unicode
* Description: Convert ANSI code to Unicode
* Author : huaijun.yu
* Date : 2010/05/27
************************************************************************/
wstring ANSI2Unicode(const char* pszAnsi)
{
if (NULL == pszAnsi)
{
return NULL;
}
const int iLen = MultiByteToWideChar(CP_OEMCP, 0, pszAnsi, -1, 0, 0);
wchar_t *ptszTemp = new wchar_t[iLen+1];
memset(ptszTemp, 0, sizeof(wchar_t)*(iLen+1));
if (NULL == ptszTemp)
{
return NULL;
}
//convert
wstring wstrTemp;
if (SUCCEEDED(MultiByteToWideChar(CP_OEMCP, NULL, pszAnsi, strlen(pszAnsi), ptszTemp, iLen+1)))
{
wstrTemp = ptszTemp;
}
//free memory
delete[] ptszTemp;
ptszTemp = NULL;
return wstrTemp;
}
/*************************************************************************
* Name : ANSI2UTF8
* Description: Convert ANSI code to UTF8 code
* Author : huaijun.yu
* Date : 2010/05/28
************************************************************************/
string ANSI2UTF8(const char* pszANSI)
{
string strRet;
wstring wstrTemp = ANSI2Unicode(pszANSI);
if (!wstrTemp.empty())
{
strRet = Unicode2UTF8(wstrTemp.c_str());
}
return strRet;
}
/*************************************************************************
* Name : UTF82ANSI
* Description: Convert UTF8 code to ANSI code
* Author : huaijun.yu
* Date : 2010/05/28
************************************************************************/
string UTF82ANSI(const char* pszUTF)
{
string strRet;
wstring wstrTemp = UTF82Unicode(pszUTF);
if (!wstrTemp.empty())
{
strRet = Unicode2ANSI(wstrTemp.c_str());
}
return strRet;
}
/*************************************************************************
* Name : UTF82Unicode
* Description: Covert UTF8 code to Unicode
* Author : huaijun.yu
* Date : 2010/05/28
************************************************************************/
wstring UTF82Unicode(const char* pszUTF)
{
wstring wstrRet;
if (NULL == pszUTF)
{
return wstrRet;
}
int iSize = MultiByteToWideChar(CP_UTF8, 0, pszUTF, -1, NULL, 0);
if (iSize <= 0)
{
return wstrRet;
}
wchar_t *ptszTemp = new wchar_t[iSize+1];
memset(ptszTemp, 0, sizeof(wchar_t)*(iSize+1));
if (SUCCEEDED(MultiByteToWideChar(CP_UTF8, 0, pszUTF, strlen(pszUTF), ptszTemp, iSize+1)))
{
wstrRet = ptszTemp;
}
delete[] ptszTemp;
ptszTemp = NULL;
return wstrRet;
}
}//namespace Code_Trans;
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "gui.h"
///////////////////////////////////////////////////////////////////////////
MainFrameBase::MainFrameBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
m_menuBar = new wxMenuBar( 0 );
m_menuFile = new wxMenu();
wxMenuItem* menuFileExit;
menuFileExit = new wxMenuItem( m_menuFile, wxID_EXIT, wxString( _("E&xit") ) + wxT('\t') + wxT("Alt+X"), wxEmptyString, wxITEM_NORMAL );
m_menuFile->Append( menuFileExit );
m_menuBar->Append( m_menuFile, _("&File") );
this->SetMenuBar( m_menuBar );
m_statusBar = this->CreateStatusBar( 1, wxST_SIZEGRIP, wxID_ANY );
wxBoxSizer* bSizer5;
bSizer5 = new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer* fgSizer3;
fgSizer3 = new wxFlexGridSizer( 5, 2, 0, 0 );
fgSizer3->AddGrowableCol( 1 );
fgSizer3->SetFlexibleDirection( wxBOTH );
fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticText5 = new wxStaticText( this, wxID_ANY, _("input file:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText5->Wrap( -1 );
fgSizer3->Add( m_staticText5, 0, wxALL, 5 );
m_fileopen = new wxFilePickerCtrl( this, wxID_ANY, wxEmptyString, _("Select a file"), wxT("*.*"), wxDefaultPosition, wxDefaultSize, wxFLP_DEFAULT_STYLE );
fgSizer3->Add( m_fileopen, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 );
m_staticText9 = new wxStaticText( this, wxID_ANY, _("output file:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText9->Wrap( -1 );
fgSizer3->Add( m_staticText9, 0, wxALL, 5 );
m_filesave = new wxFilePickerCtrl( this, wxID_ANY, wxEmptyString, _("Select a file"), wxT("*.*"), wxDefaultPosition, wxDefaultSize, wxFLP_DEFAULT_STYLE );
fgSizer3->Add( m_filesave, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 );
m_staticText6 = new wxStaticText( this, wxID_ANY, _("filter:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText6->Wrap( -1 );
fgSizer3->Add( m_staticText6, 0, wxALL, 5 );
m_filter = new wxTextCtrl( this, wxID_ANY, _(wxT("健康")), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer3->Add( m_filter, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 );
m_staticText7 = new wxStaticText( this, wxID_ANY, _("status:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText7->Wrap( -1 );
fgSizer3->Add( m_staticText7, 0, wxALL, 5 );
m_status = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_status->Wrap( -1 );
fgSizer3->Add( m_status, 0, wxALL|wxEXPAND, 5 );
m_staticText10 = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_staticText10->Wrap( -1 );
fgSizer3->Add( m_staticText10, 0, wxALL, 5 );
wxString m_filetypeChoices[] = { _("88DA 88ZS"), _("web"), _("wap") };
int m_filetypeNChoices = sizeof( m_filetypeChoices ) / sizeof( wxString );
m_filetype = new wxRadioBox( this, wxID_ANY, _("select file type"), wxDefaultPosition, wxDefaultSize, m_filetypeNChoices, m_filetypeChoices, 1, wxRA_SPECIFY_ROWS );
m_filetype->SetSelection( 0 );
fgSizer3->Add( m_filetype, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
bSizer5->Add( fgSizer3, 1, wxALIGN_TOP|wxEXPAND, 5 );
m_sdbSizer8 = new wxStdDialogButtonSizer();
m_sdbSizer8OK = new wxButton( this, wxID_OK );
m_sdbSizer8->AddButton( m_sdbSizer8OK );
m_sdbSizer8->Realize();
bSizer5->Add( m_sdbSizer8, 1, wxALIGN_BOTTOM|wxALIGN_RIGHT|wxEXPAND, 5 );
this->SetSizer( bSizer5 );
this->Layout();
this->Centre( wxBOTH );
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( MainFrameBase::OnCloseFrame ) );
this->Connect( menuFileExit->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnExitClick ) );
m_fileopen->Connect( wxEVT_LEFT_UP, wxMouseEventHandler( MainFrameBase::OnTextCtrlFocus ), NULL, this );
m_fileopen->Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( MainFrameBase::OnTextCtrlFocus ), NULL, this );
m_filesave->Connect( wxEVT_LEFT_UP, wxMouseEventHandler( MainFrameBase::OnTextCtrlFocus ), NULL, this );
m_filesave->Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( MainFrameBase::OnTextCtrlFocus ), NULL, this );
m_filter->Connect( wxEVT_LEFT_UP, wxMouseEventHandler( MainFrameBase::OnTextCtrlFocus ), NULL, this );
m_filter->Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( MainFrameBase::OnTextCtrlFocus ), NULL, this );
m_sdbSizer8OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnStart ), NULL, this );
}
MainFrameBase::~MainFrameBase()
{
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( MainFrameBase::OnCloseFrame ) );
this->Disconnect( wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnExitClick ) );
m_fileopen->Disconnect( wxEVT_LEFT_UP, wxMouseEventHandler( MainFrameBase::OnTextCtrlFocus ), NULL, this );
m_fileopen->Disconnect( wxEVT_SET_FOCUS, wxFocusEventHandler( MainFrameBase::OnTextCtrlFocus ), NULL, this );
m_filesave->Disconnect( wxEVT_LEFT_UP, wxMouseEventHandler( MainFrameBase::OnTextCtrlFocus ), NULL, this );
m_filesave->Disconnect( wxEVT_SET_FOCUS, wxFocusEventHandler( MainFrameBase::OnTextCtrlFocus ), NULL, this );
m_filter->Disconnect( wxEVT_LEFT_UP, wxMouseEventHandler( MainFrameBase::OnTextCtrlFocus ), NULL, this );
m_filter->Disconnect( wxEVT_SET_FOCUS, wxFocusEventHandler( MainFrameBase::OnTextCtrlFocus ), NULL, this );
m_sdbSizer8OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnStart ), NULL, this );
}
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __GUI_H__
#define __GUI_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/menu.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/statusbr.h>
#include <wx/stattext.h>
#include <wx/filepicker.h>
#include <wx/textctrl.h>
#include <wx/radiobox.h>
#include <wx/sizer.h>
#include <wx/button.h>
#include <wx/frame.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class MainFrameBase
///////////////////////////////////////////////////////////////////////////////
class MainFrameBase : public wxFrame
{
private:
protected:
wxMenuBar* m_menuBar;
wxMenu* m_menuFile;
wxStatusBar* m_statusBar;
wxStaticText* m_staticText5;
wxFilePickerCtrl* m_fileopen;
wxStaticText* m_staticText9;
wxFilePickerCtrl* m_filesave;
wxStaticText* m_staticText6;
wxTextCtrl* m_filter;
wxStaticText* m_staticText7;
wxStaticText* m_status;
wxStaticText* m_staticText10;
wxRadioBox* m_filetype;
wxStdDialogButtonSizer* m_sdbSizer8;
wxButton* m_sdbSizer8OK;
// Virtual event handlers, overide them in your derived class
virtual void OnCloseFrame( wxCloseEvent& event ) { event.Skip(); }
virtual void OnExitClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnTextCtrlFocus( wxMouseEvent& event ) { event.Skip(); }
virtual void OnTextCtrlFocus( wxFocusEvent& event ) { event.Skip(); }
virtual void OnStart( wxCommandEvent& event ) { event.Skip(); }
public:
MainFrameBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("wxMiniApp"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,339 ), long style = wxCLOSE_BOX|wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL );
~MainFrameBase();
};
#endif //__GUI_H__
/*********************************************************************
* Name: code_trans.h
*********************************************************************/
#ifndef _CODE_TRANS_H_
#define _CODE_TRANS_H_
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string>
#include <windows.h>
using namespace std;
//XML code convert
namespace Code_Trans
{
char * wchar2char(char * strDest,const wchar_t * strSrc);
//http://baike.baidu.com/view/1026861.htm#3
char * mystrcpy(char * strDest,const char * strSrc);
//http://blog.csdn.net/mobidogs/article/details/3414746
int strstr(char srcstr[],char deststr[] );
//Description:http://www.cppblog.com/sunraiing9/archive/2007/03/21/20281.html
int WCharToMByte(LPCWSTR lpcwszStr, LPSTR lpszStr, DWORD dwSize);
int MByteToWChar(LPCSTR lpcszStr, LPWSTR lpwszStr, DWORD dwSize);
/*************************************************************************
* Name : Unicode2UTF8
* Description: Convert Unicode to UTF8 code
* input : ptszUnicode, point to the wide bytes
* output : N/A
* result : The converting result
*************************************************************************/
string Unicode2UTF8(const wchar_t* ptszUnicode);
/*************************************************************************
* Name : Unicode2ANSI
* Description: Convert Unicode to ANSI code
* input : ptszUnicod, point to the wide bytes
* output : N/A
* result : The converting result
*************************************************************************/
string Unicode2ANSI(const wchar_t* ptszUnicode);
/*************************************************************************
* Name : ANSI2Unicode
* Description: Convert ANSI code to Unicode
* input : N/A
* output : N/A
* result : The converting result
*************************************************************************/
wstring ANSI2Unicode(const char* pszAnsi);
/*************************************************************************
* Name :
* Description: Convert ANSI code to UTF8 code
* input : pszANSI, point to the multi bytes
* output : N/A
* result : The converting result
*************************************************************************/
string ANSI2UTF8(const char* pszANSI);
/*************************************************************************
* Name : UTF*2ANSI
* Description: Convert UTF8 code to ANSI code
* input : pszUTF, point to UTF8 bytes
* output : N/A
* result : The converting result
*************************************************************************/
string UTF82ANSI(const char* pszUTF);
/*************************************************************************
* Name : UTF82Unicode
* Description: Convert UTF8 code to Unicode
* input : pszUTF, point to UTF8 bytes
* output : N/A
* result : The converting result
*************************************************************************/
wstring UTF82Unicode(const char* pszUTF);
}//namespace Code_Trans
#endif