Click here to Skip to main content
15,921,959 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In XYZ.xaml
.........
.........
<Button HorizontalAlignment ="Left" VerticalAlignment="Top" Name="NewFooBtn" Click="MyFunction_Click" ToolTip="NewFoo">NewFoo/Button>
.........
.........

In XYZ.xaml.cs:
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern IntPtr FindWindow(string strClassName, string strWindowName);
[DllImport("user32.dll")]
static extern bool ShowWindow(IntPtr hWnd, SHOW_WINDOW nCmdShow);
[DllImport("user32.dll")]
static extern bool BringWindowToTop(IntPtr hWnd);
....
....
public void MyFunction_Click(object sender, RoutedEventArgs e)
{
IntPtr hndl = FindWindow(null, "MSTK2.0.2");
if (hndl != IntPtr.Zero)
{
ShowWindow(hndl, SHOW_WINDOW.SW_RESTORE);
BringWindowToTop(hndl);
return;
}
}
Error 11 The name 'FindWindow' does not exist in the current context E:\23_01_2012_6PM\23_01_2012_9AM\20_01_2012_9AM\MyProj.xaml.cs 430 31Error
12 The name 'ShowWindow' does not exist in the current context E:\23_01_2012_6PM\23_01_2012_9AM\20_01_2012_9AM\MyProj.xaml.cs 433 21
Error 13 The name 'SHOW_WINDOW' does not exist in the current context
E:\23_01_2012_6PM\23_01_2012_9AM\20_01_2012_9AM\MyProj.xaml. 433 38
Error 14 The name 'BringWindowToTop' does not exist in the current context
E:\23_01_2012_6PM\23_01_2012_9AM\20_01_2012_9AM\MyProj.xaml.cs 434 21

How can I resolve the above error., I am using WPF as development(IDE),
Any Help in resolving above would be much appreciable.
Also, using VS2008
on Win 7 o/s.
With Regards,
Samanth_90
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900