SetParent API cannot set focus - Solved

Visual Basic

    Next

  • 1. ZORDER using API
    Hi all How do I set the ZORDER using API ? TIA Guy
  • 2. Common Print Dialog (COMDLG32.OCX) Changes Default Printer
    Whenever we use the Common Print Dialog (COMDLG32.OCX) to select a printer, it changes the default printer to the selected printer. This is clearly not what the user intends, so I'm not sure why the dialog is working like this. Be that as it may, we need to work around this. I can think of three approaches: 1. Somehow tweak the Common Dialog to return the selected printer without actually changing the default to the selected printer. Any ideas on how this can be accomplished? 2. Record the default printer prior to invoking the Print Dialog and then restoring it after the print operation completes. What API functions would I use to do this? 3. Avoid the use of the Common Dialog altogether. I guess that there's a built in Window dialog which I could get to using the API, which might behave better in this regard. I've never done this before and any examples / tutorials are most welcome. If you've ever had to work around this issue, your advice will be most welcome, and much appreciated! Thanks, - Joe Geretz -
  • 3. dial a telephone number using the modem,and playing an audio file when the person lifts up telepone
    I wanted to make a vb application which would dial a telephone number using the modem. When the person on the other end lifts up the telephone (answers the phone), the application should start playing an audio file(eg. .wav file). The approach I took was using the Tapi. As my modem is connected to the serial port on my computer I send AT commands to make the phone call . This is working fine and the call is being placed. I wanted to know whether this is possible at all? Whether I am approaching the wrong way? If it is possible, then please give some suggestions or samples(vb or vc). If it is not possible , then what is the best way to do so
  • 4. InternetOpen , InternetConnect and InternetQueryOption
    Hi, Plz help.. i am a bit new to this.... I want to test the following code(which queries the username and the user name is retrieved in the szBuf) ------------------------------------------------------------ InternetQueryOption(hConnect, INTERNET_OPTION_PROXY_USERNAME, szBuf, &nSize) ------------------------------------------------------------ i get the hConnect handle by using the following......code ------------------------------------------------------------ hSession = InternetOpen("GetProxyDetails", INTERNET_OPEN_TYPE_PROXY, "ProxyServer", NULL , 0 ); hConnect = InternetConnect(hSession, "ServerName", INTERNET_DEFAULT_HTTP_PORT, "UserName", "Password", INTERNET_SERVICE_HTTP, NULL, NULL); -------------------------------------------------------------- My problem is that I am not getting the UserName from the InternetQueryOption and also that the InternetOpen and InternetConnect is not giving any NULL value which it is supposed to give if it fails....so i am not able to know that i am providing the correct handle to the InternetQueryOption Can u people help me out... Thanks in advance Chris..
  • 5. windows 2003 issues with 16 bit vb
    we have a vendor written vb applciation that does not work correctly on the new wonderful ntvdm for windows 2003. the application does not correctly paint the dialog box and specifically does not paint test. it looks like it uses the wfxwnd calls. the appication works on windows 2000 but not on 2003. we are a terminal server environment and this is preventing the upgrade of several servers. any ideas?

Re: SetParent API cannot set focus - Solved

Postby Bob and Sharon Hiller » Fri, 24 Mar 2006 06:56:28 GMT

I solved the problem by using cursor API's to set the focus to the child 
window and then using keyboard events to send the data.

Bob Hiller
Lifts for the Disabled LLC








Similar Threads:

1.SetParent API cannot set focus

I use the SetParent API to run Notepad and other applications in a VB 
PictureBox. Everything works fine except that I cannot find anyway to set 
focus to NotePad through code. The only way is by clicking on it. Is it 
possible to set focus to a program running in a child window?

Thanks,
Bob Hiller
Lifts for the Disabled LLC 


2.SetParent Windows API function notworking with VB 6 forms

I have a requirement where I need to embed a VB 6 forms application into .Net 
forms application. Basically the new .Net application would act as a wrapper 
application and would control the embedded VB 6 application.

I tried to start the VB 6 in a separate process from dot net app and 
acquired the handle of the handle to the main window of the process.

Next I used to use Win32 API function SetParent to set the parent of the VB 
6 application window to the dot net application window.

But when I run the dot net app, it creates the VB 6 app and window is 
launched. But the SetParent does not work as the VB 6 app window stays 
separately outside the dot net app window.

I have pasted the code below for better clarity:
//Creating VB 6 app process
Process p = null;
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = this.exeName;
startInfo.WindowStyle = ProcessWindowStyle.Normal;
p = Process.Start(this.exeName);

//Waiting till the VB 6 process finishes its execution
p.WaitForInputIdle();

appWin = p.MainWindowHandle;

//Change the window attributes of the VB 6 app so that it can become a 
//child window to another window...
long result = GetWindowLongA(appWin, GWL_STYLE);
long newResult = result | WS_CHILD | WS_OVERLAPPEDWINDOW;
SetWindowLongA(appWin, GWL_STYLE, newResult);

//Use SetParent for changing the parent...
IntPtr a = SetParent(appWin, this.Handle);

//Move the child window within the parent window
MoveWindow(appWin, 0, 0, this.Width, this.Height, true);

This method works roughly for embedding app window in another dot net 
application. But do not work for the embedding a VB 6 app window.

What am I missing here?

3.API FindWindow and SetParent function in ASP.NET

4.SetParent API doesn't work for non-MDIchild form

I've succesfully implemented the SetParent API in order to show a form on 
top of a SSTAB control. This works only for the case that the SSTAB control 
is in a MDIchild form. In case that I set the MDIchild property to False , 
the form load event hangs at the SetParent call. How can I solve this since 
I need the main form to be vbmodal which can only be applied to non-MDIchild 
forms.

Oscar 


5.Setting the Focus to and return the Focus of a textbox

Hello,

In VB.NET 2008, a Do ... Loop, I creates sereral new textboxes.  How can I 
set the focus on one of them.
My code is:

Do
txtTest = new Textbox
With txtTest
.Name = "Name"
.Text = "Text"
End With
Loop Until ...

I want to set the Focus on a particular textbox.  On the other hand, when a 
textbox has the focus, I want to be able to recognise it, so I can give it 
the focus again at a later time.

Can someone help me?

Many thanks,

Michel

6. ***** PROBLEM SOLVED ***** PROBLEM SOLVED ***** PROBLEM SOLVED *****

7. Form Lost Focus - Solved

8. Configuration Manager - missing / cannot find. -Solved



Return to Visual Basic

 

Who is online

Users browsing this forum: No registered users and 49 guest