RASPHONE.exe behavior in XP and Windows 7 - windows

I called "Rasphone.exe" from my C code using "ShellExecuteEx" to create a dial-up connection. I found different behaviour on Windows XP and Windows 7.
Behavior in Windows XP :
The RASDial connection gets created without any Pop-up Window.
Behaviour in Windows 7 :
A DialUp window Pops up asking number to be dialed. I didnt enter any number, and clicked "Dial" button. Connection gets connected. The below is the snap-shot window which I get in windows 7?
What is the reason for the difference in behaviour?

What is the reason for the difference in behaviour?
Windows 7 is a different operating system than Windows XP. Before Metro was invented, the Windows team didn't have anything to do, so they sat around changing a bunch of old code just to see if anyone noticed. Looks like you've found one of the things they changed.
No worries, though. The code you had was doomed in the first place. The proper way to dial a network connection is not to launch the network dialer application, it's to call the API provided for this purpose.
The name of the API you want is WinINet, and you'll find the documentation for it here. In particular, you'll be interested in the Establishing a Dial-Up Connection to the Internet section, which mentions the InternetDial function.
Of course, they've changed this, too. Starting with Windows Vista, this function uses the RAS API internally to establish the connection. Skip the middle man by calling the RasDial or RasDialDlg functions directly.

Related

How can I have a Pcomm session automatically log in to a specific connection..?

We have an AS400 DB2 v7r3m0 system, to which we connect with PComm v6 emulator sessions. For a certain high-throughput printer, there's a stand-alone PC acting as a print server, with a PComm printer session.
I'd like to have that PComm printer session automatically start, make the connection, and log in, so I can have it run from Windows Startup.
I've been able to record & clean up a VBS macro that logs in once the connection is made, but not the connection process. Unless I'm missing something, macros cannot be recorded or run until the connection is made.
Is there a built-in process by which the connection can be made automatically..?
If not, I'm assuming it could be done with autECLConnMgr and related libraries in VBS, but the IBM documentation on that is a little deep for me. If that's the way to go, could someone provide an example..?
EDIT: This is the dialog I speak of. This sometimes precedes the opening of any emulator windows, sometimes from the IBM i control panel applet, and so it cannot be scripted through an emulator window way, and thus my assumption it needs to go through WScript.
Honestly, I think you should look into using the Windows scripting language AutoHotkey to fill in any gaps in functionality that you can't achieve by other means. Virtually anything you can do by hand on a PC can be automated using AutoHotkey, including keyboard and mouse input.

UIAutomation won't work in Windows Server (VPS) if I am not connected via RDP

I have script which uses mircrosoft's UIAutomation to automate an application. The script is inside a VPS running Windows Server 2012. The script works perfectly while I am connected to the VPS via Remote Desktop (RDP).
When I am not connected, the script seems to be stuck on SetFocus for a object... which leads me to believe that the script needs a Display/Screen/Session in order to work... but I am not sure if it is possible to do it while I am not connected to the VPS.
I can see 2 possible solutions here, either modify the script in someway to work in this environment or make the VPS have a virtual desktop while I am not connected (this solution might be more related to Server Fault rather than StackOverflow).
I am very confused, thanks for the help in advance :)
I managed to workaround the issue by actually connecting to the server to itself (to 127.0.0.1) via RDP so that it will always have an active RDP session for the automation script to run.
I am not happy with the results but it works... I cannot give clear instructions on how you would need to modify the settings in Windows to allow RDP connections from self, it was a one big trial and error process, I have to modify some policies in the Group Policy Editor and then some stuff that I don't remember.
There is another downside to this, a Windows server will allow 2 simultaneous connections to it but by using this method we are reserving a slot so only 1 connection at a given time is possible, something to be aware of.

Problems with Windows Phone 8.1 emulator

