Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

API Documentations For VB (user32.dll)

Guess this is a bit of a wild shot but I dont suppose any body could point me in the right direction of a really good set of documents about most if not all the user32.dll API calls that can be made for VB - you can use the API viewer bundeled with VB to find everyone but some of the lesser known calls are very hard to find documentation on and I am having a lot of trouble finding stuff about them!

Most difficult thing I am finding is not actually finding the right API call but what the parrameters the function is asking for. I mean what exactly are the parametters asking for - if that makes sense!

Thanx and any ideas would be great!

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
I Debug It It Comes Up With That It Can't Find User32 Or User32.dll I Have Tried Both Way
This is the beginning of my program every time i Debug it it comes up with that it can't find user32 or user32.dll i have tried both ways and SetLayeredWindowAttributes Me.hWnd, &HFF00FF, 0, LWA_COLORKEY is where it says the problem lies plz help i know its something real simple to fix that me being a newbie is over looking

Const SWP_NOSIZE = &H1
Const SWP_NOMOVE = &H2
Private Declare Sub SetWindowPos Lib "user32.dll" (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)
Const LWA_ALPHA = &H2
Const GWL_EXSTYLE = (-20)
Const WS_EX_LAYERED = &H80000
Private Declare Function GetWindowLong Lib "user32.dll" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32.dll" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32.dll" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Dim User(1 To 40) As String
Dim Pass(1 To 40) As String
Dim Proxy(1 To 40) As String
Dim Port(1 To 40) As String
Dim Server(1 To 40) As String
Dim Data(1 To 40) As String
Public Running As Boolean

Private Sub Form_Activate()
    Dim Ret As Long
    Ret = GetWindowLong(Me.hWnd, GWL_EXSTYLE)
    Ret = Ret Or WS_EX_LAYERED
    SetWindowLong Me.hWnd, GWL_EXSTYLE, Ret
SetLayeredWindowAttributes Me.hWnd, &HFF00FF, 0, LWA_COLORKEY
End Sub

MS Word And Using It To Write Documentations
hi guys,

I know this is a lame question but this is sort of getting annoying so I need to seek answers.

I need to write a documentation about the software I have written. The tool i use is MS word 2003. But when I write pieces of code, the spell checker draws red lines underneath, which is quite annoying. I know the simple suggestion would be turn the spell checker off. But it is also required to do the final spell checking.

However, I have downloaded the sample documentation written but programmer and that sample has been saved as ".RTF". When i opened this RTF document from MS word it doesn't show any red lines underneath the code lines.

Then I tried to write the documentation in .RTF format but still it shows those red lines underneath the code. Is there a way to overcome this problem?

I need to write lines of code in the word document and at the same time prevent spell checker from showing red lines below the code lines!


Geof moved this post from a forum to the VBA forum. Then Geof editted the post to improve readability.

Edited by - Geof on 11/5/2006 5:20:35 PM

About User32.dll
Do I need to add this lib to my setup (to make my app run corectly) or I do not need to do this?

i have seen the use of "user32" () as long and a lot of things using (byval hdc as long) etc. etc.

can someone explain what these user32 and hdc things do??

do all windows operating systems have this by default?

Morning all,

I am running a VB exe on an NT machine that uses the user32.dll to change the colours of a mdi form's menu. (code i picked up on this forum - very handy). The error says that the user32.dll can't be found but it is there. Any suggestions? Could it be damaged or do i have to do something different for windows NT than other versions of windows? any help would be appriciated.


I've searched and searched, and can't find any good resources to help me understand how the user32.dll file can be used in VB programming. Does anybody have any good books or sites to review?


hi there,

Where can I get a list of functions that use "user32" or "shell32". Does anyone know?



User32 && Drawrect

How do I open User32.dll to search for functions and declare statement that I can use? Does DrawRect exist in User32.dll?


User32 API Call
I am trying to implement the ExitWindowsEx API in my app here is the code i used:

Option Explicit

Private Enum ShutDownType
EWX_LOGOFF = &H0 'Logoff only th current user, only when user active
EWX_POWEROFF = &H8 'shuts the system down then powers it off
EWX_REBOOT = &H2 'Shuts the system down then reboots
End Enum

