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