Jump to content
Sign in to follow this  
faldo

Hiding windows before they're drawn

Recommended Posts

faldo

Heya,
I'm trying to create an Outlook profile by running the tool included in Office (C:Program Files (x86)Microsoft OfficeOffice14MLCFG32.CPL)
I don't want the user to interact with nor see the guide itself so i tried using Universalists excelent hook found here: '?do=embed' frameborder='0' data-embedContent>>
 
This method only seems to work for a single GUI, once the "Show profiles" button is clicked a new window is opened, the hook looses the "link" and the new window "flickers" before i manage to make it transparent. Could someone help me either modify my script or in some other way hide created windows before they're drawn?
 
Mind the window-titles being in swedish :)

Local $Email
$GUIHook = GUICreate('Autoit Hook GUI') ;A GUI is needed to catch the messages.
$SystemHook = DllCall('user32.dll', 'int', 'RegisterWindowMessageW', 'wstr', 'SHELLHOOK') ;This the hook cut down and simplifed. Check link for a more detailed info on it.
GUIRegisterMsg($SystemHook[0], "GUIHook") ;Is the function you want to regesiter the Hook to. "GUIHook"
DllCall('user32.dll', 'int', 'RegisterShellHookWindow', 'hwnd', $GUIHook) ;Links it to your GUI so you can see the messages.

Run('control "C:\Program Files (x86)\Microsoft Office\Office14\MLCFG32.CPL"') ;Runs the Program

While 1
    Sleep(250)
    ;This is to keep the script alive, check HotKeySet in HelpFile. Its the same idea.
WEnd

Func GUIHook($hWnd, $Msg, $wParam, $lParam)
    Switch StringRight($wParam, 1)
        Case 1 ;Window Created
            If WinGetTitle("Konfigurera e-post") And $Email = 0 Then
                $Email = 1
                WinSetTrans(WinGetTitle("Konfigurera"), "", 100)
                ControlClick(WinGetTitle("Konfigurera"), "", "Button3") ;Clicking this button breaks the link.
                WinWait("E-post")
                WinSetTrans(WinGetTitle("E-post"), "", 100)
                ControlClick(WinGetTitle("E-post"), "", "Button1")
                Exit
            EndIf
    EndSwitch
EndFunc   ;==>GUIHook
Edited by faldo

Share this post


Link to post
Share on other sites
lowray1975

Sorry to throw you off track, however there might be a better way to do this.  A long time ago I wrote something in VB that created Outlook profiles by using PRF files.

http://technet.microsoft.com/en-us/library/cc179062(v=office.14).aspx

Let me know if you're interested and I'll try to find the source code.  It would be great to see it translated to Autoit.

Hopefully you find this useful. 

Share this post


Link to post
Share on other sites
faldo

Thanks for your reply lowray1975, any method in creating the profiles would be much apretiated :)

I'm no VB-wiz but if you think it can be done in autoit i'd love to hear your theoretical method of your VB-code.

Cheers!

Edited by faldo

Share this post


Link to post
Share on other sites
lowray1975

Sorry for the delay, my lovely wife took me and the kids away unexpectedly for a few days. ;)

 

Before getting into the code I might be a good idea if I explain the situation I was in when I created the VB code.  Back in the days of Outlook 2000, XP, and 2003 I worked for a company that outsourced office's for single employee or very small companies.  My boss, the owner of the company, didn't believe in complication - meaning everything was simplified.  Because he also believed he understood IT he made the decision that Active Directory would not be used (this occurred years before I became employed .  Each of the seven locations would be configured as a workgroup and, instead of logging into workstations as an individual, an employee logged in as a function (e.g. the front desk receptionist logged in as the "frontdesk" account).  Even though employees traveled between all of the location this typically didn't cause any issues because the main application that was used has an internal user management system.  However it made configuring Outlook for Exchange a huge issue when a] people couldn't follow simple directions and b] the user using the workstation that day could have never used the workstation in the past.  This prompted me to find a way to automate the initial configuration of Outlook.

 

The VB program that I wrote did nothing more than displays a list of employee names in a dropdown box, allowing the user to select his or her name and click the “Create Outlook Profile” to automagically create their Outlook profile.  When the button was clicked it did nothing more than replace a couple of variables within the PRF template and then use Outlook to import the PRF file using the syntax:

 

outlook.exe /importPrf "*prf*"

(where *prf* was replaced with the full path to the newly created PRF file)

 

If I needed to do this all over again I would absolutely do it using AutoIT (honestly I didn’t even know about AutoIT until 2007 – I haven’t used VB since).  However before recreating this program I would have tried to sway the owner of the company to allow me to configure the environment correctly…

 

I’ve attached the VB code; although please keep in mind it was created almost 10 years ago.  I doubt a lot of people will need to use it since Outlook 2010/2013 auto configure if Windows authentication is used correctly.  It’s also possible that the complete PRF format has changed (highly doubted).

 

If there is enough need/demand/requests I’ll be glad to recreate using AutoIT.

 

- Josh

 

PS: I didn't proof this, Valik would be pissed.

OutlookConfigToolSource.7z

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×