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