I am having really difficult time to cope up with the windows phone emulator.
My ultimate goal is to deploy my application and sniff http requests through fiddler.
I am on Visual Studio 2013 Update 4 on Windows 8.1
Problems which i face
Sometimes the emulator does not start at all and gets stuck "Window Phone OS is starting ".
Here first i get the message of "Attempting to modify switch settings" info dialog. I clicked on ok. Then i get Error dialog of "Windows Phone emulator is unable to connect to the windows phone operating system" "Object reference not set to an instance of an object "(Internal c# error). I click close and it gets stuck at "Windows Phone OS is starting".
if i get past this problem and my application gets deployed. I cannot connect to internet. Even a link in browser does not open.
Now for the rarest of rare times i am able to connect to internet. I am in no way able to sniff http request.
But sniffing is still my secondary problem, but my first issue is to get the emulator run and connect to internet.
Steps which i have performed to troubleshoot.
Hyper-V as a Windows feature is turned on.
My firewalls have been disabled.
I have removed the virtual machines and switch created by Hyper-V manager and let it be created through Visual Studio.
In network connections, disabled and enabled the vEthernet (Windows Phone emulator switch ).
Have also tried ipconfig/renew.
Have gone through lot of msdn posts, blogs, so questions but the behaviour of emulator is pretty inconsistent.
Is there any way i can get emulator logs/info ?
Any help to direct to me to any direction will be hugely appreciated.
UPDATE
only thing which is consistently working for me right now is disabling Hyper-V windows feature and then enabling it again.
Mind the expensive system restarts also. Then adding my user name to Hyper V admin group and then deploying the application.
So whenever i am changing my network i have to perform these steps. Definitely not sustainable
UPDATE 1
So now i have fiddler also acting as a man in the middle. Followed the steps here http://blogs.msdn.com/b/wsdevsol/archive/2013/06/05/configure-the-windows-phone-8-emulator-to-work-with-fiddler.aspx. Couple of thing to change here are the port number and to give the ip number instead of host name.
Also have fiddler always start first and then the emulator. Fiddler is able to sniff the requests happening in emulator. But my application http requests are not going through which is fine if i run without fiddler. I am currently looking into this.
Best Regards,
Saurav
Have you tried to run Visual Studio as Administrator? Sometimes, the user must have highest privileges to run Hyper-V.

How to send logoff in Remote Desktop ActiveX control?

I'm writing a Delphi application which has an intergrated Remote Desktop ActiveX Control (a.k.a MSTSCLib - but specifically TMsRdpClient9). I am able to successfully connect to and log in to the target machine, and I am able to Disconnect from the target machines using RDPClient.RequestClose() or RDPClient.Disconnect(), but I need to know how to send a Logoff/Logout command to the RDP Client.
I have gone through every interface of the control, and I cannot find any command which seems to do this functionality. I have also gone through the documentation linked above, and the method I need to use seems to elude me.
I have also searched Google, and Stack Overflow for similar questions, and have found none.
Can somebody please give me a hand

Making Windows service beep in Windows 2008/7/Vista

this question has been asked before but there is no conclusive answer.
I've written a Windows service in Delphi, which needs to generate a beep under certain condition. This works fine on XP, however fails in Windows 7 or 2008.
Note:
Beep can work if i create a console program instead of a service - using PC speakers.
Beep cannot work in a service even if i enable "allow service to interact with desktop" or even assign administrator rights to the service.
My question: Is there a way I can call beep API such that it works in a service? Thanks.
You can't do this in Vista and up. Services run in a different session and so don't have access to the speaker.
Update: Someone found a way here. it involves IOCTL, and is available to drivers and services.
Original answer:
The only way I know of to interact with the user would be to have your Service communicate with a small user-agent process which would be added to HKEY_LOCAL_MACHINE\CurrentUser\Run to autorun.
This is the usual pattern in vista and win7 where no user interaction is possible directly from the service:
MyLittleService.exe has no access to the user. But it can communicate via a named pipe with a tray icon utility.
MyLittleTrayIcon.exe communicates to the service, and can also be told to signal the user with message boxes, beep via whatever method (windows sound effects probably would be better than trying to access the PC speaker which is not guaranteed to exist on every PC anymore), etc, and maybe even can be used to control the service (restart it, reload the configuration etc).

Resources