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

DllImport and using Win32 API GetParent return no value

I wrote tiny sample of smart client using Win32 API and get parent IE's
handle as follow

[DllImport("User32.dll")]
public static extern IntPtr GetParent(IntPtr hWnd);
IntPtr cHandle = this.Handle; // this is smart client
IntPtr pHandle = GetParent(cHandle); // oHandle will be IE's handler

After getting pHandle, I'll get some properties of parent browser.
However, GetParent method return only zero not proper handler.

I want to know how to get the parent browser handler.

Thanks in advance...
Oct 30 '06 #1
1 9135
Hi Sanghoon,
check to see if there was an error getting the parent i.e.

[DllImport("User32.dll", SetLastError=true)]
public static extern IntPtr GetParent(IntPtr hWnd);

Then use Marshal.GetLastWin32Error() to see if there was an error code
created when you called the GetParent method, that may give you more
information. It is valid that the value coming back from this function is
zero in some cases.

Mark.
--
http://www.markdawson.org
"Sanghoon Lee" wrote:
I wrote tiny sample of smart client using Win32 API and get parent IE's
handle as follow

[DllImport("User32.dll")]
public static extern IntPtr GetParent(IntPtr hWnd);
IntPtr cHandle = this.Handle; // this is smart client
IntPtr pHandle = GetParent(cHandle); // oHandle will be IE's handler

After getting pHandle, I'll get some properties of parent browser.
However, GetParent method return only zero not proper handler.

I want to know how to get the parent browser handler.

Thanks in advance...
Oct 30 '06 #2

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

Similar topics

9
by: none | last post by:
Hello all, I wrote a shell program a few years ago in VB6 that needs to be modified. The problem I have is this: The SysAdmin uses this shell in place of Explorer, so there is no taskbar. When...
2
by: Paul Duncan | last post by:
diggityduncs (Programmer) Nov 13, 2003 Hello, I'm tring to use a win32/api dll in c# The vendor I received the dll from doesn't know anything about .net I received two files ACGAPI.DLL +
15
by: Jim | last post by:
I am extremely frustrated. I am building c# application for a call center and am using a third party API to access some hardware. When develop and test my class using the windows console the...
3
by: Mark Jerde | last post by:
I'm sill learning VS .NET 2003, not an expert yet. I'm calling an unmanaged C++ DLL from C# using . When the whole project is done I will be calling a total of 5 C++ DLLs from C#. All the DLLs...
5
by: Felix I. Wyss | last post by:
Good Afternoon, I recently noticed that some very simple methods of a template declared and used in a DLL library get inlined when used by the DLL itself, but not by other DLLs and EXEs. After...
2
by: =?Utf-8?B?U0FM?= | last post by:
Hello, I am getting the following error: "An attribute argument must be a constant expression, typeof expression or array creation expression" with this line of code on my GetDLLName() that...
1
by: bruce628 | last post by:
I want to use SWT Label and popmenu to construct a menubar ,and the effect of this menubar is same to the menubar in SWT.When click the Label,it should be highlighted and popmenu shows.The issue is...
6
by: vivekanandaprasanth | last post by:
hi, I have exported a class which i have written in win32 static lib app. Now i have written a wrapper class for the same. But when i am trying to compile it is giving me some linker errors....
1
by: JohnCox | last post by:
I have a simple Win32 DLL I wrote named "SimpleLib" that exports two functions. It is written in C++ and compiled with __stdcall (/Gz) and with the preprocessor definition _MBCS (not Unicode). ...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.