|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- 花键轴设计的主程序 Database_main.cpp : implementation file" K0 N8 R# n* t5 N
- 1 h2 k' k: J" X) n
-
. [0 Z* p" d% \* ^: n
5 `! ~* l; V- d& S8 z- #include "stdafx.h"$ T+ w( Y% j! P+ R
" Q& O1 T. Q4 Y- #include "app_data.h"/ e4 h5 Z% }" k% x" _
- " _. w O% |, d4 ^4 j7 ]4 R x" m
- #include "Database_main.h"- R' |9 v/ m! U/ L
( a5 v8 {9 J! a- H7 o- 4 _/ H+ S8 ]+ X! v! N
1 G! z# e( V6 V- Q4 h# Q9 U- |* n8 x) k- #ifdef _DEBUG
2 x7 Q3 Z4 b" ]7 M- W
+ ^8 v& o! E% e8 D5 \- #define new DEBUG_NEW
2 H7 \( P& O i- U& x& o: s6 ^# H - 2 Y: w7 o( V4 L2 ^" M
- #undef THIS_FILE5 x/ \6 E1 m1 `6 P5 G
6 g! ?. n4 F- z- T2 _- static char THIS_FILE[] = __FILE__;$ V9 s: b' U8 ]7 y2 p
5 A- w/ C' s; U6 Y. B- #endif* [2 h( g; u: }: t5 Y3 h
* W5 f4 t: b+ D( G8 V- " x7 K; n' Y* I: F k
7 R+ w" G; Z- W1 ~+ u# H- CDatabase_main::CDatabase_main(CWnd* pParent /*=NULL*/)
. ?1 X# @8 j9 \; [2 a - . y5 w+ U- @$ v }* P- P2 y
- : CDialog(CDatabase_main::IDD, pParent)/ V1 |2 v, z0 q3 d/ L2 |/ U# c& t
- . E& p' M0 H3 p) e5 m$ q2 h
- {
$ d. y$ y1 e; c; b7 ?
( ]& }: F* _' E0 t& N- //{{AFX_DATA_INIT(CDatabase_main)
+ E) t' ^" b w) M8 r - e/ r' {' `( m p9 ?, |
- // NOTE: the ClassWizard will add member initialization here6 U1 R( M& C4 s. }
6 ~- V0 M+ w2 {+ E0 [: P. H- //}}AFX_DATA_INIT
0 ^6 f$ P* a3 d+ V4 d$ R - $ K2 G* A% z2 T" g
- }' ?% O# Y- f1 m( o
2 s( G( f4 H X-
% s6 V U* X7 \- A5 O' [
4 ?6 j7 m' O8 {* Q! y" w4 \- $ u5 s/ @. S ^/ h
: R. q3 A l! V! i/ o* `1 j- void CDatabase_main::DoDataExchange(CDataExchange* pDX)
9 d8 d# r- Q2 ~# m - - o" k9 P) ?0 [" E/ ^6 C
- {. ]4 _; x7 F% R) B
! l" T! x+ B: {. m: K" y: G- CDialog::DoDataExchange(pDX);
& K9 \( G$ k" `+ O8 }' O - * V4 J1 R6 m' o
- //{{AFX_DATA_MAP(CDatabase_main)
9 j2 i; N# S9 `3 S: y& x1 ?- l, ?; d3 H; ]
1 R9 a& F' d/ O1 H# y- DDX_Control(pDX, IDC_LIST_PARA, m_list_control);
, l9 Z* T2 n% e$ K
7 e. V9 l9 F2 Q2 H. W" ~% t7 V1 C- //}}AFX_DATA_MAP: r) Q. ^6 q2 N
- , K9 a K& S- S) z: ]- @! b
- }
% z2 N! l4 @! p, U, J6 B - $ I" _. o- ?3 j
- BEGIN_MESSAGE_MAP(CDatabase_main, CDialog)- `# V0 u: ]& i' o& R
- $ ]% z6 q2 s0 x+ P0 x, Q0 O! i# I
- //{{AFX_MSG_MAP(CDatabase_main)) `8 K/ Z+ @3 a$ O/ o; Q
- # v; E$ ?* Q' b. Y; }: h
- ON_WM_DESTROY()# Z5 E1 k& G' o$ D# t
- ( f, H% i8 _; z1 k) N
- //}}AFX_MSG_MAP
$ N, K6 q& U3 T/ I: E A - * w3 I" P) W5 L1 g' h4 d
- END_MESSAGE_MAP()3 x' u5 h, e# n3 t5 H
- * l: b* C/ S/ V3 K" ^
- " [; ^; a9 |6 u! C) o# X" F
4 g) i7 v: a, c/ ~, q' B X- BOOL CDatabase_main::OnInitDialog()+ t+ a5 }0 z+ ]1 v
- * U! w/ U- ]2 d: i: E& Z" v
- {
& ]. ?: E0 ? ^+ ?3 o+ J' H
4 B' |" o s/ x- CDialog::OnInitDialog();
6 l$ K0 N0 C: Z* _9 b& c: F - 2 C! Z7 U" y8 ~+ m
-
: a- _, e% I3 R7 n* [4 o - , J- L( I4 j: Y+ G5 _
- // TODO: Add extra initialization here5 ]: [) C' D$ }. i: J
- , z' u3 ^/ c( y
- try{3 V9 g" x- ]! w! Z8 G9 A2 @8 S
! I: U$ n3 Q5 K! e4 V/ L- m_pdatabase=new CDatabase();! b3 }' v& h+ U% p o8 t6 y
0 t2 I) F! b% k3 ?3 s/ T/ j$ _0 o. e+ B- m_pset=new CRecordset();5 C% E K" p; ~/ Y6 m
- , u: A9 P) W& H
- m_pdatabase->Open(_T("data"),FALSE,FALSE,_T("ODBC;DSN=data"),FALSE);3 q1 Z @4 X @6 S
4 I4 W, P: i* ^* G" y% C; X0 X- m_pset->m_pDatabase=m_pdatabase;
% [8 U2 F0 D4 p - ) ]( w% n; l& x" q$ H! A: ]
- }/ V- W/ O7 ?- M5 k7 h$ p; s5 M
0 A; R/ ]- O! t' o- z) x# z) B3 a( F- caTCh(CDBException* e){
0 z8 e& U% j. F
+ {1 F6 P$ I) }6 X- e->ReportError();
- V; {" Z+ p' v- c3 U
4 D' Q! T9 X; `) Z& Y- e->Delete();
8 @) O, `5 K' `2 H. I
9 w+ l" ]9 j+ C3 w, y9 X& F- delete m_pset;8 e, a( E8 \, n( \$ N( v& W1 S
6 Q: y- K8 F: O- delete m_pdatabase;2 c' [ l2 V$ A
( S) y0 f8 x D5 z! h8 `4 F- return TRUE;}+ g% h8 x$ m9 @: \
- 2 m. C9 G: ~$ T# `: A0 o" J4 a
- DataShow("data");
. U; j4 L2 H0 P6 y5 t) O - * e" p+ d# v4 B. v; x+ a4 w
- return TRUE; // return TRUE unless you set the focus to a control7 i& F* d: q N. J
- 9 M2 f( c) S0 K9 n, A# j q6 E* R( I( l
- // EXCEPTION: OCX Property Pages should return FALSE, V1 L7 G: C1 K% I2 K; O
- ! b: A7 _: O2 I U
- }( U" N* W" W8 o3 l, A: h
- 9 n7 e- w: @) G
- void CDatabase_main::ClearList()
- B7 G2 s& N! u - , J9 n4 t& D' o, i7 X
- {
7 T4 l1 h0 F8 Z4 t+ \% j
' w# G) w) a* W+ K- //m_list_control.SetExtendedStyle(LVS_EX_FULLROWSELECT);
' h7 F- `) _1 i, a - 4 j2 \/ p$ U* g* d& s6 B7 w' ?
- //m_list_control.SetExtendedStyle(LVS_EX_GRIDLINES);0 a! _0 o q0 r& B
6 E3 o7 A1 \$ \1 T; q- m_list_control.DeleteAllItems();
+ z$ T5 E$ y- O& |3 M - " n0 D7 |. w4 `
- while(m_list_control.DeleteColumn(0));
. p1 h: `. M6 A. r7 s6 s; u - ( G" @3 O) S! s7 t
- UpdateWindow();
; X- k& L8 a8 @# J% G% ]8 T - + Z, e/ \5 W8 q9 h7 Z9 v
- }
% ]% c+ |1 S$ ~; s3 T6 k - 9 q/ |" p4 Y/ l9 ?7 V2 H
- void CDatabase_main::DataShow(CString table_name)
' V0 B2 H0 N" B6 K - . W0 S2 k- p4 v, c$ N6 p
- {
7 @! i) p9 R# o$ U! f
1 ^2 p" I8 F# y% l3 x9 o) \- ClearList();' ]" ?3 v# Q) U' n5 b7 Y
, m/ V! s4 `" S+ S" d- CString strSQL;' m/ \# B$ k, N O& N, \1 }
- 5 q! p7 t! a0 m1 \) E
- strSQL="select * from "+table_name;5 d% W# G/ V3 g' b% ?) n: p6 g
- 1 N0 ]$ q5 Q5 [9 ^! C: k: G5 `
- ShowInformation(strSQL);4 u2 ^: j" @1 W o
- " Q- s1 c) X8 G
- }: V4 H- K f$ ]) P7 L6 q3 Y8 ^( M
1 q% y, m) w! d+ [0 p, C-
6 c4 l$ V. g0 d - ( Y2 J$ }9 e0 M7 q8 h) y6 _
- BOOL CDatabase_main::ShowInformation(CString strSQL)9 }# x! p5 g2 w, G3 @4 E
- 5 N# c/ s8 c9 [/ n
- { r# F) @% U7 \9 [, ?
- # W) G5 w, w" \2 ]0 w: G
- if(!m_pdatabase->IsOpen()) return FALSE;
: ^3 R$ h) n9 o2 a: B
: @; G, p, y0 f# p6 i- if(!m_pset) return FALSE;( c, {. W- m1 V/ X, \
! K' @8 G5 u" y% R- try{5 q4 s% a1 l1 X4 [
- # [9 E1 _) N3 s9 }& w( ?* f2 n o S
- BeginWaitCursor();
6 ^$ [, e3 s* h$ q% f2 x- a3 S
; ^) w; k! t; K7 S- if(m_pset->IsOpen()) m_pset->Close();% y$ ^$ }' _/ c6 ^$ E9 `$ V
4 c0 b6 |2 A' v c7 X1 n- m_pset->Open(CRecordset::dynaset,strSQL);
( E8 \+ x7 B3 k/ @( m: A& A' S - 0 j: N# K/ y, L* ~. u
- if(!m_pset->IsEOF())2 a- y6 d) J8 @5 C% W+ Q; K
1 T1 E/ M4 t& X! ?) w6 d- {m_pset->MoveLast();
; Q' o6 m! B$ e' b
7 ]9 E, _4 R5 U- m_pset->MoveFirst();}1 p- ~0 Q$ x$ W" J) X, s# ~
- * x) c9 v6 Q w
- nFieldCount=m_pset->GetODBCFieldCount();3 T, E' `0 a {9 _3 C
" Q4 M4 N' w, ]5 I9 s5 A: M- CODBCFieldInfo fieldinfo;
7 h/ m; _2 T9 X6 e# D9 F6 w
, ^& A# ]; p; E# ^5 v5 D- for(int n=0;n<nFieldCount;n++){
% r. V/ T$ e$ p: ?. I - 1 L; X# U/ X+ ]2 X4 l
- m_pset->GetODBCFieldInfo(n,fieldinfo);+ T; a9 p0 {( V* v
- 6 R. Y+ {, b: a
- int nWidth=m_list_control.GetStringWidth(fieldinfo.m_strName)+35;& X8 W( d8 E3 m: J
+ o; ]/ d) d& e Y+ H9 V- k; L- m_list_control.InsertColumn(n,fieldinfo.m_strName,LVCFMT_RIGHT,nWidth);8 W, v, A0 E. X2 D( X! U
- 1 @) l- {" C5 z' V8 Y2 D- ]
- }
5 x( ~6 E9 O5 [6 u9 B- T
6 }8 \ b) M* X8 G- CString strValue;
+ C- e4 w& w0 t
0 U' T. J- p0 v6 O0 Y0 \- m_pset->MoveFirst();
5 l0 M8 H* S( C, z - # x- r2 q6 i3 w7 F; ]4 Z
- int nCount=0;) K8 `" P; E, U+ h
- ) r! D4 a5 z0 _; @3 B* g% Q% g
- while(!m_pset->IsEOF()){0 W7 _" d% R/ C3 Y
[9 j; I# O- a! ?6 u, `6 t0 W- m_list_control.InsertItem(nCount,strValue);
# V9 Q1 Q0 I* h: f% U
' f, k3 B: ]9 V( o3 K- for(int j=0;j<nFieldCount;j++){, N$ s, i( ]; p+ A" B
6 L4 i& Y- Z/ k7 Y: F- m_pset->GetFieldValue(j,strValue);
: j! B0 @/ S9 ^1 O - 9 [' z2 X, f7 U- ]" M1 n3 k
- m_list_control.SetItemText(nCount,j,strValue);$ U, V" f# f# e8 A
# P: H# q. w4 ]5 O- }
% A) [+ W, i2 G, j- v C1 y+ p
1 @$ u2 v/ p+ k2 E% E- m_pset->MoveNext();) I1 X0 h8 C2 m
1 ^, i4 Y$ _" \2 D t& N) G; c$ B- nCount++;& _: B1 I- @4 A' o6 B
) v x$ W+ B: r& u- }
' W6 k/ O. o$ d* }: Y/ m9 t2 E - $ u _' _, X* L e. u
- EndWaitCursor();
% `- n; X6 a1 X' Q! Y
1 H% p" t' \; c6 o6 V) \- }; [+ C9 h; a1 |$ W5 G: Z1 ]
- 9 E8 Q; G" g2 q$ V8 s2 K
- catch(CDBException *e){. b: W9 l7 n0 K. e1 h" ]5 l
- # [8 G8 r2 k6 b
- e->Delete();- v) s2 h# S4 A M" {7 x7 i
- 3 k8 B8 W) J/ Z$ v2 }9 M
- EndWaitCursor();- H$ K; e' y+ G" v( c
9 s9 N4 K" d( B7 o* I3 `! ?" l2 \- return FALSE;8 M# g! h5 _+ P0 D
' R* m; ]- u% j% u- }
, r5 D, M, ^' |7 j) w% L' J2 u - ) y+ I+ U) l: M+ O- Y% {& I
- return TRUE;4 e/ T- r& y2 v- f: n
% h6 x- s4 M4 H$ l8 i3 z- }( A+ |) P- s9 G* y6 ?
% @7 g' e, P% D: ?0 | N5 Y* P9 B- 4 {' |+ Z& d D1 w$ J" r
- % X9 j7 {& v/ |: V2 u
- void CDatabase_main::OnDestroy()
$ p$ [7 G( r- }5 w$ \. [ - 9 I2 b8 D! \# u$ A
- {
# R p2 ~: W, K2 W/ k - # u* e5 L9 k3 @3 |. [
- CDialog::OnDestroy();
+ m, u" y' F/ e A. E4 g$ s - m# r# h S P6 R
-
% O) C. r! S: q- _ - - y5 D$ h" ]! {" I0 M" G$ e
- // TODO: Add your message handler code here
" H4 G! k2 M2 ^) o - 5 Z% n, y$ j7 w
- delete m_pset;1 } @7 p1 T( q2 U% I% x4 L" G
% [0 N% G# i p- delete m_pdatabase;
o# x' Z( X6 S! X5 {% y5 ^- r& }
/ x2 G+ l; l' K4 v. I! M: X# V- }
, C( |" Q$ x, n
# e" }% r7 N1 o& q% v/ O- extern CString str[8]; }6 l, P; u$ X# n
) v$ O; U- ^' Y- void CDatabase_main::OnOK()2 M9 c4 T( ~+ b( ]8 N( j- ?+ R
- * Z; z' y* S+ |1 c+ o' V& |0 k
- {8 m4 }! s+ h4 {! b0 @ \
- 6 l# b4 i3 N2 _0 H/ W0 p# _
- // TODO: Add extra validation here
/ @9 H4 d; L3 F' z4 b$ M( e* Y! Q
% I' q. {) U5 O$ ?+ L: O- UINT uSelectedCount=m_list_control.GetSelectedCount();9 u: {5 R1 _5 T! L; m; C
, F. m |4 f* o' }0 Z- if(uSelectedCount>1||uSelectedCount==0)% _# j0 Y) D! u0 s1 V% j8 t
- $ r+ y. Y" o+ W3 x7 U/ y3 `
- {
7 `. |0 z+ h+ p: h5 V/ g) h. H
+ I' b( o4 w% J! K. U- if(uSelectedCount==0)- h* ^2 m7 [ E0 W: i0 P
- * E7 M" U: ~( E0 ?- p8 S
- {! t2 v$ V, d7 i1 P
- / G! X; {* M7 B; v
- MessageBox("要选择一条参数!","提示",MB_ICONWARNING+MB_OK);
* T+ M: K4 S' t' S, u% `+ _/ y
2 h y o4 Q" @5 q: y# @- return;
/ M1 {! n$ v# X9 y' { f - 8 D8 H, B* L3 J5 ^
- }% n8 \( f ]: z8 Z7 s$ D( ?
- 5 v# K& A. {% C7 Z
- if(uSelectedCount>1)
( Z" Q4 X: K5 r0 A' m/ g - + R) A4 _ _( D# b
- { # S/ O+ B5 W1 s2 @! ~
- a5 L% `2 n+ R- MessageBox("只能选择一条参数!","提示",MB_ICONWARNING+MB_OK);+ i- W$ D1 M, A
- * T0 A: Q. R$ p! O& Y+ D
- return;+ d" d& I' b: @8 N( ]
- 5 b% U/ C$ P$ |) T5 q3 g5 I w+ z
- }# ~, B# e, A# k: q4 a
( r" _% M. y* g2 \2 Q% x! m- }
h# m- P& i7 L1 l' } - % ?: [* _- y$ g+ ]( @6 b
- else
( r" C$ T1 W2 |( j- A0 U
# n4 o( g- C! T5 d8 ~, u- { , {4 b7 J& r' a# X
* S2 R5 F& S$ |0 }6 |/ b B2 Y- int nItemSel=0;% {: `6 E, @7 G7 _* |
% k; Z, T. O' T# C. Y+ j7 i- nItemSel=m_list_control.GetNextItem(nItemSel-1,LVNI_SELECTED);- v6 l4 X( _0 t- n- s' j& ?
- + T9 j8 Y9 e* b ?3 j4 M8 v
- for(int j=0;j<nFieldCount;j++)/ t" H7 P4 ~ m( W& h9 M
# ?* l' Z# m/ W' ?1 d: K- str[j]=m_list_control.GetItemText(nItemSel,j);
! D/ H( k8 ^/ M
6 Y, L; m2 E9 x4 H' K: C# w- }! O; n6 }5 D0 N9 O# n! W+ m" T
8 z Y+ t5 Z& y O- CDialog::OnOK();0 u* N1 a* C. E8 p! e
5 Y; _" v( b: Y- n( g' c( v* d. P: A- }# ^' A+ f7 x, D* {2 p+ c
9 u2 |4 F9 z: w) F4 P, q-
, i6 O( O4 u' d- C( ]4 i$ Y( s4 s - " s! ]9 D1 Q9 y* l/ n+ v
- ( K" L' t0 `% b% `; Z
; r$ D p$ ^5 t- 圆头直杆圆凸模的主程序:
+ D* J1 F5 o& | - & ]( M" E7 C" b( G" R8 R9 l V
- 3 S. { q- U' s) e
- ( b! e# U9 q6 I9 C
- Database_main.cpp : implementation file M' U& e; T+ k, h: J( A
" L$ R& f. @3 u. B- #include "stdafx.h"2 z# ]3 Z" {9 q) F: T" x
/ l8 a6 k" e8 ^9 @4 s- f8 m- #include "tumo_data.h"
$ U6 x; X' W" O* ?9 M+ Y* ?
* o7 \5 g. X+ @; f" F2 z% Q! p- #include "Database_main.h"" B( o; q) q+ ?; {
& Z2 }6 C3 r1 r5 F% y-
4 @: `& S% F1 X) V* g
) x6 `3 S+ V4 i3 h' f0 c A- #ifdef _DEBUG& o& }, X: D3 z9 }+ D
- $ W+ E! w7 g- b6 a
- #define new DEBUG_NEW
+ {) ^% }3 j9 z+ v I# m/ D - # G, I; P+ ?3 Q+ b, f# Y
- #undef THIS_FILE
2 Z) J( A9 j7 _8 X$ _) z
* |* p$ L6 }, {8 q3 N# U1 Z- static char THIS_FILE[] = __FILE__;' g1 h: O$ `! f; E3 E
- 9 |' a2 H" a& Q9 t1 @9 X7 q
- #endif
2 k; V2 g, H' i% r) T1 _ - 3 h- R0 h& [2 l( S4 f
-
1 c. j, G& m6 ?7 A5 l# k8 W- r
" k$ r0 A/ i( f: E- k- // CDatabase_main dialog
( x% N+ G; N9 r' [
7 d" Y3 P8 z" A0 g- CDatabase_main::CDatabase_main(CWnd* pParent /*=NULL*/)
1 v4 P3 y' R% V5 I( Q& r4 K
* I5 G& G" c1 L' ^9 J- : CDialog(CDatabase_main::IDD, pParent)% F" T z" ]8 o8 G' L- q
! {' O1 Y7 }5 x9 s+ w6 q5 ^- {
- S% ~6 H# K# b+ X% V
, N) ~) R0 b! N9 k1 w- ^$ K- B ?7 p- //{{AFX_DATA_INIT(CDatabase_main)
, C: @5 E/ R; H* x/ T
% n3 u" p* U) G3 c2 n! Y9 H. [- // NOTE: the ClassWizard will add member initialization here
9 G5 n( G8 G2 f/ L% `
! |4 `# S1 H6 S5 h" [- //}}AFX_DATA_INIT4 j, k3 T, q- J$ c& q) w8 i
% ^ o7 s! u' }3 O* q" ?- o- }, Q6 d% o$ O. C, n% N" q/ G* A
- + x) v' G/ F& c4 u. E. D
- void CDatabase_main::DoDataExchange(CDataExchange* pDX)" E5 O+ R+ w1 U$ j
+ D* C# O6 P! p; Q) s1 s- {
) G. Q+ x5 D% D+ q5 I
& o, g# [ S; U* {: I: s- CDialog::DoDataExchange(pDX);; L' W G8 g& x( Z! o
- , ]/ L' I9 K% |' Z
- //{{AFX_DATA_MAP(CDatabase_main)5 c6 V( H. J* c8 b7 J! q
- K' y& t) n% T# t- DDX_Control(pDX, IDC_LIST_PARA, m_list_control);
$ I* r* X {5 ^- b# c3 n - - C9 p7 ]+ C! B9 }& ]. g0 }
- //}}AFX_DATA_MAP( Y) k) ~& d9 ~, K4 F2 C* I: m
- 5 Q& o) y- @( n8 T! y
- }
( Y0 e, z( ~/ U3 ~" }
. B6 `6 _! ]1 v2 Y$ Y; {- BEGIN_MESSAGE_MAP(CDatabase_main, CDialog)
+ s" x( D% s7 u - * z% u5 b, f& S' X: {+ X
- //{{AFX_MSG_MAP(CDatabase_main)
9 [9 W- t: c1 R3 i6 I: x2 N- }- f
, C, m( ~$ H1 e6 _, F- ON_WM_DESTROY()
2 d% q, Q& y7 j0 u8 m- A: v( w( }1 }
`9 w1 r( D& q" a$ \- //}}AFX_MSG_MAP
& z' X! j+ C0 r' [ - 8 e: |: e/ B7 U3 W
- END_MESSAGE_MAP()
- U. \. _/ j0 D5 K, x0 W9 ^ - , V7 G4 B2 T, F9 G9 T. I# v* p
- / H+ K. f+ d }8 H+ o
- 9 u8 U' h1 c( E6 Y
- // CDatabase_main message handlers$ R5 t- J3 Z. b. s0 Q
# Z" _8 u! k2 c& v' R1 @- e- BOOL CDatabase_main::OnInitDialog()
) S$ k6 G5 A% C" z0 i# u2 C - ' ~& `5 O2 }$ a$ n3 H6 A3 i
- {- G$ ]" w0 {+ m. l$ T$ M, R
- d9 d! m3 W' j7 l& v1 c- W* T8 h7 l
- CDialog::OnInitDialog();1 }; V3 u& v2 E: [
5 f1 x' ~1 e- Z- X- 3 M* r0 U% H& @
7 z; k, v/ v: t2 N9 i G8 {- // TODO: Add extra initialization here
y1 h" a7 C+ c" R; o7 Z% l
8 z5 Z0 \* m3 B$ e- try{
' x0 ?/ o1 M2 A) y
1 i& E! h4 S7 `3 E9 ]) p- m_pdatabase=new CDatabase();/ O0 P0 g" R, x+ ~! a3 B
9 B0 X4 @: i& P6 P6 \- m_pset=new CRecordset();
; s" K+ H5 b0 H( C - 3 X9 K+ p b2 z) W* i1 n5 e m
- m_pdatabase->Open(_T("data"),FALSE,FALSE,_T("ODBC;DSN=data"),FALSE);/ J+ s+ Q% b1 R! d* i4 y
' K# o7 a3 B+ T- m_pset->m_pDatabase=m_pdatabase; . D# Q) o* E/ ]0 F# n {
- @& r! Y" Q- O, n, P/ e( `" t- }9 C0 V, s% D( _
7 `8 C1 f; s) i8 W; ~$ {- catch(CDBException* e){
1 W) Y3 t4 D& \5 b# t
( d- [* T4 p% s- e->ReportError();
$ n# _8 A4 \: h/ E) G# o - . L9 P8 l) h( C
- e->Delete();
$ n( ~+ I6 N& h; g; Z2 i: @$ n
) I8 w% e! b3 x9 b" o- delete m_pset;8 h0 N! g8 q& G: K
7 B' _% l5 z: E5 n2 X, {- delete m_pdatabase;
- d/ i& L4 `- F @ u+ ?2 d
! T# W1 A9 F3 W8 P9 Q- s* C- return TRUE;}
6 r/ \) x$ A% B( @ - 3 q7 z/ j* l, m" i4 P/ q
- DataShow("data1");
# X1 f. r; O6 H5 e! i( _
+ g1 i4 @' p8 [/ W- G+ v# a( N- return TRUE; // return TRUE unless you set the focus to a control$ S6 `/ |! }$ `( P4 o9 |; u, I
$ i% k3 F2 E5 S8 A/ A, p- // EXCEPTION: OCX Property Pages should return FALSE. v: b' g; u+ Q
- 5 I @+ v% W# ]7 I6 j+ i
- }& I) N& r( S }6 G0 [% N3 w4 M
f% T; ~* ?6 H; X3 P3 _- void CDatabase_main::ClearList()$ A0 j9 X( V6 @4 I. E* D# ^: ~. B
# ^. N+ k) Z1 q8 V1 t- {, V+ ` Q8 G3 L+ z4 D
1 @) r; x( t3 f' U g5 v- //m_list_control.SetExtendedStyle(LVS_EX_FULLROWSELECT);* J' f T6 o: e0 ?- i
- , a, K7 F8 X) w& H4 ~! s
- //m_list_control.SetExtendedStyle(LVS_EX_GRIDLINES);
4 \5 m/ ?1 J( o( E" P7 p - 2 O; b3 J5 P' W$ b6 y2 N
- m_list_control.DeleteAllItems();7 \. s l6 U% y8 l. U
- ; y9 p0 f+ l' Q$ M# S, e
- while(m_list_control.DeleteColumn(0));
. z6 X( K+ Z2 B5 T; z - 8 y6 ?6 X% c* m$ w y D
- UpdateWindow();
' p( k, J8 K1 Z/ T' x- f5 V
' _) W/ c3 V! T5 k+ J% N- }
7 [ R+ g& {7 d7 t. A. I4 C0 R6 {
* M g7 V, ~5 S5 y5 Q# J" P- void CDatabase_main::DataShow(CString table_name)0 l1 h3 V9 }" {, \) N, r
- 3 S( \" C* D$ {+ ~5 S* j O6 x8 y
- {
" @; ^- Y; f, I8 I, | - / u3 U+ D4 r: W" v, L3 L
- ClearList();
6 Y( o$ |+ l8 n' o) O( e8 g2 b1 { - / G1 k1 r3 P( X& W4 B8 Z9 G
- CString strSQL; z% B7 w5 ]0 o: Y/ J
; A. u- v9 T3 D# J4 l! t- strSQL="select * from "+table_name;
$ e# T1 N' Q6 j" b! i3 K& v: h- B
! ^1 T4 p& p' N9 v& r- ShowInformation(strSQL);
! z& T1 D: y1 z- M8 y" T
: Z- y# ]* q( d: D- }' @ [8 o3 G4 U) M
- ( M8 {+ y/ c( ?" ]5 a( X4 \
-
6 ?7 {$ `% R* q- T+ q/ B1 k
! G3 l/ i4 u+ U* j$ v- BOOL CDatabase_main::ShowInformation(CString strSQL)- W4 x( L0 R( s% e0 _% ~% s
- 3 y* l' \/ t' e4 c
- {
. @( k6 c# t8 ^ - Z! f5 W& Q1 ^, [9 o
- if(!m_pdatabase->IsOpen()) return FALSE;' S! L/ x) _# r" r; A( h- J( M
- ( t( S* b: d8 G+ }# L& Y
- if(!m_pset) return FALSE;
9 I. Y' Z7 W2 w7 q - # z) R) m) _, {. n
- try{5 B5 e* n: h0 X" k1 A
% n1 N% N8 O; e2 t: J" C! k- BeginWaitCursor();
6 H' ~1 X$ Q$ ^. x) A" P
6 c( h- V6 n$ K6 e4 X/ J& |' ^- if(m_pset->IsOpen()) m_pset->Close();" K" j; k& A( Z5 l+ l6 m2 S
- 0 J$ t( ]7 P5 z( k) V
- m_pset->Open(CRecordset::dynaset,strSQL);# Y* r8 X! x$ w
4 s U. |3 R. a: y- if(!m_pset->IsEOF())- |5 n1 H( x- `& l4 y5 Y
- - F$ X2 L2 w7 \& s& T7 _1 @
- {m_pset->MoveLast();
& E2 C% f! N+ K
; s1 f+ w; z% @/ s1 ?6 {6 X- m_pset->MoveFirst();}
5 N8 b6 I+ A- }$ M0 N8 n1 f
% ]) o. h4 }! }$ w2 P6 S9 P- nFieldCount=m_pset->GetODBCFieldCount();1 ]" ~7 q2 G) r( `
% U& ?8 i) w7 T! R- CODBCFieldInfo fieldinfo;. t, z Y3 k$ I8 X' Y& d
3 w7 S1 o; f L0 f a( G+ D- for(int n=0;n<nFieldCount;n++){
3 u1 J& C0 G2 r* R - ! E# Y6 ?- M: K1 Z
- m_pset->GetODBCFieldInfo(n,fieldinfo);0 j& _% F) B- ?/ ]7 Z% B
" H+ I) Y( }% F8 Q! w& b/ S- int nWidth=m_list_control.GetStringWidth(fieldinfo.m_strName)+35;2 a9 P- X/ U( ?7 D
- 4 i4 }2 N' A! C6 e
- m_list_control.InsertColumn(n,fieldinfo.m_strName,LVCFMT_RIGHT,nWidth);
( E8 L: x! k8 F1 V - 2 R2 K1 J4 o7 m0 H+ P& \
- }
& x0 {6 G4 A: d+ E: r - 6 {' F6 v* P3 W& M# U# y+ }$ N
- CString strValue;
' n. d p0 n! v - $ q. Z1 z8 {# i: x, }1 F
- m_pset->MoveFirst();/ {4 A* o$ E" h0 m: I ^. b
! V+ N' T0 }" l0 e; A+ S- int nCount=0;4 Q9 Y9 @/ h2 l+ `+ T7 S* }/ t
$ O7 M, E3 U) ]9 c% h- while(!m_pset->IsEOF()){: _& l& o. ]/ y! O
- W; P3 z7 m1 Y0 @
- m_list_control.InsertItem(nCount,strValue);
% o& N4 j1 R' [- i. L - 5 n* y2 [# i: ?2 s, v
- for(int j=0;j<nFieldCount;j++){' u) p; c- h0 O% f
- ) Z& M# D$ S( z) J7 k
- m_pset->GetFieldValue(j,strValue);5 w" s; j- K B* D: F' ?; Z, u$ s
- ' m, b* X8 M5 v- D6 d, a
- m_list_control.SetItemText(nCount,j,strValue);
9 v, S- y2 g y1 g3 N$ T N% C - " ~6 z p1 M) y2 x- `
- }
$ o2 X+ c, F4 t! G! ?4 v5 `
7 p! n' Z. J+ n5 a& k3 E- m_pset->MoveNext();
# |7 W7 L3 T) a$ i - " c; Z/ [! [& R6 t
- nCount++;
3 E+ O+ X* c V3 V' Q! \ - 4 l" r( i2 o" f: ^5 ?6 R
- }
" ]# S1 P- Q+ v) ?, F) `, i) B# `1 j - : M- x9 l& X4 Q1 x# {2 B
- EndWaitCursor();
( E. O2 j0 O8 j: m; c
$ J% R1 p2 C6 {- }
# } ~/ _* W4 P8 J# g- d+ m - 9 i* H& `5 ^% _! V
- catch(CDBException *e){( e: D8 R) Y5 N0 B# [
& x" x- J/ i4 I: Y/ P' r5 h- Y0 S- e->Delete();
- l8 c. [3 m5 p: Y8 L% ] - $ s4 d. q6 k w' K4 _
- EndWaitCursor();8 t9 ]4 i, C1 h7 }, w; \: e
3 X: O# ], ~3 I0 a1 Z3 y- return FALSE;
0 b/ f6 A1 K; f7 G, C9 d$ w- z0 F - # K/ _3 E% B" |: I! F
- }
7 z6 M1 u |, M) [2 ~4 x - + t' w2 t1 r8 } q
- return TRUE;5 _2 T+ |9 D- |# }& L
- & t- d" }9 u: b; ~2 o
- }. G. N+ K) q1 y! _
% [0 l, L8 F, }( L. M& B- 6 m: l; e! e7 q! \+ H
- 6 T+ C$ S O4 t
- void CDatabase_main::OnDestroy()
9 j8 R: m3 @7 i- d
" S! a4 Z1 o: R- {
# s) z2 W' Q6 G' a; C - 3 f4 l3 m" S8 j' x
- CDialog::OnDestroy();* A" {2 K3 s& r4 H' a
l f9 _! X d/ U- + M) ]6 X. ~1 T. f6 _# i2 D4 |4 b
- K' [$ J9 K; m: l7 O/ W- // TODO: Add your message handler code here. {) ~1 {: ^7 O0 {$ \/ G8 _2 j/ e' I
- , _; d- c1 V N" X; |7 M1 g
- delete m_pset;
$ o2 W8 L7 U& ]; r6 e
& P: p: `3 l* W9 s8 Z- delete m_pdatabase;/ G a# N) _# E# K9 w
- 6 R, O( b( \5 m' B* f3 P
- }/ Q& S* m# n; O! f+ ^& T3 Z
. a) ~: z; e: s0 F1 {5 A-
" b5 x) }8 G# d, s! B& e
( W# l0 f- s& H- extern CString str[6];
/ n! i) h) l2 f
8 j% _# E. O0 z6 X. o- z# z- void CDatabase_main::OnOK()& P# W. ?0 T& E+ F$ T" u: w
- ) D! @, S. ~ V4 {0 X j
- {: p k# M" R9 m; ?4 N* @' X
. Q: T0 I' O A6 h- // TODO: Add extra validation here' e, X+ M8 A v4 ~
- . }+ D8 {' \/ }: i5 j
- UINT uSelectedCount=m_list_control.GetSelectedCount();
' i) j8 Y7 P* D$ _' b - 0 t( |$ X# ~" `
- if(uSelectedCount>1||uSelectedCount==0)2 y% |* F W b5 m4 |& `
- e! M1 H; X! j* O, k' g1 o- {
& M$ N: p: x E- |* n
4 F; ~( }/ p$ ^0 ~- if(uSelectedCount==0)
) N# H, l4 X4 v9 q3 E7 X - ; l1 O+ f" U% ]7 X: U! I1 ?
- {
+ h) o/ c* X) q# c! D3 ] r - 6 j6 L$ L! B" j
- MessageBox("要选择一条参数!","提示",MB_ICONWARNING+MB_OK);
! S1 W, o' g+ B+ g6 J% i8 e7 ~! x
( @: C/ G! `1 S. ^( U7 P/ |- return;/ s4 x0 S9 |" d0 a# S2 M+ Z
# g- j) n w) G' x# d- } s# R) Z6 h/ n0 T
- 5 p" Z( R+ r7 t2 ]7 T y2 [/ g
- if(uSelectedCount>1)
5 n' }8 A6 N" F- l
( r8 \2 x% E$ h7 c: @- {
1 _8 J2 P& ]# w
* r2 d) b4 x1 H# D; B! V/ {, d- MessageBox("只能选择一条参数!","提示",MB_ICONWARNING+MB_OK);3 v' W! T2 O$ |
- ' Y) \" l/ f% `$ v% K* x& T# T
- return;, m3 C' O8 z' o+ ^ Q
- ! ]- g+ M; K9 S% i* d7 f( ~
- }1 k4 X1 k2 Z8 L" b7 m! d
- , T7 y7 v4 Z. J$ G# S
- }
- v# Y" |! }* o+ f
% l( k# F" P: U7 p- z& c( K- else
: i; \' v. {9 J. b+ f* Y
/ n; B- x8 w& b9 N( }1 X6 v5 r- {
$ S/ X# i3 X( C6 M7 m7 @ R
' x# W( W6 \7 r. T# U- S, l! _- int nItemSel=0;
# k( y T* i& B1 p- t: Y% p
% P- n( s9 k9 T* f7 } g- nItemSel=m_list_control.GetNextItem(nItemSel-1,LVNI_SELECTED);
# l. e# {4 N5 {' k. b; y, t - ! m( R: ]- d, d& `* ~; Q$ W4 u
- for(int j=0;j<nFieldCount;j++)
2 |+ W* W+ d/ z/ O9 R. Z& @
[" R" A3 {9 K$ M) I, ?- l- str[j]=m_list_control.GetItemText(nItemSel,j);
- f! f/ ]; x! a- e7 e
+ i$ r3 r) I: f! e& A3 W3 k) Z7 N- }% c' }4 Y6 k) y
- # a! [* K2 Z1 o) @0 ]) S# C8 x9 B
- CDialog::OnOK();
. P R2 Y7 Y. a% I. W+ x& L6 w - 0 N: K9 w4 T* M6 k
- }
( |7 O! u6 h0 R5 l4 q
}% C& Y ~3 E8 R- 6 ]" r; |3 O) n: p9 @3 d* [& I+ g
- % D5 l* J* ]* A0 [& ~
- $ O8 b: ^% ?) B8 I0 B- `
1 h. U, f& l( _: M8 g-
( `- O1 Q/ q0 s! Z" p' q. z
% A$ P! U5 m4 \/ p( I* i; ^- 花键轴数据库的连接程序app.cpp
) c1 B% A9 j9 P k+ b - 8 Q' ]3 F; C7 P+ x. M w8 k: T
- * j& E: ^5 V! H3 P9 | Q4 b
- & n) t$ c# j. _. n! P R
- #include <stdio.h>
) M+ s9 ^; _8 b2 l% h
1 g; Q" M+ f0 b1 x- #include <uf.h>
& R( n- O" c' g* o+ L8 S* { - 8 r, D& F1 B, R4 M5 ~) M
- #include <uf_defs.h>6 f$ B5 p3 @+ p# g
1 x9 a- {: d; \$ z; g- #include <uf_exit.h>3 L" v& @* H) \: \
; |# n: g, p7 u- #include <uf_ui.h>% U4 U7 U( E* s0 c
; Y% a/ E5 o( f( Q- #include <uf_styler.h>5 Q1 Z/ ?- f% Z% a' I; ?* N
- j3 H- D+ z) y! _- #include <uf_mb.h>
6 S$ S& v) f' P) e9 ^$ s& M( t4 l - 6 O7 g) i' v; V5 e
- #include <stdlib.h>2 g5 T& H! S* r* E J2 F6 t) A
3 i- S% ?' r) @1 d% Q( E* n( c- #include <uf_modl_expressions.h>
9 V) \' j* l" B+ `- L4 l# H
" [* i- _% ~# O- #include <uf_part.h># j3 U2 h8 l0 G9 i1 U3 }8 z. c; P5 A
- 2 ]4 B M( n9 j) d5 F" U1 b
- #include <uf_modl.h>* v" b% S& ?5 w0 Z& w( m$ S$ d; u7 M1 B
. c4 }% q/ s% r9 V" |4 `- #include <uf_assem.h>
% Q, p2 R+ V8 Y" }2 Z( r - / j( v" ~$ Z' c& @
- #include <math.h>, v5 T7 B7 Q% t
- ; Q0 Z( w1 X E3 X0 S' m+ V) g
- #include "app.h"/ I: `: r3 l4 G6 J" d
' I& ^3 Y+ U4 e/ h- /* The following definition defines the number of callback entries */3 K, K, l. A. g# [: a
" L- E" Y5 h* |+ O" Z' l- /* in the callback structure: */4 M: N5 F* a8 T1 I6 N5 j9 r5 u# f4 \8 O
- 7 ?) ^+ p8 I. I9 A$ z! Q
- /* UF_STYLER_callback_info_t APP_cbs */
, N9 P/ l, t, G4 I8 L
% |9 }6 t. S: A5 C- #define APP_CB_COUNT ( 6 + 1 ) /* Add 1 for the terminator */
0 Y- E/ Z# |3 X, P# N9 W - . S: H2 n" `7 f/ `
- extern "C" DllExport bool para_database_func(void *str_mid);. X! P1 f& N' {( d2 T
- E+ w0 ?1 l$ H
- UF_STYLER_item_value_type_t data[7];8 T4 n9 p5 |; q4 J6 M
' k5 t# h+ i: F1 {, E- static UF_STYLER_callback_info_t APP_cbs[APP_CB_COUNT] =
6 u* O9 V4 l* E/ { - ; e# g/ X8 o2 |1 U- }
- {; _5 z0 s1 X2 x6 u
- ; I2 k6 w3 x* d* L3 o2 r# o
- {UF_STYLER_DIALOG_INDEX, UF_STYLER_CONSTRUCTOR_CB , 0, APP_constructor_cb},
+ l+ r& X5 M9 T9 L
, ]$ ?9 H4 d, S: ^ f, {3 T6 L, h- {UF_STYLER_DIALOG_INDEX, UF_STYLER_DESTRUCTOR_CB , 0, APP_destructor_cb},4 K1 ?- r0 C- b, |& f# F
' A% ]: t0 M; e7 }7 F- {UF_STYLER_DIALOG_INDEX, UF_STYLER_OK_CB , 0, APP_ok_cb},
3 s0 Y/ b' x% x" f. U3 o
9 R ]" l( y/ D: g2 w* w- {UF_STYLER_DIALOG_INDEX, UF_STYLER_APPLY_CB , 0, APP_apply_cb},
3 C( r |! }# ?2 d
; A6 m9 ~1 v9 r- |- {UF_STYLER_DIALOG_INDEX, UF_STYLER_CANCEL_CB , 0, APP_cancel_cb},9 v( B% \0 L% [- S/ T- m
- 8 }' ?+ N/ b% M: y
- {APP_ACTION_DATA , UF_STYLER_ACTIVATE_CB , 0, APP_action_database},
4 H. R b# [. S% e
+ I6 F- G; @. _1 g: M. Z. q% A- {UF_STYLER_NULL_OBJECT, UF_STYLER_NO_CB, 0, 0 }
+ V. k) e' Y8 W4 _6 q/ b$ D) H - 9 [2 q! \+ G g: O7 H
- };
7 t* w" ^/ B+ F# h y - + [& v) k" o) ] ?2 h2 [
- 6 I( w% \: _7 i4 g; w4 ?+ r; n
d+ ~3 o: m/ J3 Z- static UF_MB_styler_actions_t actions[] = {: U; C1 W) q5 n5 c/ C: O4 O
- 2 V: q& V# f1 `
- { "app.dlg", NULL, APP_cbs, UF_MB_STYLER_IS_NOT_TOP },7 F1 e# D2 y7 v M9 h7 e
; o" [' m& g: y2 }1 w7 G# _- { NULL, NULL, NULL, 0 } /* This is a NULL terminated list */. {5 O7 e# j( @. U
- / q, V% W/ ?2 l4 H2 o* f" `) m; B
- };) Q+ P& H+ Y& ? J" R W2 ~
, h; R) A- f1 A' D& R s3 F' ~5 B- //#ifdef MENUBAR_COMMENTED_OUT
, I [% }# f' x; [. K' p/ X( b
1 f& v8 a+ K! j$ G6 Y- extern void ufsta (char *param, int *retcode, int rlen)
- Z/ t) t' ^0 i; ^ - 3 q4 q- x+ k, T, e9 A' V8 k
- {
# }1 K1 ?1 N& ?& ]; ^4 y - ) Y! o+ f, M; I2 V. S, _
- int error_code;
5 j6 R1 P( @, P% a - 4 Q1 ?/ [& X/ X! p# `# j3 i
-
6 f. ?( j+ N* m# K6 I( L7 z' Z - % x$ v q, V. z9 r# O1 V. n
- if ( (UF_initialize()) != 0)
# A0 Q) o: U" j6 u# E - & Q2 U$ H5 d+ H. ]/ @2 R( p
- return;
2 Q( ^& C u8 | l% D7 d5 {& f/ M; c
* u' w3 \0 ] }- K* N5 [- + i6 k: N0 R+ m, s3 `! D9 A. t- ~" c7 `0 V
- - A9 K+ a4 k+ ?4 D
- if ( (error_code = UF_MB_add_styler_actions ( actions ) ) != 0 )+ x- B1 z4 @7 v+ j, D3 {
- 2 ]1 i7 r- g, R9 R8 l% C3 N n
- {9 A% }. m* R+ b1 j& e0 h+ J' U
- ) X& ^0 ^ g6 W1 t. U7 a% ~6 x; e7 @
- char fail_message[133];& ^+ f1 }6 l6 T
- 2 B, W' X K) h. u1 I) ?, N2 Y
-
1 i; D t' Q$ R, T* ~" O; A5 {0 c6 ]
1 f. x4 W2 R5 }/ \- J- UF_get_fail_message(error_code, fail_message);
( Q" @: G8 j; w4 y8 r
' d2 ?( F9 { R3 ~: z A( B- printf ( "%s\n", fail_message );
6 h! C' ` l7 `, N5 Y4 N3 b - 7 M3 A% i- D4 R/ @5 I$ H
- }
" C; b, n+ s0 F7 P7 K5 s, Y' F
* j5 @ }4 u0 W# M! x- * A, Y S: ^6 w& C. p0 s
- 4 o+ G' K' M# j) S# u, @0 e
- UF_terminate();
' b9 b: r2 Y& E+ n8 |8 j
( t0 N0 P: ~" X3 g$ {: z, D0 ^; C- return;5 @1 Q$ c( K1 O: f( L( z/ {2 T
- ) ^/ L+ {4 n. U1 D6 _/ b
- }
9 h+ {8 `/ I8 B - 2 Y {) F' w( S$ T. b4 o
- //#endif /*MENUBAR_COMMENTED_OUT*/
0 x* z% I2 O) u4 f
& m0 ~' Z3 j; ^% E/ c# h' [& D& v- V-
?7 g' [0 ?& ^' |( x7 N* ~: _ - 0 A, u3 j; ^. d
- #ifdef DISPLAY_FROM_CALLBACK
) p4 u! C5 c6 c. P# E - ; {( P5 b' k1 L: v7 s) \
- extern int <enter the name of your function> ( int *response )6 |1 Y. V1 I q! J
* T4 u+ B, G: b. J1 e- {
' c3 n! W0 K# y- D$ F2 s4 k0 N1 w
' e, j8 S" `- J, H9 Y/ x- ^- int error_code = 0;4 j& |. {1 k0 ?2 e3 X
- / `! c9 z l3 j
- . I6 e2 h; F, j; D/ k/ n1 h
- " b! G1 Y2 W: Q1 R) E
- if ( ( error_code = UF_initialize() ) != 0 )3 k* v; N. |5 b
, J0 f6 e% i" a/ E2 N* k- return (0) ;
2 C: i+ y' J3 M y# g. j, z - ( Q0 L& _* E4 I
-
! V' f+ ~, b/ i M! M7 H( T |* [ - $ U, {! j' F, ^9 F; L
- if ( ( error_code = UF_STYLER_create_dialog ( "app.dlg",
; k5 C& M# ^/ f: n+ K - * l( V+ _: d. h- |7 E# |
- APP_cbs, /* Callbacks from dialog */6 R+ q" l/ C% r9 s
0 j: t& s$ P# t5 Q* B- APP_CB_COUNT, /* number of callbacks*/
5 w+ Q/ Z) `7 X' y4 N
3 M: c6 w+ y% D/ Z/ w F- NULL, /* This is your client data */
. q9 ` f- s4 T. T - - o$ f. L0 I% u$ _8 |
- response ) ) != 0 )
( R' P% e4 r% p+ E& ^ - % h# A) @+ N+ a: q+ h
- {
2 J T9 s8 e) n! O2 N) w
5 {, k2 ^, L3 ~7 o- {3 r, e- char fail_message[133];
! l9 u; x9 i) R - 0 S \; w' \+ \- l8 q6 p
-
2 y% {; R8 b/ U7 h
# E3 |! D) \, \% T! K6 K- /* Get the user function fail message based on the fail code.*/
1 @' y7 B5 g( x( G
- O- }1 a" o+ \- UF_get_fail_message(error_code, fail_message);
W+ m, a1 `- R% P8 V9 }
1 m0 W5 `- `0 I: o* T% J& w( X- UF_UI_set_status (fail_message);& d2 y/ k8 O5 O, w
- 9 c+ a8 Q9 Y6 L, D8 z% [
- printf ( "%s\n", fail_message );2 R9 Z$ d+ @5 l2 g, X8 _
- # F, i+ R9 |' _, M) G8 J
- }. ] G. S, G, m" h! V
8 Q3 M% c9 k) l" x6 A, g-
+ M, e& D {+ T2 k' s% A$ c# x' p
3 n# K& m$ n' s0 O4 Z- " Y: e% y j! B. Y7 k& A/ W
5 s$ x" D; u( ?; n' c- UF_terminate();
9 y& f* U* W: A0 L: w - 7 [+ w( Y+ t5 V, Z6 n7 j
- return (error_code);
9 E, m$ F, p/ f$ t4 q, g
; x: }4 x K2 r: ~+ t6 l- }) F4 d- {- M0 [0 L5 t
8 b, Q; c) C1 q b- #endif /* DISPLAY_FROM_CALLBACK */* q% _1 y9 G# O6 j5 F' ^
+ a P% _) \ T/ z- #ifdef DISPLAY_FROM_USER_EXIT4 D: E3 a7 Q- M; D$ L
: X2 I0 M. |/ ]) {6 v" D4 q- extern void <enter a valid user exit here> (char *param, int *retcode, int rlen)6 C1 W6 p D3 x1 p
3 ]2 [) s4 [5 T2 H9 X3 u3 L9 z- {4 {" Q% A0 i4 n3 \6 A9 G* U
; t) ^7 B; i% W- \- int response = 0;
. X0 Y% a ~: b6 z' D) {/ k7 U% H - . X% e2 b$ }: o
- int error_code = 0; k4 D! n! c$ Y5 U O n
3 [: S) i( C5 ?# O' v* w) T1 x- 9 L) _1 Z/ P$ i' o! E
6 z+ J4 S9 y( L5 }. m/ p- if ( ( UF_initialize() ) != 0 )
2 `8 O' p7 r* ]8 o; R - + [' G4 s8 x) ?1 Y& I [
- return;
" Q7 n, Q( n' r; X, [ ^* c
8 y5 b0 x5 R) ], }) B3 N* ~-
# v) W. @- o: E" S
+ J% U/ f, n4 T. w1 b- if ( ( error_code = UF_STYLER_create_dialog ( "app.dlg",
5 S4 R( v8 e$ B' k$ | - ' I6 X$ x$ b+ I1 |0 N5 v4 T+ z' o
- APP_cbs, /* Callbacks from dialog */
1 Q; r1 ^9 d5 O: q4 t8 F - - N6 X) g M! ]* T! z, ~
- APP_CB_COUNT, /* number of callbacks*/5 Z: K- ?, p L5 p
- x- C" L) R' u- NULL, /* This is your client data */
- y# Q5 ^) q) t) x+ X - 3 I8 o: ?. }+ X% |
- &response ) ) != 0 )
$ _3 H r, W: X6 a7 | t- t9 ~. l
& D! v+ I0 j$ \ n8 e2 A' V8 Y- {( G4 M! I" e' \+ L) g
- 9 N% o% N) U. ?; C+ ~
- char fail_message[133];9 N( \/ B7 `) F' u5 Y9 }2 U
- # J1 K% ?, k5 K. f0 I
- . {1 r, I; H2 n" c
- . j r: f7 d( V. t
- /* Get the user function fail message based on the fail code.*/
! ?9 E1 }: w4 E* P$ f( d5 ?
1 s! k# m6 P5 G& {' I3 d, i" R8 \- UF_get_fail_message(error_code, fail_message);2 K1 d3 n2 t& z" M$ ?
- r. n7 E+ _4 ?; l: `3 Q- UF_UI_set_status (fail_message);
1 a3 V! d9 Z) v& m# F
5 U" e2 E) s) N- printf ( "%s\n", fail_message );
( Y. a# F, S1 T; u
; H# _- B( C, y' A: I( L; c3 h* ~- }
: ?. ?8 P' x" }/ R( |
* E5 o# \. F0 ^$ `7 h& `& a- : Y6 K7 d! @( I( T3 M' J8 x
- . p2 d# ]8 [& n5 m. D: P
-
* _( |- Q# |4 c% g# g
. a( ]1 y8 g2 d- UF_terminate(); ; R8 g0 b9 v2 Z7 v
- 0 ]. }7 l' B s0 U! q5 T$ p: s
- return;
. H3 b9 j% J1 u2 x6 w
6 k3 _/ ~) r l/ f( b- }7 q, u+ U. J0 T6 O# ?+ R3 o
- . s) p$ f* \9 h3 x& b* z% n
-
# S5 p8 c( e* r! N- A, M# q9 |
1 x9 |1 q5 A# Q: [- extern int ufusr_ask_unload (void)
9 v- B) e& X9 j5 E7 D5 E' ~8 D/ l
4 `0 p/ o- h* f% }- {6 O! ]& r; W8 y8 }/ e8 o6 C1 f
- 5 o* L0 d( k# ]% h! l
- /* unload immediately after application exits*/' X7 d; }" `" u& Y7 B$ T. c$ i
- 9 K0 g7 U% d$ I" ^# q: U
- return ( UF_UNLOAD_IMMEDIATELY );
# e7 F% Q+ v& Z9 `! [ - / H4 t- Z) `1 r) b+ z
- % t" f: v' e0 K3 l }. s/ Z
0 y. m# i2 P9 G( ?- /*via the unload selection dialog... */
- x# I$ s' d- i9 p- r; n - * F a( @* |& Q! }5 z/ g/ z: y2 U
- /*return ( UF_UNLOAD_SEL_DIALOG ); */5 I; @) G7 L6 I8 U
- { Q2 y" _6 i
- /*when UG terminates... */
8 r4 F j c. G' n' F" @
4 [4 a4 v: g% j; v, S# v- /*return ( UF_UNLOAD_UG_TERMINATE ); */; X( U4 j0 ^8 x
- 0 v4 p+ N, K1 s
- }6 x: v7 l" p: {( u* J7 Y
9 v `( N9 V4 u" V1 b- extern void ufusr_cleanup (void)* x: I2 y3 I0 m! T
- 4 ~( s) h; B. g4 n/ M# K2 [2 |
- {1 ]3 H( h% X, b0 a8 T- Z
- " \9 I; D7 E8 }! Y- T
- return;
8 t3 ^8 T# Q$ C) w" ]+ S6 U( F/ h
) M3 J6 F- j0 k& \3 ^8 F- }
' l1 v. B9 N& N J7 g" Y5 ~
0 N- X3 N5 Y7 e/ \- #endif /* DISPLAY_FROM_USER_EXIT */1 e% M6 p+ ?3 [& O
- * r! j. a2 b" `4 n$ s5 o! _. h: Q
- int APP_constructor_cb ( int dialog_id,( i! a+ t( Y% }* M" ~1 \9 Q; E9 b
# j1 i# J. d% A/ b- K- void * client_data,
9 A0 _" ]8 X( Q - ; j0 g9 G7 p5 I* j, d
- UF_STYLER_item_value_type_p_t callback_data)
8 u a+ E' z! F0 u
3 K& {* @! w2 l' e- H( x6 n- {2 c. W% v% k, S0 P& q
. N3 h5 i5 U- n( ^$ h0 I9 F- if ( UF_initialize() != 0)
7 O) \$ ] a, F1 t7 I
* J& g* Z C" c% ]- return ( UF_UI_CB_CONTINUE_DIALOG );; B; g) q0 D- v
- + ?( }& t' b7 k8 E+ b/ \
- 0 `# t+ {2 q b2 ^) _, t
. ?) S3 C8 o- I- U4 g. E/ G% j-
0 M3 m8 j5 x, O0 t. w& F
2 H3 G7 n6 j A$ e( T( M* V+ `- UF_terminate ();
2 E3 e2 S3 O# d5 U0 ] - 7 e* y2 a( }9 h
-
1 d3 H$ H* K! |( b
* }/ C9 v8 Q; F7 O6 y2 k9 h' r$ H- /* Callback acknowledged, do not terminate dialog */
& W# N4 ?, R) `, Y3 M8 t7 b
+ h) j' q' l2 a; W7 f! N- return (UF_UI_CB_CONTINUE_DIALOG);
! W" w) m9 @! p+ ? - 6 h9 j7 I0 S! d4 C8 M( L! v
- /* A return value of UF_UI_CB_EXIT_DIALOG will not be accepted */
8 G" m4 X. u) V7 c' B; L. ?) `
, z3 F# |5 T5 H4 G9 t8 k% N- /* for this callback type. You must continue dialog construction.*/% f* Z: I; W9 }' z9 u+ @
- . G# d/ N7 N2 c2 V5 f- {# g
-
' \# A6 v' I- |
; Q' ^' I% M) A1 T- }
8 {4 D- F/ h8 I3 }0 {$ s
" c% J @: t C- Y" Q, ^% p2 j# }-
- k1 d1 H7 b9 m+ w, p2 F
: M- r8 O4 }7 C; E3 R- . F0 x" J, q1 \: P+ f( Z8 e: I1 e
- & t0 K" R" D9 V2 o
- /*
0 J, L: G2 q$ F - 0 V ?( T) X0 z- x
- int APP_destructor_cb ( int dialog_id,+ O+ {2 ` L! i% t! j* r5 e
- 8 V( [9 s3 \9 ?7 q' Q' \
- void * client_data,+ n$ \/ I, `/ }6 E; B
- % u+ G3 ]* j) s. p( C0 b4 p
- UF_STYLER_item_value_type_p_t callback_data)
7 N& |1 F& J$ W: P. ^( {: O6 j/ |
. ~1 `) n: J0 T. \- @, D3 U( O- {9 |% J: c/ o- N: ?; ~
- 7 L8 @ E$ `# y# d" ]
- /* Make sure User Function is available. */
# G/ I+ m; h: W! V6 s! O2 r
* B/ t* `8 W" t9 `; x/ \. G- if ( UF_initialize() != 0)* i1 y) S/ }' z/ n" u& N
* V4 L1 t5 ]+ j- return ( UF_UI_CB_CONTINUE_DIALOG );1 V" H: g- F) ~1 p
- & n6 f: M' }* m4 U( R y
-
! r4 f% v9 x, u1 j3 n2 b% |- I% b - ' P" k0 |6 m- R) J
- /* ---- Enter your callback code here ----- */
" q+ W9 l5 n) B( o. C$ G. H - 3 [; h, S4 E% c b" @+ }; W
- 7 ]% @2 ?. V1 c) G( e! ^& s
- ' [8 U& ^9 ?' E2 X3 p# r
- UF_terminate ();5 R6 X# I# {3 ?8 J/ f! [: D
- 1 T1 K: m. h. ~' h) J
-
% w: r# o3 {& ] i - ; U: N8 A0 Q) S, f8 i
- /* Callback acknowledged, do not terminate dialog. */( n7 n; Y9 ~2 x: k( U
: z( ]# c' K6 V$ k5 H/ ], N- /* A return value of UF_UI_CB_EXIT_DIALOG will not be accepted */! I2 K% o$ ^- Q( K/ F2 E# h
; H9 i5 B' k# U5 m& T$ O/ @6 Z9 P, P- /* for this callback type. You must continue dialog destruction*/
/ `: h6 W2 X3 B5 {/ e8 h/ ~: Q - 4 J" T( O: s1 m
- return (UF_UI_CB_CONTINUE_DIALOG);4 c7 V3 m0 \2 X/ W/ M$ }5 j2 A: O
- 8 A m% N: g5 t- G6 h0 R
- 8 F3 L9 l; z7 S) E! t: D' c
- 4 W0 h+ e$ Q( g" k) Y- A2 b# o
- }/ Y! `/ F& V+ X
$ B. E# m9 j; a# W2 B- # m% h! B( j J9 F* `+ G6 E7 y
- 5 ~5 k; N" z, R. ~7 S* j5 G
-
/ |+ X& m3 U/ X' N5 S
d2 p: c1 p8 @- int APP_ok_cb ( int dialog_id,
7 }+ _( }. H3 b) w* K
% R# c6 }+ B# p0 T/ c- void * client_data,% f8 c" l5 I* C
% O* d& ?9 P5 o+ m- UF_STYLER_item_value_type_p_t callback_data)
( r4 t. ?$ W- t/ _: i: }
: O2 R% \ m$ @# S6 _- {
4 Q& a" i' M( d2 z1 s% |+ b. I4 b6 @* C - 2 C5 S. S& T3 ^8 A1 F( V+ X
- /* Make sure User Function is available. */ 3 c4 ^: v' p) @0 C: b" v4 G, f4 b
- 7 z) |( K/ Q8 ]3 D' v
- if ( UF_initialize() != 0)0 s. a2 b: N: m2 E
" g1 U! j- R9 R" Z3 i; U9 K- return ( UF_UI_CB_CONTINUE_DIALOG );9 m9 F" K7 J* R4 B
* a7 p) q- Q+ ~9 H# _/ T2 D- + H3 ^$ q: n/ ?. G4 u8 L% ^, N0 W
- : U7 u' n6 s; t1 V& b2 K
- /* ---- Enter your callback code here ----- */
u* U, E0 U& ]( s* g; X
/ E& X" b9 k3 G! _- , w' V5 N9 j/ }- H
- , Z4 m7 E: K% s! B# G
- int i;
0 s1 D8 M' r$ }# w) Z3 X1 W
( t4 c$ B& j" B( v6 E- write_para(dialog_id);% S: p7 v; d3 _( Q# Y
8 ?; D! h+ b: q9 P3 z- const char env[255]="UGII_USER_DIR";; V a' h+ q+ H3 W4 m9 y$ {/ m
- _$ M' x) m% E5 S m
- char *basedir=NULL;
3 r9 p4 r# R3 p6 ]8 r
0 y+ m G1 b2 A- basedir=getenv(env);
+ A- a# Z9 G; u' `6 K" g - # E) C4 v7 u2 a2 y# `3 Q1 g
- 4 f. \: o- @' U5 L2 A: Z7 s, M
- 0 M0 {/ w! n8 y) z5 o
- char dir[100];- u; M: ]0 F7 T. j# }3 Y$ X
& o% Y, T0 C' B$ F- strcpy(dir,basedir);4 W& U" ^3 k8 I) I3 S" N
- 4 ^7 W! n# T4 k. M# R. z9 \+ c3 J+ ]
- strcat(dir,"\\grip\\huajianzhou.grx");
* I5 V- O2 h; P( d, E
0 U% n+ L. r0 j% n- * z# o( w/ ?+ h, G5 R
8 t9 G* H) ^) U, Z- char *grip_exe=dir;
0 ]5 \: V. C- p
2 W$ `+ ~+ \' h* d- int status;
l5 {, P9 U& q+ T3 `% a
( j6 j% K }: S6 u- int grip_arg_count=7; //参数个数
! `( \) v1 c0 d- ^! S - . ]( i3 f2 r' U& j7 b
- UF_args_t grip_arg_list[7];3 |' a1 ?- v4 r2 }
1 B8 D) `# ^( Z/ k# s- : C, q" i9 L* y& T" y/ |5 J
; q7 R+ t, e3 q: ?& M- grip_arg_list[0].type=UF_TYPE_DOUBLE;0 ?; p4 C. B( E: }$ E2 ^; P! S
- t2 E* v( K4 X- I2 i& G- grip_arg_list[0].length=0;
; k# Z1 |- u8 a% u - # e# E; v( v# }% c& ?4 g: G2 h! x! v/ G
- double fdat=data[0].value.integer;
& ]* H6 z' i ~5 S
! e, y6 t4 ~5 O5 Q- grip_arg_list[0].address=&fdat;
5 J1 L8 M% \4 f. W9 D8 p - # Y8 j+ _7 ?7 a4 A$ g( I1 h; {% K/ t' \) y
-
3 i: F, @% [* p- d- \4 E- D( Q! [$ o - : Z# t. I0 v$ w- K
- 8 w' X. a) W9 Q& J+ L1 s' {
- - m( Q1 {4 b6 `# u$ \/ X: w! f. k7 g
- for(i=1;i<7;i++); F, n! ]1 s- l" L d, p, Q
7 y7 |/ @# A0 @( [3 o: p- {
6 b R7 ~ v! Z; S" w
$ b" [* E! {2 T/ V0 A" s- grip_arg_list[i].type=UF_TYPE_DOUBLE;" M* Q7 [5 X3 |3 \' Z# N
2 {* y1 D5 X& `/ J0 |5 v4 D- grip_arg_list[i].length=0;
8 S& W& i3 r) w) O* {; }
+ N' \5 |* n2 M3 ]- grip_arg_list[i].address=&data[i].value.real;
/ S' a) \6 P8 o$ C# O# @ - ) { X* }( T" s& o$ g) x9 X% A9 {
- }/ H8 S% o" u" d1 I" S' M
- * M6 c4 \; Y+ ?, r5 Q* v7 ~4 b0 r
-
( W' h5 {* C9 X6 C
. ~6 G# q) z ?: }% j2 b/ f- status=UF_call_grip(grip_exe,grip_arg_count,grip_arg_list);; L2 d, Y7 y% ?4 m
- I' Q: g F8 `+ e g0 N
-
; U! q: U2 ~6 q$ |# p. c - + A0 S) |" S' [& O$ R
- UF_terminate ();- T/ K6 c& Y" a
% u! c3 l" y$ g-
* h8 f7 @; W1 H$ V - ) o- Y1 w \$ u$ l* Q: [
- /* Callback acknowledged, terminate dialog */
6 W- Y O1 A: q6 m
4 L& t$ m, @; n2 O- /* It is STRONGLY recommended that you exit your */
1 D! P- R3 D1 k' s - * q& x4 P* U3 L. h9 @
- /* callback with UF_UI_CB_EXIT_DIALOG in a ok callback.*/% X" F5 W7 V3 L, X- Y3 @
- : c9 K' h6 d% }% _7 H5 c
- /* return ( UF_UI_CB_EXIT_DIALOG ); */
l4 B' Y! f. W: }/ Y
6 e$ K! M4 Y3 ]/ [2 _% @' x+ Z- return (UF_UI_CB_EXIT_DIALOG); 1 o$ W H) e8 @9 _4 R! ^
2 ?0 b1 @" {; x, t0 ?0 _! i- 8 ]. M) D# ?2 S Y2 R
# O. j4 F1 X- l/ s+ P- }
/ y5 d3 M& Y; N! e) t& w- \ - 3 D \8 ^# R# o5 `1 _% n0 A
-
0 t- P/ v2 q% Z$ g* R
6 C, z: l' q B9 Z4 o-
4 S8 X" W% X; ~8 R$ ]
0 L$ ~3 E# l9 s6 k6 J y7 v- int APP_apply_cb ( int dialog_id,6 C! T- ~" q" E. {7 J8 a* ^) C
, U. i. I; ]! \; Q- void * client_data,
B' y4 ?- u) G3 Q& h6 R - 2 \. G8 G+ {% T: @4 q- d- `
- UF_STYLER_item_value_type_p_t callback_data)
. `& E6 A2 j; d
' k4 F! n# Z! ?9 v- {
3 P1 v: T5 k% b* ^, | - . f! S) Z! X/ l Q
- /* Make sure User Function is available. */ 0 T' u J1 Z! A; V% \9 j
4 \1 W K2 j! f7 t% X- if ( UF_initialize() != 0)/ B# |% s+ W& n) S) l. h& Q
- ! N/ X/ w$ J2 k9 ]2 b
- return ( UF_UI_CB_CONTINUE_DIALOG );
d( b" W, z2 z0 ~ D# y. D( O - 5 K0 v7 m# N6 T, _# p+ P2 c
- , k4 t. `: ~: |" Y( m" K+ f! i
) L# B0 N, O9 _- q- /* ---- Enter your callback code here ----- */
5 D8 ?8 o8 Y0 p2 N
1 `+ N2 X0 [" O" |! U- int i;
/ F* m K+ k6 E; s, S( Y - ! D% K ~/ x3 A0 I
- write_para(dialog_id);
. c% S2 L/ c2 v. l1 Z; U
( ^3 @3 A& X2 f- const char env[255]="UGII_USER_DIR";
+ ^$ o1 n7 _8 o4 J - , L. a+ | H3 u z' W
- char *basedir=NULL;; ^) z2 @* R% t( [ r( N
- " P( _/ M, q8 b" w$ M# v
- basedir=getenv(env);! J% Q2 ]! @8 E
# j2 f+ a# H* ?& |-
: P& S8 K1 N* S! E/ g i) z - ! G& k" f4 A% W8 U
- char dir[100];
# c9 d( k) c" o: i" S% p& s5 |3 V - # A( B+ o1 |8 p) g7 n
- strcpy(dir,basedir);
, x" t$ n! b/ e9 I* e3 z - , v# n' E1 ~( m% t7 x1 e
- strcat(dir,"\\grip\\huajianzhou.grx");
9 N; L( d; T2 s' i: J: Z - ( V8 B0 N$ V8 z3 p6 H$ L) w5 B6 o
-
2 s+ }7 K/ ]! a$ \* S' [% j9 y& m; n9 T# Z - r% y- k% z1 x0 {- Z0 F
- char *grip_exe=dir;( s, ~$ k. H' m0 E$ L
- 2 T: Y- c6 t! I' u& G- Y
- int status;0 N( H: V6 n. v I6 G
- 0 [# p" d9 B0 T3 z2 B2 [
- int grip_arg_count=7; //参数个数
* K" D( L' y- _ o( t, _ - 9 @# l) r8 ?! y8 o( Q+ j! C, ]0 F
- UF_args_t grip_arg_list[7];6 W1 m3 B4 g! I& n# O* M
- 8 c( A, M1 ~, e5 k5 s& B+ z+ Q4 ]
-
8 d4 `5 P6 b8 f, Q* \) g( z - 3 `2 w7 F$ @6 K$ w+ s( i& C
- grip_arg_list[0].type=UF_TYPE_DOUBLE;
/ t9 O; d) A. v. v- a/ |2 F
F0 U9 O0 y3 c" w% ?) J, E- grip_arg_list[0].length=0;. H$ z; p! G. ~/ @3 r
) O* A4 I4 e* B, u: U# j+ C9 Y- double fdat=data[0].value.integer;
& Q) b5 I+ B. H- m7 j4 ], k
" ?9 G: w3 e6 U- u- W- grip_arg_list[0].address=&fdat;9 t9 [3 g/ H5 J! ?6 ~) u
% q( ]7 H$ d' h/ {1 Q-
/ X& Q+ C8 }7 ~1 }6 a: F/ H - & P5 U' c& W. v# L
-
# c! i+ F4 C9 ^9 p% F - 5 f/ A2 n) a& h: N+ o
- for(i=1;i<7;i++)! F. @, W8 i; V7 O, N: e6 q
3 z; l; i$ o! i+ p7 R7 `' s# K- {
+ m" _' K- ]4 @+ P' g
* P. _ k8 b2 ?$ [" t- grip_arg_list[i].type=UF_TYPE_DOUBLE;6 b3 ^! J1 f& I7 o/ p
- 4 y% k6 m, R! g6 ]8 X' f. h
- grip_arg_list[i].length=0;
. V9 q/ F4 H+ O! t/ V - d q. N4 ~$ r6 N
- grip_arg_list[i].address=&data[i].value.real;
6 m5 f( }% o" E% i
2 M- F5 j$ ^* H& j3 @ J: I- }0 V& T8 @# q7 K' [! w
* Y; x4 A5 s2 J- x-
! s9 I' T# Z& B) b - $ W& F1 P+ c5 [5 q" ]
- status=UF_call_grip(grip_exe,grip_arg_count,grip_arg_list);
; J: l6 U) Q& n+ d# r
4 I6 s/ @7 Q8 R! B- % |$ {( F# ~, k" e
% E* ?) m, ~5 b/ N9 m' e- UF_terminate ();
* a5 r( Y" [/ I' b5 M5 T7 X3 r
/ X1 I ^7 ~9 Q0 w- " T3 A B& I$ E
6 S8 j" X1 j/ O+ q2 X# k% Y$ j- /* Callback acknowledged, do not terminate dialog */
" R5 l z9 o) V3 w$ g( u H) ] - 8 m3 O/ v0 m3 H
- /* A return value of UF_UI_CB_EXIT_DIALOG will not be accepted */8 ~) _0 H3 t' Z4 t0 x4 x
9 i" g, A" \* q- /* for this callback type. You must respond to your apply button.*/' l8 B' q; k; Z9 `. M( V
. S( t3 s" v" i( t3 ]- return (UF_UI_CB_CONTINUE_DIALOG);
% @: f1 `: H8 v% D
7 j5 G6 B- ?( g" W& C1 o- 9 E3 O* _7 z4 ^2 K& [% x2 r
( k; P7 Z9 }; k6 h1 y- }# R6 U4 m: z% A# Y B7 T1 ]
- ; n. `7 A$ ~& T- o) y' ^
- void write_para(int dialog_id)
8 S4 q6 @* |, j2 ^, t- T4 @) p0 ~" S: L- u
" t. U- D( m& a- n- {5 i6 o j. H/ M0 {* Z' d
# l+ T" Y6 n! j4 g w8 d- data[0].item_attr=UF_STYLER_VALUE;: l; P; U3 {! @$ t3 Y: D
! _5 W6 \* g& k3 v9 N- data[0].item_id=APP_INT_N;
% ~3 ]9 A) q# `
3 a: s$ N1 ]/ s* D- UF_STYLER_ask_value(dialog_id,&data[0]);1 O& r, W" r" b4 p4 R* N6 U
3 h6 s+ |% s) C+ H2 r2 b, |; ?( G-
* @5 h! j `3 a
% ~- @ e" _+ n: R; Z- data[1].item_attr=UF_STYLER_VALUE;8 T# A# I/ g: q" C3 ~' \
- 4 Q) d" |0 F/ ~8 t. Z& [5 Q
- data[1].item_id=APP_REAL_D1;$ e( L+ P/ n3 N- D/ u& z5 {& p4 R
' ^* J& g4 F) }; c5 u. t5 u- UF_STYLER_ask_value(dialog_id,&data[1]);: q+ a; Q! r) [+ m+ M( a
- ) m: j5 `3 s; h7 R. B7 h% B% @
-
% A/ S* J# i. K6 m+ v5 a
4 W. z9 X, F/ |1 s$ {-
m5 f8 e% }' Q7 ~1 X% B
+ q6 k+ c) c- D: r0 n' I$ c- data[2].item_attr=UF_STYLER_VALUE;9 o" H( v, V; D2 X
- & ?: A2 c8 S2 P, e8 n1 |. ]
- data[2].item_id=APP_REAL_D2;
+ b+ @: ^" n# u) d
3 Z" A4 R# {" U2 D F( \# |: |- UF_STYLER_ask_value(dialog_id,&data[2]);
|0 S* k- z/ a$ O2 i
' B) o6 t `1 u1 ^) J6 ^- % B5 e3 E8 k- A4 c$ j8 a& c% s
- - N% e( O0 n7 } X8 j7 C! n" Y
- data[3].item_attr=UF_STYLER_VALUE;( j# P" P- d4 G& U U( O7 h
7 L8 n. p- i# |5 _* `$ S- data[3].item_id=APP_REAL_W;
: r# K7 ^) e% H Y6 i$ a - - ~8 b$ l& R6 I2 j! c( ~! G
- UF_STYLER_ask_value(dialog_id,&data[3]);5 i# ?& K. @* A' O5 x3 I
- ; x! o6 G! z. ?8 ^* }2 p
-
8 _2 I: N( I9 W8 M2 d - # I/ J) ~4 s4 u4 f5 p- B
- data[4].item_attr=UF_STYLER_VALUE;
% P) l6 u0 s" [6 ]2 P0 j - - N% J ~4 v) S, z+ _* R# r
- data[4].item_id=APP_REAL_K;
0 h! B8 F& Y: A: |2 u/ b$ `* a* F. m - . l, |) `* [+ K- P2 Y( |9 L* }3 [, [
- UF_STYLER_ask_value(dialog_id,&data[4]);6 D. c' F+ A+ O! W3 s, P
- , E" f! y; @# Q8 I# W
- data[5].item_attr=UF_STYLER_VALUE;. w* c. n6 ]& J& f: r/ e9 N6 b
- 8 ^5 T1 f/ k& h2 T- X% [( n
- data[5].item_id=APP_REAL_L;
. T( H/ Z* D9 ~, h# c. p# O - ! `' Z8 M3 a" c4 W0 E, h
- UF_STYLER_ask_value(dialog_id,&data[5]);& P9 l1 Q: Y/ Z) F4 T! {% I
- 3 h6 Y3 g! ~+ M% E6 P/ h
- 6 u7 K# ?3 B& E; ^, ~. O
# b1 o9 p5 f3 b7 e& D% j- data[6].item_attr=UF_STYLER_VALUE;
' p% M: \" }" ~6 ]( h1 j - + r1 T' a) w, ^5 I
- data[6].item_id=APP_REAL_LL;6 n4 d) y3 o/ N' N1 e5 r: S
F" x. B+ z8 v6 m! t- UF_STYLER_ask_value(dialog_id,&data[6]);, g3 z2 ?+ S5 y% j6 C. h7 m$ g" }
- / l0 c) D- ]* A. r0 t/ Q5 A0 n
- }
1 A s; \: P. g
- {6 ~9 k6 |; I1 s, J# Z-
! y2 P- H) F$ X* `# H3 y - - d& ~/ N$ w3 [0 J. {) U4 J2 h+ ?
- /*/ X% j3 V. }% ^; s% U
- 3 d! x# T/ W) {! l0 u2 z- E
- int APP_cancel_cb ( int dialog_id,
- f4 O& J9 M. y/ M( T - 8 \$ z1 A7 S: O( F* R$ N" \
- void * client_data,
, R( X M; l# G# @$ L3 F; X% }
) o( X; B% L( h2 R7 |; \- UF_STYLER_item_value_type_p_t callback_data), a0 ?8 ~5 K" E1 E
) g& \! c% n; b4 b6 U U- {/ _* \# Q$ L- D& @* j$ a
, q4 S9 q$ j2 L: H4 V9 H6 B7 i- /* Make sure User Function is available. */
0 \' A8 l$ d, d: @
v3 |* i3 m G, D' a% S p& m- if ( UF_initialize() != 0)" Q9 x" q' K4 Y. E9 B
- 3 n U5 C B, |! A, Q* T T
- return ( UF_UI_CB_CONTINUE_DIALOG );) `* u& J& C; w5 \7 x6 `2 y
' ^/ A7 _/ L0 J7 z- ! o) {) K5 {2 G4 B' |
3 `; e7 R4 p( w: S- /* ---- Enter your callback code here ----- */
$ o8 V4 ~9 i" H9 F$ d5 y6 D, X - 4 Q) p& A7 Q( B" K, x
- 8 g$ `3 u" E7 Z; h c5 c
- ) y% ~8 |! Q+ D( I% C7 g8 \
- UF_terminate ();
; _5 V \/ s7 J5 j. G8 L - ) y$ _0 x! U, j% @ ~
-
. {( y" p$ |3 C& b4 t2 @8 P - + [$ }0 b2 k2 X$ o r( a k" G
- /* Callback acknowledged, terminate dialog */
- c; o d" Q' Y# N5 {: T9 {
. a* d/ j3 r; k9 t- /* It is STRONGLY recommended that you exit your */
% N! G( a4 p2 M7 N- Q2 h
7 u5 v1 o! P6 _* z7 k8 \- /* callback with UF_UI_CB_EXIT_DIALOG in a cancel call */
6 X' q, `+ h1 V2 U( E* f
, |. r( O& U; @6 J6 U- /* back rather than UF_UI_CB_CONTINUE_DIALOG. */
& t4 a( z2 F2 z: e% k9 ^7 ]
- E8 z- w/ ]3 k3 _3 F/ |- return ( UF_UI_CB_EXIT_DIALOG );
5 [8 W6 a0 B! h5 `, o - 9 A3 j3 N7 w( s1 b- |* ~7 V+ S1 j
- ' }& u: r8 H0 L: j, @2 w9 V0 z0 I
- / Y: w3 W8 |6 n
- }3 v( z' H: i: P( A- z; e3 `
- 3 _$ ^6 @. M8 D* @2 r6 ` e
-
# Y T u/ f y( n8 a - $ X6 j+ Z9 I. X- ~
-
6 Z- [% f' P. Z3 R - - r) j5 C4 a N
- /*9 u2 A* @: a5 ~' m
- 0 G e: _$ K9 y5 I. H
- void read_para_from_database(int dialog_id,void *str_mid)3 R; B! A* q! z8 r4 P4 A" `/ b4 f
% X/ ^3 ^0 f* `) d. o" C8 l- {
! R' \$ M9 `: T& ~& X' M5 T - - A+ @" ~4 G8 R3 X0 V P
- /* Make sure User Function is available. */3 m( T. W; ~! z
; n4 a2 N4 Y& ^8 f- /* ---- Enter your callback code here ----- */
R, \% t U: D1 H( z$ X
' D7 K7 c8 i1 W! x6 E, X- UF_STYLER_item_value_type_t data;
4 k A+ k, X8 X - / F& ^5 a- G+ N5 v/ s: X. E, r
- ) f0 a' C4 I* @' C' E# z7 m
0 H2 H! z0 Y1 Y) j- data.item_attr=UF_STYLER_VALUE;
8 i. j- X8 |4 B) H; A O- g! G - 1 E4 b: w% d1 x4 X2 S) X u9 z
- data.item_id=APP_REAL_D1;4 A; q3 Z0 M* {
- 9 l! n/ a$ z0 n; j( `- [
- data.value.real=atof(((char **)str_mid)[1]);' R. f: \+ k2 Y ]9 D
" v: V0 }, }, Y- ~2 l V6 x; W# ^% v- UF_STYLER_set_value(dialog_id,&data);% X5 b1 T0 e$ [* Z) d
- 1 ?- \8 ^9 l; p6 Y$ h. }8 Y
- UF_STYLER_free_value(&data); : X3 {) h! y$ C5 d: x" A$ z2 V
9 z% q. u( |$ s% t4 A( R- data.item_attr=UF_STYLER_VALUE;
' }( {1 ?3 t% G8 G3 } - 1 T7 m7 `/ o: e0 k. `4 g* [+ `8 T
- data.item_id=APP_REAL_D2;
}) j8 v& \+ l4 x2 O9 I! t - # x# G* G3 X8 {$ \: t4 g7 I
- data.value.real=atof(((char **)str_mid)[2]);/ {5 Y v- e9 Q
- + s( O/ G F& K3 s. Z) K
- UF_STYLER_set_value(dialog_id,&data);' U( t% K1 e3 N/ r
- ( J. X. S3 g8 p8 S! r2 }$ I
- UF_STYLER_free_value(&data);
6 a6 O$ U* ]! C3 f! H; Q2 u+ I
' H% Q g! K9 Y7 H/ {9 h3 P- data.item_attr=UF_STYLER_VALUE;; z7 i* f7 p! `8 D) g& |6 d% w
- 6 s% U0 U4 h9 N, E9 a
- data.item_id=APP_REAL_W;% E. M9 X5 e& E- N+ M
/ }: j# F4 ^7 o2 z+ n- data.value.real=atof(((char **)str_mid)[3]);
" T4 h# S) Q8 n
1 K5 E9 b$ g: |+ v0 m; K- UF_STYLER_set_value(dialog_id,&data);
" B+ e1 t0 Q3 L. [! W
5 C& c: t- z$ F- UF_STYLER_free_value(&data);
; M! \* R/ i& F7 B# a) ^ - ' h( } I/ ]+ @: W9 `8 B
- data.item_attr=UF_STYLER_VALUE;6 q& @* @* `2 w$ H- m. I
! ^6 `7 B6 W: G- data.item_id=APP_INT_N;
B0 G3 n, |; ~7 j+ S4 w" z$ P/ U - + q0 O( g6 a; B% S' V5 u, R# _
- data.value.integer=atof(((char **)str_mid)[4]);
; j- }6 b" T# X" [5 c
+ b7 L6 B) ~ Y7 f. f4 b j- UF_STYLER_set_value(dialog_id,&data);
" y4 k1 i9 d \0 Z - 6 T- Y) |4 ? q) l4 f' A7 H% R: k! \
- UF_STYLER_free_value(&data); ' o! @6 s9 B! y* f" h1 a) v
3 q8 | D- K3 v" L- data.item_attr=UF_STYLER_VALUE;
% F$ C3 K: ^5 [( ^7 R! `. O; z - . ?9 v. t. h- a( h& S F( W
- data.item_id=APP_REAL_L; [ M1 ]$ {- o, k
X, T' j, ?( N" T- data.value.real=atof(((char **)str_mid)[5]);4 t W! R; o; A" M
# D O4 p; d, H- UF_STYLER_set_value(dialog_id,&data);0 V) I: j5 m# c- H+ x
- ! U! z6 `/ K0 O' ]$ f
- UF_STYLER_free_value(&data); 6 i% V2 u$ `( r2 o
6 F6 r, k) W3 N* H5 e) J# }8 r; E) Q) [- data.item_attr=UF_STYLER_VALUE;
& P, Q: j9 P! e7 D5 f4 ^0 ~8 |# d
! @1 v. S* t' d2 v$ f- data.item_id=APP_REAL_K;
6 _; Y9 D; I/ T0 }
; K* ]: U( Y* C- data.value.real=atof(((char **)str_mid)[6]);9 H9 P6 Q! @+ E/ `+ C9 T% k
" c) I. i0 k) R( J/ V) \# m& K- UF_STYLER_set_value(dialog_id,&data);
' W0 n+ W7 A# s* r2 t& j - 6 T5 D3 e; e5 [6 }4 ^
- UF_STYLER_free_value(&data); ; O$ {7 o1 w$ o
; x9 e- J& T1 w2 ?- data.item_attr=UF_STYLER_VALUE;
/ o/ o% ?* }) C( Z2 [ - 6 b6 i5 C- A1 r1 r
- data.item_id=APP_REAL_LL;6 z' d4 k0 L) m) l0 B
: W8 D/ y& a M4 F7 T6 @- data.value.real=atof(((char **)str_mid)[7]);. Z2 Z6 y1 w$ f! m
7 M* s4 l$ J( g4 p) W" f8 l- UF_STYLER_set_value(dialog_id,&data);
* @: c* a8 J$ R' x# K) a: M( z, C
L% K8 Z- T9 J% T! q. f- UF_STYLER_free_value(&data); 7 Q* j: u4 x- l& I4 d! ]
- U0 k2 y- c) Q; V% \ h- }0 H4 Z/ H1 S$ u: K
- ( A: ^4 m1 e9 J. \
- # H, a- q: x" i/ h9 v2 Y; a2 ]
- : e$ O0 @4 i4 e+ @$ W$ ~) ^
- int APP_action_database ( int dialog_id,: Y) A. M7 p: o8 G
- ! k. N1 X2 L! @ V1 a4 F
- void * client_data,0 J5 ~6 t8 M$ N! S
. x @) I1 V& t: f' D; P- UF_STYLER_item_value_type_p_t callback_data)2 X+ g% n) R: y
; p6 o3 b/ w# B/ \; j. q! N; P' X- {
+ A3 f' D5 t: x/ i2 w. D5 u) \) O! d
- P8 C: d2 O3 S$ n; b4 }( N- /* Make sure User Function is available. */
6 D8 J/ P. H& m4 \5 F( V3 Q5 ^1 h - $ k/ d; H8 i$ b. ]
- if ( UF_initialize() != 0)
: x/ @1 b/ w8 ?" m - 2 y( \! ~3 D5 a9 o. J |) P
- return ( UF_UI_CB_CONTINUE_DIALOG );) b, O' v/ Z( l8 |% G
% u4 P. G" J9 n- j1 c9 Q$ B+ f. k* J- 1 c A8 R) A$ o8 g; i0 t/ g8 u& D
7 `, j; E8 Y8 [- ?- /* ---- Enter your callback code here ----- */9 M+ r# e4 K* H9 J0 C4 Z) r
- 0 `+ ?9 Y' ]% i; h$ _5 ^3 ?
- char *str_mid[8];
7 I1 q" l1 I; k* B3 a& ] - " Z ?# d# L& T+ c' A$ L) ?
- if(para_database_func(str_mid)==true), T3 P/ [0 a# H9 B6 }+ U. F
- 5 N2 ^" H5 F! Y: ]+ p, H
- read_para_from_database(dialog_id,str_mid);
$ F9 n) C* g) x8 t4 a" s3 v
6 h0 U% H! h+ I) Q t! x* }% M6 t# C- for(int i=0;i<8;i++)
- z: L5 ^& J' S# G, R0 K& P
% _$ B' }3 t' \5 A9 i- {: @' B0 J/ d7 O% [& b$ G
- " K- A& q3 F" {; m4 m4 w$ L e# k' ]
- delete [] str_mid[i];3 T* d1 Y3 x+ j, Z# |4 A
- % S( Q! i+ ^2 e" ?
- }
; c. @6 M6 F* \/ E I - 5 k1 V5 L, w* g( g! O2 `( ~/ Q) g8 I
- 6 O0 e, p* Y" p7 g* o `5 I O
- . c) G) a0 }5 Y# A: k- A' N+ Z& R
-
' J; @ M9 E, A) H/ F7 O; O - 6 ^9 }9 D9 U; F, O
- UF_terminate ();( U; G1 y# D. I& s$ [6 p- I F
- # B6 ^: G7 z- {4 Q& {9 i
-
3 Q7 W) y5 B7 D3 T" p3 B - ! g- L2 x8 v8 s0 `: {
- /* Callback acknowledged, do not terminate dialog */' ^ A; n8 i0 {7 @1 C
/ G" ~, t, X, M- B% K# y, A- return (UF_UI_CB_CONTINUE_DIALOG);9 \, u! p9 g/ W4 R
- " C U" ]9 e* R5 a
- & H/ N+ H- y$ r
- / T9 Q. [7 v( h# {9 b. J; U# ^ ?
- /* or Callback acknowledged, terminate dialog. */" r. z( @/ k' b) I
- $ }6 K; }: K3 j |0 S1 C* p
- /* return ( UF_UI_CB_EXIT_DIALOG ); */
. `# U B) w/ q8 ~
9 E5 t9 w3 g/ ?8 A5 d-
/ e/ }$ e, |6 k& v X5 M2 [* A
1 o8 C( E0 g; b/ J! Y$ ^4 U- }
复制代码
8 e; c3 F! X" c% ]6 {3 y) D. d; p3 n+ f4 U8 X* s1 h
|
|