Private Enum ReasonCode
SHTDN_REASON_MAJOR_APPLICATION = &H40000 'Application issue.
SHTDN_REASON_MAJOR_HARDWARE = &H10000 'Hardware issue.
SHTDN_REASON_MAJOR_LEGACY_API = &H70000 'The InitiateSystemShutdown function was used instead of InitiateSystemShutdownEx.
SHTDN_REASON_MAJOR_OPERATINGSYSTEM = &H20000 'Operating system issue.
SHTDN_REASON_MAJOR_POWER = &H60000 'Power failure.
SHTDN_REASON_MAJOR_SOFTWARE = &H30000 'Software issue.
SHTDN_REASON_MAJOR_SYSTEM = &H50000 'System failure.
End Enum

Private Declare Function ExitWindowsEx Lib "user32" (ByVal uflags As ShutDownType, ByVal dwReason As ReasonCode) As Boolean

Sub Main()
Dim bSuccess As Boolean

If bSuccess = True Then
MsgBox "Shutting Down", vbInformation, "Success"
MsgBox "If at first you don't succeed, Failure my be your style", vbInformation, "Failure"
End If

End Sub
when run as an exe it should close apps and log out the user. but i get an error:
Runtime Error: 453
could not find DLL entry point ExitWindowsEx in user32

API code from:

User32 Problem

Iam trying the following code for searching a ListBox Control.

VB Code:
Const LB_FINDSTRING = &H18FPrivate Declare Function SendMessage Lib "User32" _Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As _Integer, ByVal wParam As Integer, lParam As Any) As Long iListIndex = SendMessage(m_listOfChangedDO.hWnd, LB_FINDSTRING, -1, ByVal strName(i))

If I do a sample application, Iam getting the result correctly, but if I include this code in my ActiveX control application it crashes saying an error:

VB6 caused a general protection fault
in module USER.EXE at 000c:00003ebb

But previously it was working fine with the same application. But Iam not sure what happened suddenly.

Is there something wrong here? Or is there any better way to search a string in a ListBox?


Error User32.dll
I have a project with three forms: FirstStage, SecondStage and ThirdStage.
In FirstStage is a series of command buttons 1 to 5. Clicking any will open SecondStage where the user can input data and/or select data from datagrids on that form. Clicking a command button on the SecondStage form opens ThirdStage and checking one of three checkboxes on that form will determine how the project calculates certain data and then puts the data into txtboxes on the FirstStage form.

During this process, at what appears random , the project pops up the Project1 has encountered a problem and needs to close. The error is list as with user32.dll.

Please, if you have any ideas, post as I am totally in the dark!

Thanks in advance!

Methods In User32.dll
How do I list the methods available in user32.dll

User32.dll Question
I have an unknown problem with one of my applications. It has worked on numerous pc's (95/98/nt) but, on two pc's in particular the application repeatedly locks up. There are no error messages and lacks an identifiable pattern. I have been careful about memory leaks and cleanup. With a debugging tool I have been able to narrow the lockup to a subroutine which makes several api calls.

I don't know if the problem is the user32.dll version or not. My system as well as at least one other pc on which the app works, have a much newer version of the dll. How would I replace this dll which the system is using, should I replace it (will I do damage elsewhere??), or am I going down the wrong path??

any suggestions and help is greatly appreciated!


Avicap.dll && User32.dll Info

anyone know where I can find a full reference on avicap32.dll and user32.dll.

I lookup Ms website but could not find anything useful..


API SetTimer (lib User32) 429-problem
Runtime error '429'
"Active X component canīt create object"

That is what I get in Win NT4 and Win 98 when trying to use the api timer like this:

[in module]
Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long

[In form]
SetTimer Me.hwnd, 0, 1000, AddressOf TheTimers.FormTimer

It works great in Win XP so I donīt get it.

Clues anyone?

Can't Find FindWindow In User32.dll
When i try to use find window i get this message:

An unhandled exception of type 'System.EntryPointNotFoundException' occurred in WindowsApplication1.exe

Additional information: Unable to find an entry point named FindWindow in DLL user32.dll.

why isn't it workin??

