473,386 Members | 1,793 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,386 software developers and data experts.

hWnd on Controls's parent

I need to fetch hWnd IntPtr of the form, which hold user control from inside
the user control. How to do this.
this.Handle returns wrong results.

Another question form the same field:
I want to use ONE and ONLY ONE Interoped ActiveX on my control. So in the
control I make static axControl wich get hWnd of the windows to show itself.
I override all disposes (to keep the instance) and make dispose on main
application, BUT when openning new instance of the same Windows which holds
my control (with static ActiveX in it) the ActiveX disappears from the
previouse window. In debugger I can see that while oppening second window it
reuse the static ActiveX from previouse window and, of couse, ActiveX
support to be runned from different iunstances at the same time (checked in
C++ project - there it works fine) What is the problem? Maybe doing
something wrong ...
One more problem with the same thing. When closing ALL instances of the
forms (holds controls with AX) I get an error "Cannot access a disposed
object", when all disposes are overrided.

Please advice

--
Tamir Khason
You want dot.NET? Just ask:
"Please, www.dotnet.us "
Nov 16 '05 #1
1 4161
Tamir,

You should not be doing this. What happens when you use a static
instance is that you are reassigning the handle of the window to different
parents, which is causing it to not work. Windows are meant to have one
parent, and what you are trying to do is not supported.

If you want to get the host of the control, then you can call the
FindForm method on the control, and it will get the form that this control
is hosted on. Once you have that, you can get its handle through the Handle
property.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Tamir Khason" <ta**********@tcon-NOSPAM.co.il> wrote in message
news:O7**************@TK2MSFTNGP12.phx.gbl...
I need to fetch hWnd IntPtr of the form, which hold user control from
inside the user control. How to do this.
this.Handle returns wrong results.

Another question form the same field:
I want to use ONE and ONLY ONE Interoped ActiveX on my control. So in the
control I make static axControl wich get hWnd of the windows to show
itself.
I override all disposes (to keep the instance) and make dispose on main
application, BUT when openning new instance of the same Windows which
holds my control (with static ActiveX in it) the ActiveX disappears from
the previouse window. In debugger I can see that while oppening second
window it reuse the static ActiveX from previouse window and, of couse,
ActiveX support to be runned from different iunstances at the same time
(checked in C++ project - there it works fine) What is the problem? Maybe
doing something wrong ...
One more problem with the same thing. When closing ALL instances of the
forms (holds controls with AX) I get an error "Cannot access a disposed
object", when all disposes are overrided.

Please advice

--
Tamir Khason
You want dot.NET? Just ask:
"Please, www.dotnet.us "

Nov 16 '05 #2

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

Similar topics

2
by: WayneD | last post by:
Hi All, I'm writing a class that implements a COM interface. Unfortunately, one of the methods passes in an HWND and I'm supposed to create a control with that HWND as the parent. The idea is to...
5
by: Zürcher See | last post by:
The Control class has the Parent property that is readonly. When the control is added to a controls collection of another control the Parent property refers to that control. "Who" set the Parent...
17
by: Bonj | last post by:
Is PostQuitMessage(?) different to PostMessage(hWnd, WM_QUIT, ... ) ? I've got a window in a DLL (the same one experiencing the issue below, "return value of WM_QUIT") in which PostMessage(hWnd,...
0
by: mawi | last post by:
Hello, Description: I create panels with some controls on a page using a new panel button. One of the controls on each panel is the "close panel" button that is supposed to close the panel it...
5
by: tshad | last post by:
I have a PageInit.ascx that I want to put in all my pages and have it execute only once during the "not IsPostback" section. I also need it to execute first before anything else. I have it set...
6
by: Ronald S. Cook | last post by:
We have a Windows app that has one main form (a shell, sort of). We then load user controls into a panel on the form depending on what the user has selected. Our current code to unload the...
15
by: =?Utf-8?B?Sm9hY2hpbQ==?= | last post by:
How can I pass a C++ HWND to and from C# and Managed C++?
4
by: TS | last post by:
Steven, i lost this message conversation from outlook express and made a post online (see last one on this page). Please answer it as it hasn't been yet. thanks The clientID of our controls...
4
by: Andrew | last post by:
I want to create a set of Activity Diagram controls for process control. I need to create a base Diagram control that acts as a container for the Activity controls ( StartPoint, EndPoint,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.