473,695 Members | 2,279 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with C# events in native C++ COM

I’m developing script system based on C# script for a game engine.
Scripts are written in C# and compiled at run time by a C# class library.
The native C++ game code accesses the script compiler class library through
a COM interface. Compile scripts are passed back to the native C++ game code
as COM interfaces as well. To run a script the game calls
pScript->Run(pGameInter face). The pGameInterface is another COM object
written in C# that is used to pass context data to the scripts.

What I would really like to do is allow the scripts to call a method on the
game interface object and have that object either fire an event handled by
the C++ game code or call a function in the C++ game code (maybe using
connection points).

Pseudo code:
pGameInterface. CreateInstance( CLSID)
pGameInterface. SetCallback(&Ca llBackHandler)
pScript->Run(pGameInter face)

Two important requirements are that the C++ code not use ATL or managed C++.
Anyone have suggestions on what would be the best and simplest solution.

Jan 5 '06 #1
1 1865
If you don't get a response to you question in this group, I would suggest
posting it in the "microsoft.publ ic.dotnet.frame work.interop" group.

--
Colin Neller
http://www.colinneller.com/blog
"Scythen" <Sc*****@discus sions.microsoft .com> wrote in message
news:41******** *************** ***********@mic rosoft.com...
I'm developing script system based on C# script for a game engine.
Scripts are written in C# and compiled at run time by a C# class library.
The native C++ game code accesses the script compiler class library
through
a COM interface. Compile scripts are passed back to the native C++ game
code
as COM interfaces as well. To run a script the game calls
pScript->Run(pGameInter face). The pGameInterface is another COM object
written in C# that is used to pass context data to the scripts.

What I would really like to do is allow the scripts to call a method on
the
game interface object and have that object either fire an event handled by
the C++ game code or call a function in the C++ game code (maybe using
connection points).

Pseudo code:
pGameInterface. CreateInstance( CLSID)
pGameInterface. SetCallback(&Ca llBackHandler)
pScript->Run(pGameInter face)

Two important requirements are that the C++ code not use ATL or managed
C++.
Anyone have suggestions on what would be the best and simplest solution.

Jan 5 '06 #2

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

Similar topics

28
1872
by: Dennis Owens | last post by:
I am trying to run a thread off of a form, and every once in a while the thread will raise an event for the form to read. When the form gets the event, the form will place the event into a dataset and display it on a datagrid that is on the form. The problem is that the thread will slowly take over all of the processor time. After about 8 events, the form will not even respond anymore. Here is the guts of my test code // Class and event for...
1
3370
by: Mohit Sachdeva | last post by:
Hello folks. I want my app to process windows events first, so that it has some kind of a "global hook". The scenario is - i want my app to process all messages for "F3" key (or any other key for that matter) first before any other window does it. This has to happen whether my app is minimized, inactive,not in focus, in systray etc.. I tried playing around with WndProc and overriding it but it doesnt capture all key events (WM_KEYDOWN)...
3
1156
by: mra | last post by:
I want to receive a notification (via an event), whenever a property of a class is modified. Of course, this would be possible if i write code such as the following to EACH "set" part of each property: if(Modified != null) Modified(this, EventArgs.Empty); //Modified is an event Yet, this is annoying. How could I avoid this code duplication? Do attributes help here somehow?
2
2854
by: Boris Fortes | last post by:
I need to unhook event receiver as result of native C++ event. It unhooks successfully, but __raise does not return and throws access violation. Visual Studio 2003 How to reproduce: Consol Win32 exe project
5
2599
by: Mong | last post by:
Hi, I have a webform with various asp controls on it such as textboxes and dropdownlists. I'm fairly new to asp.net coming from VB6 and am wondering when it's best to use client side events and when it's best to use server side events. For example, if a textbox is to contain a date I want to validate the date when that textbox loses the focus. If the date is not valid I make visible a label next to the textbox telling the user it's
0
1654
by: Alexander Czernay | last post by:
I created a VB.NET-PowerPoint-AddIn as described in the VisualStudio 2003 documentation. That works very well. The AddIn adds a new toolbar to PowerPoint if the active document is based on a certain master. So I had to catch all events that notify a change of the active presentation. For that, I made two approaches: 1. A method that handles the apropriate events directly via HANDLES:
0
5567
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
3
4926
by: MikeK | last post by:
Ok, I've been noodling with this for several days now and I'm starting to go crazy. Does Apple's Safari browser support drag events on Textarea elements? The few specs and docs I've found seem to indicate that it does but I can't get it to work for the life of me. I've tired everything I can think of to try get notifications for the events: ondragenter ondragleave ondragover ondrop
10
8460
by: blisspikle | last post by:
I see a lot of examples posted for Waitforsingleobject API for Processes or threads, but not events. I cannot get waitforsingleobject to subscribe to an event. I use a class PLCEthernet which is a dll I have a reference to, and I would like to wait for it to raise an event that it is done, before I continue on in my code. Thanks, Imports System.Runtime.InteropServices Public Class Form1
0
8635
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8574
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8990
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8829
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7664
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6493
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4342
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
1977
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.