' ******************************************************
' Java
' ******************************************************
function JavaBuild()
Dim SrcCode,ErrText
SrcCode = document.all("Src" ).value
if Trim( SrcCode ) = "" then
alert( "ソースコードがありません " )
exit function
end if
' ソースコード構築
Call Initialize( )
Call ReplaceMacro( )
SrcCode = document.all("Src" ).value
SrcCode = "#include " "head\JAVA.H" "" & vbCrLf & SrcCode
Dim Cpp
Set Cpp = Fs.CreateTextFile( "CLCOMP.CPP" , True )
Cpp.WriteLine( SrcCode )
Cpp.Close()
' プリプロセス実行
if document.all("Cygwin" ).checked then
Call WshShell.Run( "CMD.EXE /C bat\PPGCC.BAT" , 0, True )
else
Call WshShell.Run( "CMD.EXE /C bat\PP.BAT" , 0, True )
end if
Dim strWork,StdText,OutSw
Set StdText = Fs.OpenTextFile("CLCOMP.i" , 1)
Set Cpp = Fs.CreateTextFile( "CLCOMP.java" , True )
OutSw = False
Do While not StdText.AtEndOfStream
strWork = StdText.ReadLine
if Left( strWork, 1 ) <> "#" then
Cpp.WriteLine strWork
end if
Loop
StdText.Close()
Cpp.Close()
document.all("Bytes" ).length = 0
Set CppText = Fs.OpenTextFile("CLCOMP.java" , 1)
Do While not CppText.AtEndOfStream
strWork = CppText.ReadLine
document.all("Bytes" ).length = document.all("Bytes" ).length + 1
document.all("Bytes" ).options(document.all("Bytes" ).length-1).text = Len(strWork)
Loop
CppText.Close()
' Java コンパイル
Call WshShell.Run( "CMD.EXE /C bat\JAVABUILD.BAT" , 0, True )
Set ErrText = Fs.OpenTextFile("ERR" , 1)
strWork = ""
Do While not ErrText.AtEndOfStream
strWork = strWork & ErrText.ReadLine
Loop
if strWork = "" then
DoJavaExec( )
else
DispJavaErr( )
end if
end function
# **********************************************************
# 更新処理
# **********************************************************
function UpdateData( &$SQL ) {
global $ErrMessage,$Message;
global $Target,$KeyField,$KeyName;
if ( $_POST['send'] != '更新' ) {
return;
}
foreach( $_POST as $Key => $Value ) {
if ( substr( $Key, 0, 3 ) == 'IUL' ) {
$Renban = str_replace( 'IUL', '' , $Key );
$Query = 'update メニューマスタ' ;
$Query .= " set URL = '$Value' " ;
$Query .= " where id = {$_POST['id' ]}" ;
$Query .= " and 連番 = $Renban" ;
$SQL->Execute( $Query );
}
if ( substr( $Key, 0, 3 ) == 'ITL' ) {
$Renban = str_replace( 'ITL', '' , $Key );
$Query = 'update メニューマスタ' ;
$Query .= " set タイトル = '$Value' " ;
$Query .= " where id = {$_POST['id' ]}" ;
$Query .= " and 連番 = $Renban" ;
$SQL->Execute( $Query );
}
if ( substr( $Key, 0, 3 ) == 'IUM' ) {
$Renban = str_replace( 'IUM', '' , $Key );
$Query = 'update メニューマスタ' ;
$Query .= " set URL2 = '$Value' " ;
$Query .= " where id = {$_POST['id' ]}" ;
$Query .= " and 連番 = $Renban" ;
$SQL->Execute( $Query );
}
if ( substr( $Key, 0, 3 ) == 'ITM' ) {
$Renban = str_replace( 'ITM', '' , $Key );
$Query = 'update メニューマスタ' ;
$Query .= " set タイトル2 = '$Value' " ;
$Query .= " where id = {$_POST['id' ]}" ;
$Query .= " and 連番 = $Renban" ;
$SQL->Execute( $Query );
}
if ( substr( $Key, 0, 3 ) == 'IUR' ) {
$Renban = str_replace( 'IUR', '' , $Key );
$Query = 'update メニューマスタ' ;
$Query .= " set URL3 = '$Value' " ;
$Query .= " where id = {$_POST['id' ]}" ;
$Query .= " and 連番 = $Renban" ;
$SQL->Execute( $Query );
}
if ( substr( $Key, 0, 3 ) == 'ITR' ) {
$Renban = str_replace( 'ITR', '' , $Key );
$Query = 'update メニューマスタ' ;
$Query .= " set タイトル3 = '$Value' " ;
$Query .= " where id = {$_POST['id' ]}" ;
$Query .= " and 連番 = $Renban" ;
$SQL->Execute( $Query );
}
}
return TRUE;
}
<SCRIPT language=VBScript src=excel.vbs></SCRIPT>
<SCRIPT language=VBScript>
Dim MyBook
' ************************************************
' 開く
' ************************************************
function XlsOpen()
Target = document.all("Excel" ).value
if Trim(Target) = "" then
alert("Excel ブックを選択して下さい " )
Exit Function
end if
Set MyBook = ExcelOpen( Target )
Call ExcelVisible( true )
ExcelApp.Width = 380
document.all("OpenButton" ).disabled = True
document.all("QuitButton" ).disabled = False
document.all("SheetListButton" ).disabled = False
document.all("SheetList" ).disabled = False
document.all("RangeButton" ).disabled = False
end function
' ************************************************
' 終了
' ************************************************
function XlsQuit()
Call ExcelQuit(MyBook)
document.all("OpenButton" ).disabled = False
document.all("QuitButton" ).disabled = True
document.all("SheetListButton" ).disabled = True
document.all("SheetList" ).disabled = True
document.all("SheetList" ).options.length = 0
document.all("RangeButton" ).disabled = True
end function
' ************************************************
' シート一覧
' ************************************************
function XlsSheetList()
Call ExcelSheetList(MyBook,"SheetList" )
end function
' ************************************************
' シート選択
' ************************************************
function XlsSelectSheet()
Target = document.all("SheetList" ).value
Call ExcelSelectSheet(MyBook, Target)
end function
' ************************************************
' 範囲選択
' ************************************************
function XlsRange()
Target = document.all("SheetList" ).value
if Target = "" then
alert("シートを選択して下さい " )
Exit Function
end if
Call ExcelSelectSheet(MyBook, Target)
X1 = Cint(document.all("RangeX1" ).value)
Y1 = Cint(document.all("RangeY1" ).value)
X2 = Cint(document.all("RangeX2" ).value)
Y2 = Cint(document.all("RangeY2" ).value)
Call ExcelRange(MyBook, Target, X1, Y1, X2, Y2 )
end function
</SCRIPT>
<HTML>
<HEAD>
<META http-equiv="Content-type" content="text/html; charset=Shift_JIS" >
<TITLE>excel専用</TITLE>
<STYLE>
.MyCell {
background-color:silver
}
.MyButton {
width:200
}
</STYLE>
</HEAD>
<BODY>
<INPUT type=file name=Excel style='width:400' >
<BR>
<INPUT
class=MyButton
name=OpenButton
type=button
value="開く"
onClick='Call XlsOpen()'
><BR>
<INPUT
class=MyButton
name=QuitButton
type=button
value="終了"
onClick='Call XlsQuit()'
disabled
><BR>
<INPUT
class=MyButton
name=SheetListButton
type=button
value="シート一覧"
onClick='Call XlsSheetList()'
disabled
><BR>
<SELECT
class=MyButton
name=SheetList
disabled
onChange='Call XlsSelectSheet()'
></SELECT><BR>
<INPUT
class=MyButton
name=RangeButton
type=button
value="範囲選択"
onClick='Call XlsRange()'
disabled
><BR>
<SELECT
name=RangeX1
>
<OPTION value=1>1<OPTION value=2>2<OPTION value=3>3<OPTION value=4>4
<OPTION value=5>5<OPTION value=6>6<OPTION value=7>7<OPTION value=8>8
<OPTION value=9>9<OPTION value=10>10<OPTION value=11>11
<OPTION value=12>12<OPTION value=13>13<OPTION value=14>14
</SELECT>
<SELECT
name=RangeY1
>
<OPTION value=1>1<OPTION value=2>2<OPTION value=3>3<OPTION value=4>4
<OPTION value=5>5<OPTION value=6>6<OPTION value=7>7<OPTION value=8>8
<OPTION value=9>9<OPTION value=10>10<OPTION value=11>11
<OPTION value=12>12<OPTION value=13>13<OPTION value=14>14
</SELECT>
<SELECT
name=RangeX2
>
<OPTION value=1>1<OPTION value=2>2<OPTION value=3>3<OPTION value=4>4
<OPTION value=5>5<OPTION value=6>6<OPTION value=7>7<OPTION value=8>8
<OPTION value=9>9<OPTION value=10>10<OPTION value=11>11
<OPTION value=12>12<OPTION value=13>13<OPTION value=14>14
</SELECT>
<SELECT
name=RangeY2
>
<OPTION value=1>1<OPTION value=2>2<OPTION value=3>3<OPTION value=4>4
<OPTION value=5>5<OPTION value=6>6<OPTION value=7>7<OPTION value=8>8
<OPTION value=9>9<OPTION value=10>10<OPTION value=11>11
<OPTION value=12>12<OPTION value=13>13<OPTION value=14>14
</SELECT>
<BR>
</BODY>
</HTML>
<SCRIPT for=window event=onload language="VBScript" >
window.focus()
top.resizeTo screen.width / 2, screen.height - 32
top.moveTo screen.width / 2, 0
</SCRIPT>
<SCRIPT for=window event=onunload language="VBScript" >
Call ExcelQuit(MyBook)
</SCRIPT>
#import "c:\Program Files\Common Files\System\ADO\msado15.dll" \
no_namespace rename("EOF" , "EndOfFile" )
inline void TESTHR(HRESULT x) {if FAILED(x) _com_issue_error(x);};
_ConnectionPtr pCn = NULL;
void PrintProviderError(_ConnectionPtr pConnection)
{
ErrorPtr pErr = NULL;
if( (pConnection->Errors->Count) > 0)
{
printf("ProviderError\n" );
long nCount = pConnection->Errors->Count;
for(long i = 0; i < nCount; i++)
{
pErr = pConnection->Errors->GetItem(i);
printf("\tError number: %x\n" , pErr->Number );
printf("\tDescription: %s\n" , (LPTSTR)pErr->Description);
}
}
}
void PrintComError(_com_error &e)
{
_bstr_t bstrSource(e.Source());
_bstr_t bstrDescription(e.Description());
// Print Com errors.
printf("ComError\n" );
printf("\tCode = %08lx\n" , e.Error());
printf("\tCode meaning = %s\n" , e.ErrorMessage());
printf("\tSource = %s\n" , (LPCSTR) bstrSource);
printf("\tDescription = %s\n" , (LPCSTR) bstrDescription);
}
char *ConnectionString =
"Provider=Microsoft.Jet.OLEDB.4.0;"
"Data Source=C:\\Documents and Settings\\lightbox\\My Documents\\db.mdb;" ;
int main( )
{
CoInitialize(NULL);
try {
TESTHR(pCn.CreateInstance(__uuidof(Connection)));
_bstr_t ConString;
ConString.operator = ( ConnectionString );
printf( "%s\n" , (LPTSTR)ConString );
pCn->Open(ConString, "" , "" , adConnectUnspecified);
// ここにコードを書く
pCn->Close();
pCn.Release();
}
catch (_com_error &e)
{
PrintProviderError(pCn);
PrintComError(e);
}
CoUninitialize();
return 0;
}
#import "c:\Program Files\Common Files\System\ADO\msado15.dll" \
no_namespace rename("EOF" , "EndOfFile" )
inline void TESTHR(HRESULT x) {if FAILED(x) _com_issue_error(x);};
_ConnectionPtr pCn = NULL;
void PrintProviderError(_ConnectionPtr pConnection)
{
ErrorPtr pErr = NULL;
if( (pConnection->Errors->Count) > 0)
{
printf("ProviderError\n" );
long nCount = pConnection->Errors->Count;
for(long i = 0; i < nCount; i++)
{
pErr = pConnection->Errors->GetItem(i);
printf("\tError number: %x\n" , pErr->Number );
printf("\tDescription: %s\n" , (LPTSTR)pErr->Description);
}
}
}
void PrintComError(_com_error &e)
{
_bstr_t bstrSource(e.Source());
_bstr_t bstrDescription(e.Description());
// Print Com errors.
printf("ComError\n" );
printf("\tCode = %08lx\n" , e.Error());
printf("\tCode meaning = %s\n" , e.ErrorMessage());
printf("\tSource = %s\n" , (LPCSTR) bstrSource);
printf("\tDescription = %s\n" , (LPCSTR) bstrDescription);
}
#define ADO_MAIN(constring) \
int main( ) \
{ \
CoInitialize(NULL); \
try { \
TESTHR(pCn.CreateInstance(__uuidof(Connection))); \
_bstr_t ConString; \
ConString.operator = ( constring ); \
printf( "接続文字列は[%s]です\n" , (LPTSTR)ConString ); \
pCn->Open(ConString, "" , "" , adConnectUnspecified);
#define ADO_END pCn->Close(); pCn.Release(); } catch (_com_error &e) \
{ \
PrintProviderError(pCn); \
PrintComError(e); \
} \
CoUninitialize(); \
return 0; \
}
#define ADO_EXECUTE(Command) \
pCn->Execute(Command, NULL, adExecuteNoRecords);