(I'm using .NET)

Public Declare Function FindWindow Lib "user32" _
(ByVal lpClassName As String, _
ByVal lpWindowName As String) As System.IntPtr

hWnd = FindWindow("mspim_wnd32", Nothing)

Entry Point User32???
whats up with this???

VB Code:
frmData.Show    For x = 1 To MSChart1.RowCount        MSChart1.Row = x        frmData.LV1.ListItems.Add , MSChart1.RowLabel, MSChart1.RowLabel        frmData.LV1.ListItems(MSChart1.RowLabel).ListSubItems.Add , , MSChart1.DataNext

in frmData:

VB Code:
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 = -1Private Const hwnd_notopmost = -2Private Const swp_nomove = 2Private Const swp_nosize = 1Private Const flags = swp_nomove Or swp_nosize  Private Sub Form_Load()    setwindowpos Me.hwnd, hwnd_topmost, 0, 0, 0, 0, flags End Sub

SendMessage On Windows 98's User32.dll
Hi. I'm working on an application that uses a function to justify text in a RichTextBox. The alignment is done using SendMessage from user32.dll. It works fine on Windows XP, but it does nothing on Windows 98.
How can I solve this problem?? Is it a matter of version of user32.dll ??

User32 Library Functions
I have going through this legacy project and it uses a couple of functions which i think go with a User32 library. i tried using the object browser to find out what they meant but the object browser just tells me that they are member functions of a user defined class.

the two functions are

GetSystemMenu & RemoveMenu

the prototype for the GetSystemMenu function is

Public Declare Function GetSystemMenu Lib "User32" (ByVal hWnd As long, ByVal Revert as long)

is there somwehere on the net where i can punch in the function name and get what it does

Changing CheckBox Value Using USER32

I am trying to change the value of a checkbox using the user32 library.  I cannot simply use sendkeys to toggle the value of the checkbox because I need to know what the current state is.  I tried using sendmessageA from the win32 library, but this only changed the state visually on the screen but does not trigger an event in the program that I am trying to access.

Does anyone know a way of reading the state of a checkbox using user32.  I have a handle to the object of type TCheckBox, but I don't know which function to call.

I suspect it is something like
IsDlgButtonChecked(HWND hDlg, int nIDButton);
but I don't know how to get the nIDButton


Entry Points In User32.dll Solved.
Recently i asked a question, From where can i get entry points of a dll, i mean the names of each function, and the parameters that needs to be given. the answers were not specific.
now as i got the answer i want to tell all who doesnt know the fact that,

API text viewer, that comes with visual studio, tells the names of all the functions in user32.dll as well as the declaration syntax.

where as dependency walker can tell only the function names of any dll files not the arguments.

Can't Find DLL Entry Point.....user32
I am using Vb6 and trying to hide or disable the form close button.
The code I am using is below.
On my development machine (WinXP sp2.0) this works but on the target machine (WinXP sp2.0) I get the following error
Can't find DLL entrypoint GetSystemMenu in user32.

Can any body help!!
vb Code:
Private Const MF_BYPOSITION = &H400Private Const MF_REMOVE = &H1000 Private Declare Function DrawMenuBar Lib "user32" _      (ByVal hwnd As Long) As Long      Private Declare Function GetMenuItemCount Lib "user32" _      (ByVal hMenu As Long) As Long      Private Declare Function GetSystemMenu Lib "user32" _      (ByVal hwnd As Long, _       ByVal bRevert As Long) As Long       Private Declare Function RemoveMenu Lib "user32" _      (ByVal hMenu As Long, _       ByVal nPosition As Long, _       ByVal wFlags As Long) As Long   Private Sub Form_Load()    Dim hMenu As Long   Dim menuItemCount As Long   'Obtain the handle to the form's system menu   hMenu = GetSystemMenu(Me.hwnd, 0)     If hMenu Then           'Obtain the number of items in the menu      menuItemCount = GetMenuItemCount(hMenu)         'Remove the system menu Close menu item.     'The menu item is 0-based, so the last     'item on the menu is menuItemCount - 1      Call RemoveMenu(hMenu, menuItemCount - 1, _                      MF_REMOVE Or MF_BYPOSITION)        'Remove the system menu separator line      Call RemoveMenu(hMenu, menuItemCount - 2, _                      MF_REMOVE Or MF_BYPOSITION)         'Force a redraw of the menu. This     'refreshes the titlebar, dimming the X      Call DrawMenuBar(Me.hwnd)    End If   End Sub

(user32.dll Exception!?) Can Someone Try This Code And See If It Errors?
Hello All,

I have a form with a vertical scroll bar a frame (frame1) on this frame another frame (frame2(0)) and on frame2(0) 3 textboxes textbox1(0), textbox2(0), textbox3(0). I am dynamically creating and positioning new controls, which works fine, but when I come to unload the form I get a fatal error in user32.dll.

Seems to work ok if the textboxes are not multiline, but crashes if they are.

Any gurus out there who have the faintest clue what could be happening? All code is below, if anyone cares to try it (please, please!!!)

Ideally I would like to be able to use multiline textboxes.


Option Explicit

Private Sub AddControls()
  Dim Num As Integer
  Num = FRAME2.Count
  StickEmOn (Num)
  If Num Mod 3 = 0 Then
    FRAME2(Num).Left = FRAME2(0).Left
    FRAME2(Num).Top = FRAME2(Num - 1).Top + FRAME2(Num - 1).Height + 10
    FRAME2(Num).Left = FRAME2(Num - 1).Left + FRAME2(Num - 1).Width + 40
    FRAME2(Num).Top = FRAME2(Num - 1).Top
  End If
  FRAME2(Num).Caption = CStr(Num)
  If FRAME2.Count > 3 Then
    VScroll1.Min = 0
    VScroll1.Max = FRAME2.Count - 4
    If FRAME2.Count > 9 Then
      FRAME1.Height = (FRAME2(0).Height * 3) + (FRAME2(0).Height * (FRAME2.Count - 9) * 3)
    End If
  End If
End Sub

Private Sub vScroll1_Change()
  ' Calculate the new top of the frame as a negative number
  FRAME1.Top = -(((FRAME2(0).Height) * VScroll1.Value) / 3) ' if the form height is 300% bigger than frame height should look good when scrolling
End Sub

Private Sub StickEmOn(ctrlNo As Integer)
  Load FRAME2(ctrlNo)
  FRAME2(ctrlNo).Visible = True
  Load TEXTBOX1(ctrlNo)
  TEXTBOX1(ctrlNo).Visible = True
  TEXTBOX1(ctrlNo).Left = TEXTBOX1(ctrlNo - 1).Left
  TEXTBOX1(ctrlNo).Top = TEXTBOX1(ctrlNo - 1).Top
  Set TEXTBOX1(ctrlNo).Container = FRAME2(ctrlNo)
  Load TEXTBOX2(ctrlNo)
  TEXTBOX2(ctrlNo).Visible = True
  TEXTBOX2(ctrlNo).Left = TEXTBOX2(ctrlNo - 1).Left
  TEXTBOX2(ctrlNo).Top = TEXTBOX2(ctrlNo - 1).Top
  Set TEXTBOX2(ctrlNo).Container = FRAME2(ctrlNo)
  Load TEXTBOX3(ctrlNo)
  TEXTBOX3(ctrlNo).Visible = True
  TEXTBOX3(ctrlNo).Left = TEXTBOX3(ctrlNo - 1).Left
  TEXTBOX3(ctrlNo).Top = TEXTBOX3(ctrlNo - 1).Top
  Set TEXTBOX3(ctrlNo).Container = FRAME2(ctrlNo)
End Sub

Private Sub Form_Load()
  Dim i As Integer
  For i = 1 To 80
    Call AddControls
  Next i
End Sub


Edited by - original_noogle on 4/28/2004 4:37:52 AM

Is There A List Of Functions For Dll's Like User32, Kernel32, And Gdi32?
I'm trying to find out what sorts of things are offered through these common dll's but a list of functions is hard to come by.

Invalid Page Fault In Module User32.dll At 0177:bfc05430
When exiting Netscape then opening our VB application we get this error on several customers computers?  Where do I look to fix it?   I use to get instead of user32.dll  I use to get "EDT32x30.ocx"  I found on Netscapes site to delete all that you can of the ~*.tmp files you could.  So I did and now I get "invalid page fault in module USER32.dll at 0177:bfc05430"   Can anyone help?

Calling Public Declare Function CallWindowProc Lib "user32" Twice In The Module
hi , i am new to shell programming if let say i need to called CallWindowProc twice in two different module for different control to used . What should i do to allow both CallWindowProc exist in two module ?


Lib "user32"
Can anyone tell me where i can find some info on Lib "user32" because i don't know what you can get out of it... Thanks

Copyright Đ 2005-08, All rights reserved