| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2969 人关注过本帖
标题:为什么运行程序看不到窗体,只能在任务栏里看的见,没有任何提示??(已解 ...
只看楼主 加入收藏
cccool
Rank: 7Rank: 7Rank: 7
等 级:黑侠
帖 子:268
专家分:555
注 册:2007-5-1
结帖率:100%
收藏
 问题点数:0 回复次数:24 
为什么运行程序看不到窗体,只能在任务栏里看的见,没有任何提示??(已解决,多谢
我编了一个小程序,生成EXE文件后放在别人机子上运行时看不到窗体,
只能在任务栏里看的见,没有任何提示,
请各位高手看看,到底是怎么回事??

[此贴子已经被作者于2007-8-3 21:28:44编辑过]

搜索更多相关主题的帖子: 窗体 任务 提示 运行 
2007-08-02 15:58
zy78918
Rank: 1
等 级:新手上路
帖 子:209
专家分:0
注 册:2007-7-18
收藏
得分:0 
什么程序?

2007-08-02 16:10
cccool
Rank: 7Rank: 7Rank: 7
等 级:黑侠
帖 子:268
专家分:555
注 册:2007-5-1
收藏
得分:0 
回复:(zy78918)什么程序?
就是一个小的时钟程序,没有加外部控件,也没从部件里面添加控件,只用了工具箱里的控件,
在自己机子上能运行!!
在别人机子上就出现上面的问题了??

[fly]让心情飞一会[/fly]
">Email to Me     
2007-08-02 16:21
multiple1902
Rank: 8Rank: 8
等 级:贵宾
威 望:42
帖 子:4881
专家分:671
注 册:2007-2-9
收藏
得分:0 
传上来     
2007-08-02 16:21
cccool
Rank: 7Rank: 7Rank: 7
等 级:黑侠
帖 子:268
专家分:555
注 册:2007-5-1
收藏
得分:0 

附件传不上来,我把代码发上来,你们看看哪有问题??
Form1---code:
'API函数声明
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
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 Declare Function CreateRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long

'透明窗体参数设置
Private Const WS_EX_LAYERED = &H80000
Private Const GWL_EXSTYLE = (-20)
Private Const LWA_ALPHA = &H2 '颜色无效
Private Const LWA_COLORKEY = &H1 '颜色有效
'初始数据
Dim Flag As Boolean
Dim X1 As Long
Dim Y1 As Long
Dim Res As Integer
Dim Ret As String * 1024


Private Sub Bai_Click()
Label1.ForeColor = RGB(255, 255, 255)
End Sub

Private Sub GBNaoZhong_Click()
'Res = mciSendString("close all", Ret, 1024, 0)
Dim K As Integer
If Shijiandao = True Then
K = MsgBox("关闭闹钟!", 0 + vbInformation, "闹钟")
If K = 1 Then
Timer2.Enabled = False
Form2.Combo1.Text = "12"
Form2.Combo2.Text = "00"
H = -1
M = -1
Res = mciSendString("close all", Ret, 1024, 0)
End If
Else
K = MsgBox("你还没设置闹钟,是否现在设置?", 4 + vbInformation, "闹钟")
If K = 7 Then
Timer2.Enabled = False
Form2.Combo1.Text = "12"
Form2.Combo2.Text = "00"
H = -1
M = -1
Res = mciSendString("close all", Ret, 1024, 0)
Else
Load Form2
Form2.Visible = True
Timer2.Interval = 10
Shijiandao = False
Form2.Combo1.Text = "12"
Form2.Combo2.Text = "00"
End If
End If
Shijiandao = False
End Sub

Private Sub Hei_Click()
Label1.ForeColor = RGB(0, 0, 0)
End Sub

Private Sub Hong_Click()
Label1.ForeColor = RGB(255, 0, 0)
End Sub

'双击退出
Private Sub Image1_DblClick()
Res = mciSendString("close all", Ret, 1024, 0)
End
End Sub

Private Sub Form_Load()
Form1.ScaleMode = 3
'透明窗体
Dim rtn As Long
If FengG = False Then
If Bian = True Then
Label1.Top = Label1.Top - 2
Label1.Left = Label1.Left - 1
Image1.Width = Image1.Width - 130
Image1.Height = Image1.Height - 20
Form1.Width = Form1.Width - 130
Form1.Height = Form1.Height - 20
End If

rtn = GetWindowLong(hWnd, GWL_EXSTYLE)
rtn = rtn Or WS_EX_LAYERED
Form1.Picture = LoadPicture(App.Path & "\史努比(230,60,1).bmp")
SetWindowLong hWnd, GWL_EXSTYLE, rtn
'SetLayeredWindowAttributes hWnd, RGB(230, 60, 1), 200, LWA_ALPHA
SetLayeredWindowAttributes hWnd, RGB(230, 60, 1), 255, LWA_COLORKEY
End If
If FengG = True Then
Label1.Top = Label1.Top + 2
Label1.Left = Label1.Left + 1
Image1.Width = Image1.Width + 130
Image1.Height = Image1.Height + 20
Form1.Width = Form1.Width + 130
Form1.Height = Form1.Height + 20
Form1.Picture = LoadPicture(App.Path & "\米老鼠(194,122,50).bmp")

rtn = GetWindowLong(hWnd, GWL_EXSTYLE)
rtn = rtn Or WS_EX_LAYERED
SetWindowLong hWnd, GWL_EXSTYLE, rtn
SetLayeredWindowAttributes hWnd, RGB(194, 122, 50), 255, LWA_COLORKEY
End If

'时间显示
Label1.Caption = Time

Timer1.Interval = 1000
Timer2.Interval = 1000
Timer1.Enabled = True
Timer2.Enabled = False

Hour = -1
Min = -1

'切割窗体
Dim i As Integer
Dim rwnd, X2, Y2
X2 = ScaleX(Me.Width, vbTwips, vbPixels)
Y2 = ScaleY(Me.Height, vbTwips, vbPixels)
rwnd = CreateRectRgn(5, 30, X2 - 5, Y2 - 5)
SetWindowRgn Me.hWnd, rwnd, True
'窗体置前,初始左上角
Call ZuoS_Click
SetWindowPos Me.hWnd, -1, 0, 0, 0, 0, &H1 Or &H2

End Sub
'窗体移动
Private Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
Flag = True
X1 = X
Y1 = Y
End If
If Button = 2 Then
Form1.PopupMenu CaiDan, 4
End If
End Sub

Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Flag = True Then
Form1.Move Form1.Left + (X - X1), Form1.Top + (Y - Y1)
End If
Image1.ToolTipText = Format(Date, "dddddd") & " " & WeekdayName(Weekday(Date))
End Sub

Private Sub Image1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Flag = False
Form1.Move Form1.Left + (X - X1), Form1.Top + (Y - Y1)
End Sub

Private Sub Lan_Click()
Label1.ForeColor = RGB(0, 0, 255)
End Sub

Private Sub Lu_Click()
Label1.ForeColor = RGB(0, 255, 0)
End Sub

Private Sub MLS_Click()
FengG = True
Bian = True
Call Form_Load
End Sub

'闹钟设置
Private Sub NZSheZhi_Click()
Form2.Visible = True
Form2.Label3.Caption = Format(Time, "hh:mm")
End Sub

Private Sub SLB_Click()
FengG = False
Call Form_Load
End Sub

'时时更新时间
Private Sub Timer1_Timer()
Dim T As String
Label1.Caption = Time
T = Format(Time, "hh:mm")
If Val(Left(T, 2)) = Hour And Val(Mid(T, 4, 2)) = Min Then
Shijiandao = True
Timer2.Enabled = True
End If
End Sub
'启动闹钟
Private Sub Timer2_Timer()
'Dim Res As Integer, Ret As String * 1024
'If Val(Left(Label1.Caption, 2)) = Hour And Val(Mid(Label1.Caption, 4, 2)) = Min Then
'If CommonDialog1.FileName = "" Then
'Res = mciSendString("play " & App.Path & "\110.mp3", Ret, 1024, 0)
'Else
'Res = mciSendString("play " & LingY, Ret, 1024, 0)
'End If
'End If
If Shijiandao = True Then
Call LING_YIN
Timer2.Interval = 0
End If
End Sub
'退出
Private Sub TuiChu_Click()
Unload Me
Res = mciSendString("close all", Ret, 1024, 0)
End
End Sub

'窗体位置选择
Private Sub YouS_Click()
Form1.Top = 50
Form1.Left = 100
End Sub

Private Sub YouX_Click()
Form1.Top = 12000
Form1.Left = 100
End Sub

Private Sub ZDY_Click()
Form3.Visible = True
End Sub

Private Sub ZhongX_Click()
Form1.Top = 6200
Form1.Left = 8400
End Sub

Private Sub ZuoS_Click()
Form1.Top = 50
Form1.Left = 16500
End Sub
'闹钟铃音
Private Sub LING_YIN()

Res = mciSendString("open 110.mp3", Ret, 1024, 0)
Res = mciSendString("play 110.mp3", Ret, 1024, 0)

End Sub


Form2----code:
Private Sub Combo1_Change()
If Not IsNumeric(Combo1.Text) Or Val(Combo1.Text) < 0 Or Val(Combo1.Text) > 24 Then
MsgBox "请输入正确的时间或从下拉表里选择!", vbOKOnly + vbInformation, "友情提示"
Combo1.Text = "12"
End If
End Sub

Private Sub Combo2_Change()
If Not IsNumeric(Combo2.Text) Or Val(Combo2.Text) < 0 Or Val(Combo2.Text) > 59 Then
MsgBox "请输入正确的时间或从下拉表里选择!", vbOKOnly + vbInformation, "友情提示"
Combo2.Text = "00"
End If
End Sub

Private Sub Command1_Click()
Hour = Val(Combo1.Text)
Min = Val(Combo2.Text)
Me.Visible = False
End Sub

Private Sub Command2_Click()
Hour = -1
Min = -1
Combo1.Text = "12"
Combo2.Text = "00"
Me.Visible = False
End Sub

Private Sub Timer1_Timer()
Form2.Label3.Caption = Format(Form1.Label1.Caption, "hh:mm")
End Sub


Form3---code:

Dim R As Integer
Dim G As Integer
Dim B As Integer
Dim S As Long

Private Sub Command1_Click()
Form1.Label1.ForeColor = Picture1.BackColor
Unload Me
End Sub

Private Sub Command2_Click()
HScroll1.Value = 0
HScroll2.Value = 0
HScroll3.Value = 0
Form1.Label1.ForeColor = S
Unload Me
End Sub

Private Sub Form_Load()
R = 0: G = 0: B = 0
Picture1.BackColor = RGB(R, G, B)
S = Form1.Label1.ForeColor
End Sub

Private Sub HScroll1_Change()
R = HScroll1.Value
Picture1.BackColor = RGB(R, G, B)
Form1.Label1.ForeColor = Picture1.BackColor
End Sub

Private Sub HScroll2_Change()
G = HScroll2.Value
Picture1.BackColor = RGB(R, G, B)
Form1.Label1.ForeColor = Picture1.BackColor
End Sub

Private Sub HScroll3_Change()
B = HScroll3.Value
Picture1.BackColor = RGB(R, G, B)
Form1.Label1.ForeColor = Picture1.BackColor
End Sub


模块:
Public Hour As Integer
Public Min As Integer
Public Shijiandao As Boolean
Public FengG As Boolean
Public Bian As Boolean


[fly]让心情飞一会[/fly]
">Email to Me     
2007-08-02 16:32
cccool
Rank: 7Rank: 7Rank: 7
等 级:黑侠
帖 子:268
专家分:555
注 册:2007-5-1
收藏
得分:0 
回复:(multiple1902)传上来
我把代码传上来了,你看看是哪有问题啊???

[fly]让心情飞一会[/fly]
">Email to Me     
2007-08-02 16:43
西风独自凉
Rank: 8Rank: 8
等 级:贵宾
威 望:43
帖 子:3380
专家分:28
注 册:2007-8-2
收藏
得分:0 
被你的代码吓住了

2007-08-02 17:19
cccool
Rank: 7Rank: 7Rank: 7
等 级:黑侠
帖 子:268
专家分:555
注 册:2007-5-1
收藏
得分:0 
简单的,只是用了几个API函数
有没有人看一下,是哪个问题,
小弟我先谢了

[fly]让心情飞一会[/fly]
">Email to Me     
2007-08-02 17:30
cccool
Rank: 7Rank: 7Rank: 7
等 级:黑侠
帖 子:268
专家分:555
注 册:2007-5-1
收藏
得分:0 
怎么还没人帮忙啊????

[fly]让心情飞一会[/fly]
">Email to Me     
2007-08-02 17:55
cccool
Rank: 7Rank: 7Rank: 7
等 级:黑侠
帖 子:268
专家分:555
注 册:2007-5-1
收藏
得分:0 
哪位高手帮帮忙啊!!!

[fly]让心情飞一会[/fly]
">Email to Me     
2007-08-02 18:04
快速回复:为什么运行程序看不到窗体,只能在任务栏里看的见,没有任何提示??( ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.028454 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved