|
Did you try passing the 3rd party app the HWND from:
HwndSource hWndSource = (HwndSource)PresentationSource.FromVisual(window);
The HWND in hWndSource.Handle and bypassing your C++ app entirely?
I don't think "visual not possible" is a WPF error, sounds like its coming from the 3rd party vendor. Have you tried contacting them if they support redirection?
|
|
|
|
|
Yes I tried your suggestion and still no success.
The 3rd party vendor don't consider this to be a valid customer API request as this is something they use internally (they have couple of apps that can do this and they have some interop wpf dll's for this but it is not exposed for others)
|
|
|
|
|
Hmmm... maybe its not possible then. If you can do it in C++, then you should be able to take that C++ window and host it on a WPF form. My only other suggestion would be to maybe package it as an ActiveX control and then host that on the WPF form natively. Not sure if it will work though...
|
|
|
|
|
Just as a note, this two methods return the same hwnd (I was using the later option).
Window www = App.Current.MainWindow;
HwndSource hwndS = (HwndSource)PresentationSource.FromVisual(www);
Console.WriteLine("hwndSource: " + hwndS.Handle);
IntPtr hwnd = new WindowInteropHelper(www).Handle;
Console.WriteLine("hwnd: " + hwnd);
I also thought it would be simple. Just create a c++ win32 window inside of wpf and all would work but somehow it is not that simple. I'll try some more options I found online.
My guess is that I need to somehow paste info from BeginPaint(IntPtr hwnd, PAINTSTRUCT ps) PAINTSTRUCT to overriden OnRender(DrawingContext dc) DrawingContext.
But that probably won't work either.
Anyway thx for help.
|
|
|
|
|
I just noticed it now in your previous response, but you said they have interop WPF dlls that are working? Why don't you just use those? Are those written in C# or C++? If they are written in C#, you can view the exact code by using ILSpy, .NET Reflector, etc. If they are written in C++, you can view the DLL exports easily using the dumpbin utility that comes with Visual Studio.
|
|
|
|
|
I believe they are written in C#, or maybe they are managed C++.
But they name says that they are _.Interop.Wpf.dll
Will try to examine it as you suggested.
|
|
|
|
|
Hi,
You're rather trying to do something that will break WPF!
WPF is rendered using DirectX. The whole thing, there is just a window wrapper for win32 environment. You cannot do anything by passing it an WM_PAINT message.
Here comes the fix. Set up a winforms host inside your app xaml. Put a label control (winforms equivalent of STATIC) inside the host . Set the text to empty. get it's HWND by getting its Handle property and pass it to your native library that does OpenGL stuff through P/Invoke.
Here is a MSDN Walkthrough to guide you. Just replace that MaskedTextBox code with a Label.
Good Luck!
|
|
|
|
|
How to create radio buttons dynamically as shown below in WPF
Group1 Group2 . . . . . GroupN
A 1
B 2
C 3 . . . . . N
|
|
|
|
|
Id proberbly use a DataTable or a ListView for this, but there are also other more cumbersome possibilities:
WPF-Drawing Canvas Control[^]
|
|
|
|
|
Host your groups and radio buttons in a collection control, datagrid, listview, treeview, itemscontainer and bind the itemssource to your underlying collection.
Limit n to a workable number.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
I just moved to a new company. And they use this seemingly cool ORM: IdeaBlade, will let the developer do Linq2SQL on the client (Silverlight) side.
There are performance issue though...
Haven't work with real data yet (it's big) but just the ORM seems to have some down time (due to initialization and query parsing)
I wonder did anyone here used IdeaBlade (DevForce)? is it good?
How does it compare to WCFDataService?
|
|
|
|
|
Hi All,
Can anybody help me in wpf mvvm pattern.
I am facing an issue i.e., i created a login form and main window (after login, if login sucessfull). I implemented the application in mvvm pattern. I don't know how to call the main window after sucessful login using mvvm. Can anybody help me out from here.
Thanks
Kishore
|
|
|
|
|
There are plenty of navigation examples[^] around, it is not as simple as you may think but once you have set up the navigation framework it is a no brainer.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I am asking in wpf i.e., navigation between windows.
|
|
|
|
|
My bad - try this nifty focus change wpf navigation example[^]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
didnt find any solution..
|
|
|
|
|
I generally override the OnStartup method on my App class and then call my Login View modally, which returns a bool indicating whether login was successful. Something like this (very simplified):-
LoginView login = new LoginView();
login.ShowDialog();
if(login.LoginSuccess)
{
Mainwindow window = new Mainwindow();
}
else
{
}
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
Found the solution
|
|
|
|
|
Excellent! It is a good idea to link to the articles/resources that you found useful as they will help the next person when they search this forum.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hello.
I would like to present in a flat area a tree like view.
Each item would be a non-movable panel with its own controls. Each child will have connected with a line (Also selectable). On top of it, some childs are going to have multiple parrents. The closest that i have seen to compare is code map in VS2012 Update 2.
Example: Panel 1 and 2 are parents of panel 3
Panel1 Panel2
| |
---------
|
Panel3
I would like some pointers where to go, or if there is a custom control as long as it is free and can redistribute with or without source code. When i finish my personal project i will release source. As i am hobbiest programmer, my understanding on WPF is limited, so thank you for your time and patience.
|
|
|
|
|
|
Thanks for suggestion, but i didn't knew what to search. I am currently reading a WPF book and in a book i saw word diagram in it. At that moment i found WPF Diagram Designer article that is perfect. Since my native language is not english i could not remeber word, that would help me search on google
|
|
|
|
|
Maybe this is a simple question...
I created a search control in WPF. I then placed it on a view. Since the view doesn't know about the user control, how can it get data off of it, or make calls into it.
I tried using a messenger, but when there is more than one instance of the user control running, they al get the message.
What's the right way to do this?
Thanks
If it's not broken, fix it until it is
|
|
|
|
|
Maxx wrote an article where his messages have a destination that consumes the message and it does not propagate further.
Just off the top of my head I would create a search interface on each VM that handles the interaction and pass the VM to the search VM onnavigateto of the view.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thanks
Can you point me to the article?
If it's not broken, fix it until it is
|
|
|
|