Win32API.FindWindowByID for a VB Application ControlID returns zero..why?

Hello,

There are 3 applications as given below

1. CRM Web application

2. .Net Asset Maintenance ( C# based) Software

3. Inventory Control applicaton developed in VB6.0

that I am integrating with AgentDesktop

I have written three adapters for all the above so that when a new issue is created in CRM web app , it send the "Problem/Issue description" to other apps. They in turn will use the data and manipulate it.

The adapter for .Net application works fine.But the VB6.0 adapter is having issues.Using spy++, I found out the ControlID (Which is 00000008). Following is the code to populate the textbox in VB app with the data it reccives

public override bool DoAction(Action action, ref string data)

{

if (action.Name == "CreateTicket")
{
IntPtr txtDesc;
txtDesc = Win32API.FindWindowByID(this.process.MainWindowHandle, 8);
Win32API.SetWindowTextAny(txtDesc, data);

}
return true;

}

The above piece of code doesn't work at all.When I debugged I foundWin32API.FindWindowByIDfunctionreturns 0 (Zero).Any idea why and how to resolve the same?

Is it because it is a VB App. Thanks in advance

[2207 byte] By [SankaraNarayananNagalingam] at [2008-1-31]
# 1

There's no FindWindowByID API - is that an alias for GetDlgItem? How is it declared?

Are you sure the control is a direct child control of the main window?

MattiasSj?gren at 2007-9-4 > top of Msdn Tech,Customer Care Framework,Customer Care Framework...
# 2

I hope you are aware of CCF/worked on CCF adapters. It is part of Microsoft.Ccf.csr.Win32API assembly. Yes it is the direct child control(just out of curiosity. how is it different if it is not a direct control)

# 3

Sorry, I missed the fact that you were posting in the CCF forum. I really don't know anything about CCF, but from the name is sure looks like that assembly is just a wrapper for Win32 APIs.

GetDlgItem (if that's the API being called internally) only looks for direct child controls. If you need a control deeper down in the hierarchy you need multiple calls.

MattiasSj?gren at 2007-9-4 > top of Msdn Tech,Customer Care Framework,Customer Care Framework...