473,408 Members | 1,857 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

converting API call

hi, i have this API call in VB6

Public Declare Function SetWindowLong Lib "user32.dll" Alias
"SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong
As Long) As Long

in sub

SetWindowLong(Form1.hwnd, GWL_WNDPROC, AddressOf WindowProc)

how can i convert this to 2003? thanks
--
-iwdu15
Jul 24 '06 #1
5 3230
Public Declare Function SetWindowLong Lib "user32.dll" Alias
"SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong
As Long) As Long

in sub

SetWindowLong(Form1.hwnd, GWL_WNDPROC, AddressOf WindowProc)

how can i convert this to 2003? thanks
from www.pinvoke.net:

Private Declare Auto Function SetWindowLong Lib "User32.Dll" _
(ByVal hWnd As IntPtr, _
ByVal nIndex As Integer, _
ByVal dwNewLong As Integer) As Integer

You can add alias "SetWindowLongA".
Jul 24 '06 #2
thanks, i got that now, but what about the function call?

SetWindowLong(Form1.hwnd, GWL_WNDPROC, AddressOf WindowProc)

you cant exactly pass in "AddressOf WindowProc" as an integer value....i
tried delegate, object...etc but nothing works, any idea?
--
-iwdu15
Jul 24 '06 #3
Hello iwdu15,

You're trying to subclass your window procedure here. In the .NET world
you can simply override the window proc. I'd prolly use the NativeWindow
class for this.

-Boo
hi, i have this API call in VB6

Public Declare Function SetWindowLong Lib "user32.dll" Alias
"SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal
dwNewLong As Long) As Long

in sub

SetWindowLong(Form1.hwnd, GWL_WNDPROC, AddressOf WindowProc)

how can i convert this to 2003? thanks

Jul 24 '06 #4
thanks, that works! ive been programming .net for three years now but i
havent really gone into APIs yet, so this is all new for me, thanks for your
help
--
-iwdu15
Jul 24 '06 #5
IWDU15
thanks, that works! ive been programming .net for three years now but i
havent really gone into APIs yet, so this is all new for me, thanks for
your
help
We know your age, don't think it is better to use API's in a Net program, is
shows a kind of VB classic programming where was missing a lot to do it
without that.

Using an API is doing a direct call to your OS and therefore depenend from
the version of that Win32, WinFX etc.

Therefore as advice: use it only if there are no Net alternatives.

http://msdn.microsoft.com/library/de...l/win32map.asp

Cor
Jul 25 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Cyde Weys | last post by:
I'm currently working on converting a simulator program from Visual Basic 6.0 to Visual C++ .NET. I've figured out most of the stuff, but there's still one thing I haven't gotten to and I've never...
3
by: rgarf | last post by:
I am converting a C++ application to C#, What in C# replaces the following C++ functions: overloaded opertaor= _ecvt(Math.Abs(val),14,&dec,&sign) ; //this function converts a double to a string...
0
by: Edward Diener | last post by:
I have some questions about the instructions for creating a mixed mode DLL in the MSDN topic "Converting Managed Extensions for C++ Projects from Pure Intermediate Language to Mixed Mode" in the...
9
by: Edward Diener | last post by:
I received no answers about this the first time I posted, so I will try again. My inability to decipher an MSDN topic may find others who have the same inability and someone who can decipher and...
0
by: ChrisWoodruff | last post by:
I have a C++ function in a COM object that I am trying to implement in VB.NET (the functionality, NOT the COM object, I want to remove the requirement for the COM DLL) I am an experienced VB...
36
by: kjvt | last post by:
Based on a prior posting, I've written a function to convert a recordset to a dataview. The first call to the function for a given recordset works perfectly, but the second call always returns a...
3
by: Derek Martin | last post by:
Hi there, kind of a dumb question, but it falls in line with not understanding (go figure) every nuance about .Net. Is it relatively straight forward to convert a VB.Net built app to an ASP.Net...
25
by: Blasting Cap | last post by:
I keep getting errors that pop up when I am trying to convert an application from dotnet framework 1.1 to framework 2.0. The old project was saved in sourcesafe from Visual Studio 2003, and I have...
1
by: Tejas | last post by:
Hi, I am using ldap_get_values() call to get the user attributes from LDAP. This call is returning the user attributes in UTF-8 encoding and its a PCHAR*. For normal English characters this...
5
by: Peter Michaux | last post by:
There seem to be some options for converting the arguments object inside a function to an instance of Array. I'm curious if anyone has encountered any problems with any particular techniques for...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.