473,396 Members | 1,987 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.

C# Call back function - Evalcom2

Hi,

I am trying to use the EvalCom2.dll to validate a MSI -
http://msdn.microsoft.com/library/de..._setstatus.asp

I have the following code so far...

using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Security.Permissions;
namespace MsiIce
{
public delegate int DisplayVal ( IntPtr pContext , Int32 uiType ,
string szwVal , string szwDescription , string szwLocation );
public delegate bool Evalcomcallback ( Int32 iStatus , string
szwData , IntPtr pContext );

[GuidAttribute ( "6E5E1910-8053-4660-B795-6B612E29BC58" )]
[ClassInterfaceAttribute ( ClassInterfaceType.None )]
[ComImportAttribute ()]
[SecurityPermission ( SecurityAction.Demand , UnmanagedCode = true
)]
class EvalClass
{
[DllImport ( "evalcom2.dll" )]
public static extern int LPDisplayVal ( DisplayVal x , IntPtr y
);
public static extern int LPEVALCOMCALLBACK ( Evalcomcallback x
, IntPtr y );
}
[InterfaceTypeAttribute ( ComInterfaceType.InterfaceIsIUnknown )]
[GuidAttribute ( "E482E5C6-E31E-4143-A2E6-DBC3D8E4B8D3" )]
[ComImportAttribute ()]

public interface IValidate
{
Int32 OpenDatabase ( [MarshalAs ( UnmanagedType.LPWStr )]
string szDatabase );
Int32 CloseDatabase ( );
Int32 OpenCUB ( [MarshalAs ( UnmanagedType.LPWStr )] string
szCUBFile );
Int32 CloseCUB ( );
Int32 Validate ( [MarshalAs ( UnmanagedType.LPWStr )] string
szICEs );
Int32 SetDisplay ( [MarshalAs ( UnmanagedType.LPWStr )]
DisplayVal pDisplayFunction , IntPtr pContext );
Int32 SetStatus ( [MarshalAs ( UnmanagedType.LPWStr )]
Evalcomcallback pStatusFunction , IntPtr pContext );

}
}

I do not understand how to use this code with a program to preform the
function I need to validate the MSI..Any help will be great.. thank you
Josh

Dec 1 '06 #1
1 4121
Here is an example. I dont know much about the msi stuff

class EvalClass
{
[DllImport ( "evalcom2.dll" )]
public static extern int LPDisplayVal ( DisplayVal x , IntPtr y
);
public static extern int LPEVALCOMCALLBACK ( Evalcomcallback x
, IntPtr y );

public static bool IsValid ( Evalcomcallback x
, IntPtr y )
{
EvalHandler _EvalHandler = new EvalHanlder();
LPEVALCOMCALLBACK _Handler = new LPEVALCOMCALLBACK ( EvalHandlerMethod);

return _EvalHandler._IsValid;

}

private bool EvalHandlerMethod ( STATUSTYPES iStatus,
LPCWSTR szwData,
LPVOID pContext )
{
return iStatus == ieStatusSuccess;
}
private bool _IsValid = false;

private EvalHandler()
{

}

}
---
Posted via DotNetSlackers.com
Dec 1 '06 #2

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

Similar topics

39
by: Randell D. | last post by:
Folks, I'm sure this can be done legally, and not thru tricks of the trade - I hope someone can help. I'm writing a 'tool' (a function) which can be used generically in any of my projects. ...
6
by: Vinay | last post by:
Hi Everybody I have been looking out for a Function call tree command in Unix environment. Given a piece of source code(millions of lines), there is a function F1() calling F2() calling F3()....
11
by: yangsuli | last post by:
i want to creat a link when somebody click the link the php script calls a function,then display itself :) i have tried <a href=<? funtion(); echo=$_server ?>text</a> but it will call the...
11
by: Felix Kater | last post by:
Hi, I can compile and run this code (see below) which twice calls the function f, first with too less, second with too much arguments. But is it legal and free of memory leaks and other...
17
by: Sara | last post by:
Hi, I'm having a problem with my program and I think it stems from me not understand how to call a function and return a int value to main. What I have to do is create a program that runs...
11
by: sameer.oak | last post by:
I am looking for some comprehensive tutorials on how to write call back functions in C. Can anyone help me? - sameer oak.
1
by: gabe | last post by:
How do you call a client side javascript callback method after an update panel has posted back to the server? I have two update panels (A + B) with a gridview in each panel. GridView B has a...
6
by: =?Utf-8?B?Sm9lbWFuYw==?= | last post by:
Hi, I'm trying to figure out the Callback method. I have a .dll that I call from a sub in my unmanaged code/calling program. That works just fine. But I'd like to have the .dll finish doing it's...
0
by: tomb | last post by:
Can anybody help me by checking if I have correct call signatures? In my C# Windows Form project (VS2008) I am using dll which has been written for Visual C++ 6.0: This function code is used to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.