Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 894873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T14:28:02+00:00 2026-05-15T14:28:02+00:00

I am new to vb.net (framework 4) and visual studio is giving me warnings

  • 0

I am new to vb.net (framework 4) and visual studio is giving me warnings on the following declarations.

Private Declare Auto Function EnumChildWindows Lib "user32" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long

Private Declare Auto Function FindWindow Lib "user32" (ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr

Private Declare Auto Function GetWindowText Lib "user32" (ByVal hwnd As IntPtr, ByVal lpString As String, ByVal cch As IntPtr) As IntPtr

Private Declare Auto Function keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Integer, ByVal dwExtraInfo As Integer) As Boolean

Private Declare Auto Function SendMessage Lib "user32" (ByVal hWnd As IntPtr, ByVal Msg As UInteger, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As IntPtr

Private Declare Auto Function SetForegroundWindow Lib "user32" (ByVal hWnd As IntPtr) As Boolean

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Integer)

and more importantly how do I find out the correct declaration in future?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T14:28:03+00:00Added an answer on May 15, 2026 at 2:28 pm

    I cannot imagine you getting a warning from these declarations. But yes, EnumChildWindows is wrong and impossible to use in a VB.NET program. Fix:

    Private Delegate Function EnumChildCallback(ByVal hWnd As IntPtr, ByVal lparam As IntPtr) As Boolean
    
    Private Declare Auto Function EnumChildWindows Lib "user32" (ByVal hWndParent As IntPtr, ByVal lpEnumFunc As EnumChildCallback, ByVal lParam As IntPtr) As Boolean
    

    The cch argument of GetWindowText is wrong, it is Integer. The rest are good.

    Pinvoke.net is a reasonable decent resource for these declarations. Or you could use the P/Invoke Interop Assistant tool. Neither of them are perfect, only SO is.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Visual Studio 2008 w/Sp1 To reproduce my problem I simply create a new .Net
I'm using Entity Framework in Visual Studio 2010 Beta 2 (.NET framework 4.0 Beta
I use entity framework with Visual Studio 2008, sure it was SP1 both .NET
I'm Developing a small windows application in C#.net in Visual Studio 2010 with framework
I'm starting a new, large server based project using .Net 4 and Visual Studio
Using Visual Studio 2010 .Net Framework 4 C# Linq to Entities Issue I would
.NET Framework: 2.0 Preferred Language: C# I am new to TDD (Test Driven Development).
There are a lot of new features that came with the .Net Framework 3.5.
I am fairly new at using the ASP.NET MVC framework and was hoping that
I try to use SQL Server Compact Edition with Entity Framework in Visual Studio

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.