你的位置:首页 > 技术支持 > 解决方案

在供应链单据查询工具栏增加按钮

来源: 2016/11/11 14:16:23      点击:
钮开始


Delete From t_MenuToolBar Where FToolID = 10002

insert into t_MenuToolBar ( FToolID,FName,FCaption,FCaption_CHT,FCaption_EN,FImageName,FToolTip,FToolTip_CHT,FToolTip_EN,FControlType,FVisible,FEnable,FChecked,FShortCut,FCBList,FCBList_CHT,FCBList_EN,FCBStyle,FCBWidth,FIndex,FToolCaption,FToolCaption_CHT,FToolCaption_EN)

values (10002,'FMenuPC1','报表查询','报表查询','报表查询','39','报表查询','报表查询','报表查询',0,0,1,0,0,'','','',0,0,0,'报表查询','报表查询','报表查询')

Update IclistTemplate

set FLogicStr=FLogicStr+ Case When Right(FLogicStr,1)='|' then 'V:FMenuPC1' else '|V:FMenuPC1' end

where FID =8 and not FLogicStr like '%FMenuPC1%'

Delete From t_BandToolMapping where FBandID=1 and FToolID = 10002 and FID = 82

insert into t_BandToolMapping (FID,FBandID,FToolID,FSubBandID,FIndex,FComName,FBeginGroup)

values (82,1,10002,0,65,'|ICMOListBill.ListBill',0)

-----------------------------------------------------------------------------------------------------------------------------结束

增加DLL,把以下内容在VB里新增的DLL文件类模块里面复制进去,再新增一个form1的窗口

把工程名改成:ICMOListBill,把类模块名改为:ListBill

Private Declare Function GetCurrentProcessId Lib "kernel32" () As Long

Public Sub MainFunction(ByVal sKey As String, oList As Object, ByRef bCancel As Boolean)  '在这里录入的skey,olist,bcancel必须是小写

Dim cnn As String

Dim strSql As String

Dim cn As ADODB.Connection

Dim rs As ADODB.Recordset

Dim oDataSrv As Object

Dim oBill As Object

If sKey = "FMenuPC1" Then

'得到连接串

cnn = Left(GetConn, InStr(1, GetConn, "}") - 1)

cnn = Mid(cnn, 16)

Set cn = New ADODB.Connection

With cn

.ConnectionString = cnn

.Open

End With

Form1.Text1.Text = cnn

Form1.Show

End If

End Sub

---获取字符串

Private Function GetConn() As String

Dim lProc As Long

lProc = GetCurrentProcessId()

Set spmMgr = CreateObject("PropsMgr.ShareProps")

If IsObject(spmMgr.GetProperty(lProc, "PropsString")) Then

GetConn = spmMgr.GetProperty(lProc, "PropsString")

Else

GetConn = spmMgr.GetProperty(lProc, "PropsString")

End If

Set spmMgr = Nothing

Exit Function

End Function

改写好后编驿成:DLL文件,复制到system32文件夹里,同时要把lib,exp两个文件也复制,然后进行注册:在运里里录入:regsvr32    ICMOListBill.dll

此时进入K3点击刚新增的按钮,就可以弹出FORM1的窗口。

如果要反注册 ICMOListBill.dll,则需要先退出K3,然后再进行regsvr32  /U  ICMOListBill.dll才能够反注册

也可以通过工具;regdllview 来查看和注册,注册后便可运行程序。

这样打开后,FORM1会显示一直在执行的状态,因此,需要在FORM1的命令里面录入录入信息

-----------------------------------------------------开始

Option Explicit

Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long

Private Const HWND_TOPMOST& = -1

' 将窗口置于列表顶部,并位于任何最顶部窗口的前面

Private Const SWP_NOSIZE& = &H1

' 保持窗口大小

Private Const SWP_NOMOVE& = &H2

Private Sub Form_Load()

SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE

End Sub

-----------------------------------------------------结束