|
Hi Chris,
have you been successful in connecting the MFC and Windows Forms world?
I currently have a similar problem: We want to expose a Windows Forms control as ActiveX and have no real clue on how to do this. As far as I can see there are some completely different approaches. One would be using a MFC ActiveX as host container for the Windows Forms control. And then using CWinFormsDialog or CWinFormsView to host the Windows Forms control. Another approach would be to rebuild the complete ActiveX interfaces with C# and expose it directly to COM.
So far, we tried approach one and created a MFC ActiveX container to host the Windows Forms control. Now, as we switched on Common Language Runtime support (/clr) we have the major problem that Visual Studio 2005 gets locked up while loading the project. Did you experience something similar? It really seems to have nothing to do with our project, VS2005 stop when loading CRT dlls like 'mscoree.dll', 'mscorwks.dll'.
The only thread I found about the problem is this[^]
Using MFC as unmanaged host for WinForms controls seems to be documented very badly. The basic examples[^] work flawlessly but if you want to do the same thing with a MFC ActiveX nothing seems to work!
Perhaps you can share a bit of your knowledge with me?
cheers,
mykel
If they give you lined paper, write the other way!
|
|
|
|
|
Thanks again for the help.
Chris
|
|
|
|
|
Chris, your post in the C# forum is headed in the wrong direction. Any native C++ code, which is what VC6 is, cannot call into a .NET (managed) library. .NET libraries cannot export function in _cdecl form.
VC7 and VC8 introduced support for "mixed mode" development. This provides the ability for DLLs developed using those tools to export plain C++ interfaces to native code, while accessing the managed world at the same time. You will need to use one of them to bridge between "native" and "managed" worlds, without COM or ActiveX.
Perhaps you should use Google to find some articles on MSDN and read about this a little before you begin.
led mike
|
|
|
|
|
My function looks somethin like that : :
void SEHWrapper(RPC_BINDING_HANDLE &pbh, wiret_STREAMS NewJobList[], char Flags)
{
...
c_SubmitNewList(pbh, sizeof NewJobList / sizeof(wiret_STREAMS), NewJobList, Flags);
...
}
This doesn't work. The Debugger tells me, that sizeof NewJobList returns 4. Why is that so ? Shouldn't it return the size of the array in bytes ? The array is statically allocated in the calling function.
|
|
|
|
|
Mr.Brainley wrote: void SEHWrapper(RPC_BINDING_HANDLE &pbh, wiret_STREAMS NewJobList[], char Flags)
Here wiret_STREAMS NewJobList[] is equvivalent to wiret_STREAMS *NewJobList , and hence its giving sizeof(NewJobList) as 4(sizeof int).
|
|
|
|
|
an array is actually a pointer to the 1st element of that array. so, as you are on a 32 bits system, your pointer is 4 bytes wide...
|
|
|
|
|
If your array is allocated on the heap, sizeof will only return the size of the pointer to the memory you allocated (not the memory size that was allocated there). This isn't the case on the stack (where it will return the size of your array in bytes).
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
The compiler does not know who calls the function! The only thing he knows is that this is a pointer!
|
|
|
|
|
Using VS-2005, when creating a dialog control using the resource editor and toolbox, all windows are created with a 3-D/sunken type border instead of a basic flat border. No combination of border property settings (StaticEdge, ModalFrame, ClientEdge, Borders) will allow the basic flat border. If I create the controls in code the borders are as advertised so it appears somewhere the VS is overriding my properties. Anyone know where this is done?
Thanks in advance,
Tracy Hanahan
tsh5@psu.edu
|
|
|
|
|
Hi all,
I am writing a namespace extension and have run into a little problem. I havea a context menu handler that gets called with 'open' when the user double clicks on a subfolder of my namespace extension. At the moment I take the PIDL of the subfolder, turn it into a real path and call ShellExecuteEx on it. However, this always opens the subfolder in a new window- I want it to open in the existing window.
Is there a function of IShellFolder I can call to open the desired PIDL? I've tried BindToObject but it doesn't work.
Any help would be much appreciated, this is really holding my work back now...
Thanks in advance,
Dave Kerr
codechamber@hotmail.com
http://www.codechamber.com
|
|
|
|
|
Hi, i have a small problem i hope to get some help with.
I am working with the SerialPort class in .NET 2.0. I want to use the SerialPort's write() method as defined below with the following overloaded arguments.
public:
void Write (
array<unsigned char="">^ buffer,
int offset,
int count
)
The program on the other end of the serialPort is using C code. The serialPort on the other end uses a serial port read function which takes in a unsigned char array.
ie. void read(unsigned int i)
Does anyone have any ideas how i can pass my data through? (ie from a CLR array to a function that takes native arrays). I am stuck as there are no overloaded write methods in SerialPort class which allow me to pass a native array. I can only think of one solution at the moment, and that is deriving my own class inherited from SerialPort and overload the write method to take in a native array, but i have no idea to write a method which will write data to a serial port.
PS. most of my work is already completed in .NET so there is no chance of starting over in unmanaged C++, and the other end cannot be changed to .NET as it is legacy system.
|
|
|
|
|
The SerialPort class does NOT send a managed array. It writes the contents of the array to the port.
flackjack wrote: which takes in a unsigned char array.
flackjack wrote: ie. void read(unsigned int i)
unsigned char is NOT EQUAL to unsigned int
so whatever it actually is, you need the data in your managed array to be of the same byte size so the read() function will work correctly. Once you are clear what the read() signature is you can find documentation on MSDN that shows the managed to unmanaged byte size mapping. Also PInvoke.net[^] might be another source of useful information.
led mike
|
|
|
|
|
sorry that was a typo, it should be
void read (unsigned char c)
now that i think of it, it makes alot of sense now that it does not send the array and only writes the bytes.
can anyone point me to "managed to unmanaged byte size mapping" information?
Regards
|
|
|
|
|
can anyone point me to "managed to unmanaged byte size mapping" information? I've tried looking through MSDN but I'm not completely sure where to find it.
Thanks
|
|
|
|
|
Hi,
I try to send a WM_CLOSE to shut down an application, but the problem is that the program crash if there is o modal dialog opened
I get an assertion inside the DoModal() function!!
Help please..
Thanks
|
|
|
|
|
hatemtaleb wrote: try to send a WM_CLOSE to shut down an application, but the problem is that the program crash if there is o modal dialog opened
Show some code !
|
|
|
|
|
Its not sufficient can you be more specific
|
|
|
|
|
Hi all
Can anyone tell me definition of Smartpointers in simple
by
G. Palani samy
|
|
|
|
|
They are classes that wrap a pointer and delete it when the object goes out of scope. Typically, you pass in the pointer in the constructor of a smart pointer, and the destructor will delete it. There are also some smart pointers that do reference counting and will only delete the pointer once the count has reached 0.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
|
I am working with old Visual C++ 6 and cannot leave it for new version. I am not satisfied by its debugger – it is uncomfortable. For instance, I cannot resize window Quick Watch; and so on.
The question is: is there an extension (as plug-in, maybe) that gives Visual C++ 6 additional debugging abilities?
|
|
|
|
|
KellyLynch wrote: For instance, I cannot resize window Quick Watch; and so on.
Yes you can.
VC6 was the best debugger of its day. VS.Net has a more powerful debugger with some new bells and whistles. What is it you want to do?
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
>Yes you can.
You meant I can resize the Quick Watch window? How?
|
|
|
|
|
KellyLynch wrote: You meant I can resize the Quick Watch window? How?
The same way you resize any other window. It just doesn't have the nifty gripper icon in the corner when its undocked.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
how can i Remove leading spaces and trailing spaces from my database ?
Bravoone
|
|
|
|