Excel精英培训网

 找回密码
 注册
数据透视表40+个常用小技巧,让你一次学会!
查看: 2084|回复: 3

去除窗体标题栏64位下提示错误,急,求高手:

[复制链接]
发表于 2015-10-23 12:31 | 显示全部楼层 |阅读模式
Private Sub UserForm_Initialize()
Dim IStyle As LongLong, hWnd As LongLong
'''000000000000000000000000000000
hWnd = FindWindow(vbNullString, Me.Caption)
    SetWindowPos hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
'''0000000000000000000000000000
ListBox1.ColumnCount = 1
        '******去除窗体标题栏******
    IStyle = GetWindowlonglong(hWnd, GWL_STYLE)
    IStyle = IStyle And Not WS_CAPTION
    SetWindowLong hWnd, GWL_STYLE, IStyle
    DrawMenuBar hWnd
'    ******去除窗体四周的边框******
     IStyle = GetWindowLong(hWnd, GWL_EXSTYLE) And Not WS_EX_DLGMODALFRAME
    SetWindowLong hWnd, GWL_EXSTYLE, IStyle
endsub

红色标示的两句在32位下正常使用,为什么在64位下就提示错误呢?请问这两句是什么意思,怎么改才能在64位下使用?请高手直接帮忙解答,谢谢谢谢!
excel精英培训的微信平台,每天都会发送excel学习教程和资料。扫一扫明天就可以收到新教程
发表于 2015-10-23 23:46 | 显示全部楼层
回复

使用道具 举报

发表于 2015-10-23 23:50 | 显示全部楼层
红色的都是API内的函数,如果不在通用区内声明,是不能使用的。
回复

使用道具 举报

 楼主| 发表于 2015-10-25 22:24 | 显示全部楼层
金樽空对月 发表于 2015-10-23 23:50
红色的都是API内的函数,如果不在通用区内声明,是不能使用的。

Option Explicit
Private Declare PtrSafe Function DrawMenuBar Lib "user32" (ByVal hWnd As LongLong) As LongLong
Private Declare PtrSafe Function GetWindowlonglong Lib "user32" Alias "GetWindowlonglongA" (ByVal hWnd As LongLong, ByVal nIndex As LongLong) As LongLong
Private Declare PtrSafe Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As LongLong, ByVal nIndex As LongLong, ByVal dwNewLong As LongLong) As LongLong
Private Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As LongLong
Private Declare PtrSafe Function SetWindowPos Lib "user32" (ByVal hWnd As LongLong, ByVal hWndInsertAfter As LongLong, ByVal X As LongLong, ByVal Y As LongLong, ByVal cx As LongLong, ByVal cy As LongLong, ByVal wFlags As LongLong) As LongLong
Private Const HWND_TOPMOST = -1
Private Const SWP_NOMOVE = 2
Private Const SWP_NOSIZE = 1

Private Const GWL_STYLE As LongLong = (-16)
Private Const GWL_EXSTYLE = (-20)
Private Const WS_CAPTION As LongLong = &HC00000
Private Const WS_EX_DLGMODALFRAME = &H1&









我发现在64位下不要这两句照样能用!也不知道为什么!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|Excel精英培训 ( 豫ICP备11015029号 )

GMT+8, 2024-5-2 00:59 , Processed in 0.291322 second(s), 12 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表