Rightthen

Rightthen

  • NA
  • 31
  • 14.8k

Cant Get GetWindowLong To work

Feb 29 2008 3:10 AM

GentleMen,

I am Using Win32api in C# to get the job done
I am also Creating Threads in this application Actually it is only one thread

Here is the summary:-

Main Programm Thread Executes the programm untill it reaches a
place in the code where it has to click a buton on the internet explorer page
Clicking that Opens a dialogbox ASking wheather i want to save open the file or cancel the
dialog box.
At this click Programm breaks into two
1) Main Programm Thread
2) Addtional thread i make to proccess dialog boxes

I have made extra thread because Downloading and browsing on internet
Takes time. so internet stuff is dealt with this thread
once it has fetched what i want; it closes internet explorer and
Main Application thread Figures out the Information i want and displays it.

Brothers proccessing this dialog box and others that will follow it would be
done by this extra thread.

Now it handles well :-
Sort of thing which goes in this thread is like this

ThreadProc()
{
 1) string NameOfTheButtonToClick = "Close" // or anything;

 KeepLooping
 {
  FindtheButtonInTheDialogBox (NameOfTheButtonToClick ); Is fOund
  if Found Exist Loop
 }
}

FindtheButtonInTheDialogBox(NameOfTheButtonToClick)
 {
   Enums All The Child Windows Of the dialogBox
   That Internet Explorer Dispalys
             FOr that it passes the EnumChildWindowsProc Address To EnumChildWindows Win32APi Function

 }

EnumChildWindowsProc( )
{

   When it finds the window with the given TExt
    Found = true
   I make it click it In DIalog Box


}

 

Once the file has been downloaded from INternet Explorer The programm has to
Display the INformation that i have programmed it to fetch.it does it well

Problem is this
i order to put this FIlename in save dialog box i am using Sendkeys.
ANd you know Sendkeys needs the Place to be in focus That brings the limitation to
it.that i cant do anything else when it has to happen

using WM_char with SendMessage has the same problem of focus
Wm_SETTEXT does not work on it while WM_GETTEXT works well
I was thinking if WM_SETTEXT has been disabled or what
in order to do that i wanted to get the wndproc address
and use my wndproc to proccess this dialog box messages

but Getwindowlong is not working and neither setwindowlong

[DllImport("User32", CharSet = CharSet.Auto,SetLastError = true)]
                unsafe public static extern System.IntPtr  GetWindowLong (
                                        System.IntPtr hWnd,
                                        System.Int32 nIndex 
               
                ) ;

i have even tried
[DllImport("User32", CharSet = CharSet.Ansi, SetLastError = true)]
                unsafe public static extern System.IntPtr GetWindowLongA(
                                        System.IntPtr hWnd,
                                        System.Int32 nIndex

                );

 


System.IntPtr WinProc1 =
   GetWindowLongA( HwndDlg ,
   GETWINDOWLONG.GWL_WNDPROC
                        ) ;

What is wrong

caution: this is not asp.net app it is simple desktop app dealing with few internet stuff

Asp.net ; i am not that smart


Thankyou
RIGHT_THEN