473,396 Members | 1,968 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,396 software developers and data experts.

API calls

Hello...I want to use this API function im my projectHWND
CreateDialogParam( HINSTANCE hInstance,
LPCTSTR lpTemplateName,
HWND hWndParent,
DLGPROC lpDialogFunc,
LPARAM dwInitParam
);so i wrote this implementation:[DllImport("user32.dll")]public static
extern IntPtr CreateDialogParam ( IntPtr hInstance, string
lpTemplateName, IntPtr hWndParent, /*lpDialogFunc,*/ long
dwInitParam);what shoul i do with DLGPROC? It's pointer to function... I
created function like this:IntPtr DialogProc ( IntPtr hwndDlg, uint
uMsg, long wParam, long lParam);but... what to do next?thanx,David
I.
Nov 16 '05 #1
2 1611
> CreateDialogParam( HINSTANCE hInstance,
LPCTSTR lpTemplateName,
HWND hWndParent,
DLGPROC lpDialogFunc,
LPARAM dwInitParam
);so i wrote this implementation:[DllImport("user32.dll")]public static


if the lpDialogFunc should point to the C# function then you should convert
the function pointer in above definition to a delegate with proper
signature.

in your case declare the delegate:

public delegate IntPtr DlgprocDelegate( ...parameters... );

and call the API function:

CreateDialogParam(..., new DlgprocDelegate( method_with_proper_signature ),
.... )

but if the function pointer is going to be taken from somewhere else (for
example from native code) then try to pass an IntPtr value - function
pointer is just a pointer.

Wiktor Zychla
Nov 16 '05 #2
thanx

"Wiktor Zychla" <us**@nospam.com.eu> wrote in message
news:uP**************@TK2MSFTNGP09.phx.gbl...
CreateDialogParam( HINSTANCE hInstance,
LPCTSTR lpTemplateName,
HWND hWndParent,
DLGPROC lpDialogFunc,
LPARAM dwInitParam
);so i wrote this implementation:[DllImport("user32.dll")]public static


if the lpDialogFunc should point to the C# function then you should
convert the function pointer in above definition to a delegate with proper
signature.

in your case declare the delegate:

public delegate IntPtr DlgprocDelegate( ...parameters... );

and call the API function:

CreateDialogParam(..., new DlgprocDelegate(
method_with_proper_signature ), ... )

but if the function pointer is going to be taken from somewhere else (for
example from native code) then try to pass an IntPtr value - function
pointer is just a pointer.

Wiktor Zychla

Nov 16 '05 #3

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

Similar topics

12
by: Gil | last post by:
I am running a C++ process on Solaris that needs to find out how much diskspace is free and used on the system. Is 'system' in stdlib.h the only way to make OS calls from C++? In this case,...
9
by: Keith Briggs | last post by:
How can I trap library calls, say to puts, and get them to call a puts function I write, which then performs some special action before calling the real puts from libc? I tried all kinds of...
5
by: markus | last post by:
Hi, I have a question that deals with the standard c library VS (Unix) system calls. The question is: which header files (and functions) are part of the C library and which header files (and...
2
by: ghost | last post by:
As the Subject indicates I have written a web page that makes use of several web service calls. Some of the web service calls are very fast so they called synchronously. Some web service calls...
11
by: ryan | last post by:
Hi, I've omitted a large chunk of the code for clarity but the loop below is how I'm calling a delegate function asynchronously. After I start the each call I'm incrementing a counter and then...
6
by: A.M-SG | last post by:
Hi, We are developing a SmartClient application and we are planning to expose business objects layer to SmartClient application by using ASP.NET SOAP web services.
10
by: Brian Parker | last post by:
I inherited a C++ DLL that I need to remotely call multiple times asynchronously. What I have developed is: CSharp web application that makes asynchronous calls to a CSharp Web Service. The...
6
by: Dasn | last post by:
Hi, there. 'lines' is a large list of strings each of which is seperated by '\t' I wanna split each string into a list. For speed, using map() instead of 'for' loop. 'map(str.split, lines)'...
21
by: omkar pangarkar | last post by:
Hi all, I have two simple hello world programs one using printf() and other using write() --prog 1-- #include<stdio.h> #include<stdlib.h> int main() { printf("Hello"); /* up to here...
1
by: =?Utf-8?B?TWFyaw==?= | last post by:
Hi... There are a few questions wrapped up in this, but the main one is that the WebService.MyMethodAsync() methods that are automatically generated in the client code by VS 2005 don't seem to...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.