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