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