Is there a way to get the window handle of an AXControlSite even if/when
there is no window displayed? What I need to do is to call a WinInet function to establish a dialup connection, and it requires a window handle. I have been getting the job done by make the following call so far: WinInetLibrary default InternetDial: (theWindow handle) lpszConnectoid: theConnectoid dwFlags: 0 lpdwConnection: connectStatus dwReserved: 0. "theWindow" is nothing but a window returned by "ShellView new." Well, what I have done is bad on a number of fronts. First, it calls a private method "handle". Second, it creates a window which I don't really need at all, just to be able to initiate a dialup connection. So I would like to do this correctly. I am actually using some custom IWebBrowser classes provided by Steve Waring to control Internet Explorer and MSHTML, but (I think) the problem is the same whether I use Steve's classes or an AXControlSite without actually showing a window. This is in fact what I want to do--control Explorer and get some data from the internet in a totally unattended, windowless mode. But I guess that I do need to allocate a window in order make the WinInet call. Note that the COM interface to Explorer has a method to get a window handle, but I haven't gotten this to work. Sorry for the rambling here, but that happens when I don't really know which direction to go :(. Thanks for any advice. John Whittaker |
Hi John,
Me again:) Have you tried this function (For WinInetLibrary); ======================= internetAutodial: dwFlags dwReserved: dword "Automatically causes the modem to dial the default Internet connection" "BOOL InternetAutodial( IN DWORD dwFlags, IN DWORD dwReserved );" "// Flags for InternetAutodial #define INTERNET_AUTODIAL_FORCE_ONLINE 1 #define INTERNET_AUTODIAL_FORCE_UNATTENDED 2 #define INTERNET_AUTODIAL_FAILIFSECURITYCHECK 4 " <stdcall: bool InternetAutodial dword dword> ^self invalidCall ===================== This creates a connection without intervention on my machine. I suspect that you could use nil instead of a Window handle in InternetDial as well, but have a good backup before trying. Steve "John Whittaker" <[hidden email]> wrote in message news:LQ5e6.1187$[hidden email]... > Is there a way to get the window handle of an AXControlSite even if/when > there is no window displayed? > > What I need to do is to call a WinInet function to establish a dialup > connection, and it requires a window handle. I have been getting the job > done by make the following call so far: > > WinInetLibrary default InternetDial: (theWindow handle) > lpszConnectoid: theConnectoid > dwFlags: 0 > lpdwConnection: connectStatus > dwReserved: 0. > > "theWindow" is nothing but a window returned by "ShellView new." Well, > I have done is bad on a number of fronts. First, it calls a private method > "handle". Second, it creates a window which I don't really need at all, > just to be able to initiate a dialup connection. So I would like to do > this correctly. I am actually using some custom IWebBrowser classes > provided by Steve Waring to control Internet Explorer and MSHTML, but (I > think) the problem is the same whether I use Steve's classes or an > AXControlSite without actually showing a window. This is in fact what I > want to do--control Explorer and get some data from the internet in a > totally unattended, windowless mode. But I guess that I do need to allocate > a window in order make the WinInet call. Note that the COM interface to > Explorer has a method to get a window handle, but I haven't gotten this to > work. Sorry for the rambling here, but that happens when I don't really > know which direction to go :(. > > > Thanks for any advice. > > John Whittaker > > |
Free forum by Nabble | Edit this page |