|
Well i looked a solution to call function from a process that is complitly different from another process so i readed about Interprocess Communication. Now i have only seen some data moving data copying and some text show up tutorials but there is nothing about how to call a function from another process can anyone point me somewhere...?
|
|
|
|
|
Are you sure you want a .NET answer? If you want an answer from a native code perspective, you should post this in the C++ forum (this is the C++/CLI forum).
|
|
|
|
|
hi, i am looking for Open Source QRCode Library, do you where i can find one?
i managed to find an article here but it is for C#, but i am looking for C++ .Net or MFC Library, tried google but still no luck,.
if you know an article here in code project then better, love this forum.. or am i in the wrong forum site the ask this question?
thanks ahead,
|
|
|
|
|
If you are open to using C++/CLI it should be fairly easy to wrap the C# library for use from native code. A C++/CLI version of the library will not offer you any additional advantages over the C# version.
|
|
|
|
|
i reviewed the article posted by twit88, and i would say the syntax looks like C++, well except for the minor difference, i think i can manage to wrap it to C++ to fit my needs,.
but still if you could post something C++ for me to read on it would be better,. but right now i gues i have t stick with C# for awhile to learn the flow of the code..
thanks Nish,
|
|
|
|
|
did you fnd a c++ sample already?...we have the same problem..
i can't search for a c++ qrcode encode sample..even a dll..if you found
one please share it...thanks
|
|
|
|
|
Hi Folks,
I am planning to show a dialog (which will act as a drop down list) on any text editor where the user presses a key combination. I would like to know how I can make the dialog work as if it is part of the application on which it is invoked.
I need to achieve the following things.
1. I want to close dialog when the main application shuts down.
2. I don’t want to take the focus away from the editor when the dialog is active.
3. I want to get the focus on the dialog only when user presses arrow buttons.
4. I want to insert the text selected from the dialog onto the editor
The dialog will help the user to auto complete words. I have done the hooking part.
Please advice.
Thanks in advance,
John.
|
|
|
|
|
Unless you specifically want a managed solution, and you are also working in C++/CLI, you may have better luck posting this in the Native C++ forum.
|
|
|
|
|
C++ CLI .NET 3.5 with VS 2008
When I click into a datagrid cell, I have it coded so that the background changes to yellow.
However when I double click to change the cell content, I loose the yellow effect.
How can I retain it?
Ger
|
|
|
|
|
|
I've got a C++ app that makes calls into a C# library.
One of the calls in the C# lib is:
void myFunc ( bool Flag )
I've done some marshalling for strings in other functions, but the bool has me scratching my head.
How do I convert my C++ BOOL to a .NET bool for my C# call?
What am I overlooking? Any help you could send would be appreciated.
Cheers.
Mike.
|
|
|
|
|
Mike Doner wrote: How do I convert my C++ BOOL to a .NET bool for my C# call?
The C++ BOOL translates to the C# int. In C++, a BOOL evaluates to FALSE if it's 0,and to TRUE if it's non-zero (though typically TRUE evaluates to 1). To convert a BOOL value to the C# bool, compare with 0. Example:
BOOL cpp = TRUE;
bool cs = (bool)(cpp != 0);
C++/CLI correctly treats bool as the .NET bool type.
[Edit]when I said evaluate above, it practically means a #define since there is no actual evaluation there[/Edit]
|
|
|
|
|
Thanks Nish,
That did it... I knew it had to be simple.
Cheers.
M.
|
|
|
|
|
I'm using the HookManager class provided here:
Processing Global Mouse and Keyboard Hooks in C#[^]
I've reduced the included demo app to do nothing but trap mouse movement and print a message each time. The code looks like this:
using System;
using System.Windows.Forms;
using UserActivityMonitor;
namespace UserActivityMonitorDemo
{
public partial class TestFormStatic : Form
{
public TestFormStatic()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
HookManager.MouseMove += HookManager_MouseMove;
}
private void HookManager_MouseMove(object sender, MouseEventArgs e)
{
textBoxLog.Text += "Mouse was moved!" + System.Environment.NewLine;
}
}
}
I want to be able to use this in C++, but I'm not really sure how to handle events in managed C++, and searching through Google/MSDN is giving me mixed messages. This is more or less what I tried first:
#include "stdafx.h"
#include <iostream>
using namespace System;
using namespace System::Windows::Forms;
using namespace UserActivityMonitor;
using namespace std;
void HookManager_MouseMove(Object^ sender, MouseEventArgs^ e)
{
cout << "Mouse was moved!\n";
}
int _tmain(int argc, _TCHAR* argv[])
{
HookManager::MouseMove += HookManager_MouseMove;
while (true)
{
::System::Threading::Thread::Sleep(100);
}
return 0;
}
It won't compile. The part where I'm trying to add the HookManager_MouseMove function gives this error:
error C2664: 'UserActivityMonitor::HookManager::MouseMove::add' : cannot convert parameter 1 from 'void (__clrcall *)(System::Object ^,System::Windows::Forms::MouseEventArgs ^)' to 'System::Windows::Forms::MouseEventHandler ^'
I've tried changing the function from void to MouseEventHandler, but then I have to make it return a value, and I have no idea what to do about that, so I suspect that's barking up the wrong tree. What do I do?
Thanks.
|
|
|
|
|
Move the HookManager_MouseMove function to a ref class as a static method. That should work.
|
|
|
|
|
HookManager::MouseMove += gcnew fooDelegate(this, &TestFormStatic::HookManager_MouseMove);
(replace 'fooDelegate' with the appropriate delegate.
David Anton
Convert between VB, C#, C++, & Java
www.tangiblesoftwaresolutions.com
|
|
|
|
|
Thanks, but I think there's something I don't get about using delegates. I've been reading up on it, and I've been following the example here:
http://www.java2s.com/Code/Cpp.net/Delegate/Fireeventsandeventhandlers.htm[^]
Now my code looks like this:
#include "stdafx.h"
#include <iostream>
using namespace System;
using namespace System::Windows::Forms;
using namespace UserActivityMonitor;
using namespace std;
ref class MyEventArgs : MouseEventArgs
{
public:
property String^ Info;
MyEventArgs(String^ info, MouseButtons button, int clicks, int x, int y, int delta) : MouseEventArgs(button, clicks, x, y, delta)
{
Info = info;
}
};
delegate void MyEventHandler(Object^ sender, MouseEventArgs^ args);
int _tmain(int argc, _TCHAR* argv[])
{
Events^ events = gcnew Events();
HookManager::MouseMove += gcnew MouseEventHandler(events, &Events::HookManager_MouseMove);
while (true)
{
::System::Threading::Thread::Sleep(100);
}
return 0;
}
It compiles, but when it runs, nothing happens. And I'm not sure what the line starting with delegate void MyEventHandler is supposed to accomplish - my code compiles fine without it, and the example code makes no reference to it. Attempts to read up on managed C++ delegates are making me very confused.
|
|
|
|
|
I'm working on a large MFC application in VS2005, where a complete rewrite is not an option as it would take years.
Instead I'm trying to enable support for .NET plugins, so expert users of the MFC application can write their own .NET classes, which can be loaded dynamically into the MFC application.
I'm using the following example as inspiration:
Hosting a WinForms User Control in an MFC Application[^]
I'm curious if anyone is having any experience in this scenario. I have found that starting a .NET WinForm as a modal CDialog is very easy as one just can call ShowModal. But integrating a .NET WinForm as a CFormView requires that it is a .NET usercontrol within a MFC window.
Not sure if I should require that any .NET WinForm should by implemented as a usercontrol, independent of it should work as a CDialog or CFormView ?
|
|
|
|
|
|
The example you have posted puts a text box control on a MFC Dialog using the CWinFormsControl. Pretty sure that CWinFormsControl cannot host anything but .NET controls.
I don't see anywhere that they take WinForm and hosts it in a MFC CFormView. I have tried to use CWinFormsView and it fails when given the typeid of a .NET Winform, but succeeds when given the typeid of a .NET Control.
I'm looking for people with experience in this area, that might show some light in this tunnel where I'm walking.
I'm curious of how one would solve the issue with getting the .NET control to close the MFC CFormView, change icon/title of the MFC CFormView. The .NET control doesn't get a parent window-object, but only a win32 window handle (integer). My current solution is to have an explicit SetParent on the user-control and make my CWinFormsView-object also inherit from a parent-interface. I don't want my .NET user-control to know anything about the awful world of CLI/Interop.
modified on Thursday, September 23, 2010 3:11 AM
|
|
|
|
|
I've never had to do that yet but here's one way I would have approached it:
Write a generic .NET user control that can host a WinForms form. And then the CWinFormsView will host this user-control. So your end-users can add their forms and then when you want to host it in the view, you host it via the user-control (which will wrap the form).
It will be tricky to do I guess, but certainly worth a shot.
|
|
|
|
|
I like the idea of hosting a WinForm, but do you have any idea how to do this ?
So far the only thing I have found is how to host a WinForm inside af WPF form. I don't know if I should get into hosting a WPF-Control, that hosts a WinForm-control using WindowsFormsHost.
I guess it will require even more code on the generic user-control to wrap around the custom WinForm so it reacts properly to its events.
modified on Thursday, September 23, 2010 9:42 AM
|
|
|
|
|
Rolf Kristensen wrote: I guess it will require even more code on the generic user-control to wrap around the custom WinForm so it reacts properly to its events.
It will require a fair bit of work, but once you do it, then your end clients won't have to repeat all that extra work each time they write a plugin/add-on. Since I've never had to do that I can't think of any immediate ideas off the top of my head. If I do get some time, I may try and work on a simple prototype (at least that way I can establish if it's practically doable or not). Alternatively, if you start on something and hit a hurdle, it'd be great if you can continue discussing it here.
|
|
|
|
|
Attempting to dig into C++/CLI by wrapping VLC with it. You'd know the very fist thing I run across is conversions between arrays in C++/CLI and C++.
Are there any 'conversion' libraries/utilities out there??
Thanks,
ed
~"Watch your thoughts; they become your words. Watch your words they become your actions.
Watch your actions; they become your habits. Watch your habits; they become your character.
Watch your character; it becomes your destiny."
-Frank Outlaw.
|
|
|
|
|
Ed K wrote: Conversion between array<String^>^ and const char *const* and back
You don't need any library functions to do this. It's simple enough to write.
Converting String^ to char*
String^ str = "Hello world!";
IntPtr p = Marshal::StringToHGlobalAnsi(str);
char *nativeString = static_cast<char*>(p.ToPointer());
Marshal::FreeHGlobal(p);
Converting char* to String^
const char* native = "hello world";
String^ managed = gcnew String(f); Now you know the basic conversions and it will be easy to create const char *const* from a managed string array.
Best wishes,
Navaneeth
|
|
|
|