cjreid

I am having issues with rmtool when testing TC30. I've modifiied our applications to be restart manager aware. They listen for WM_ENDSESSION and WM_QUERYENDSESSION messages and handle each message appropriately. When I tested this by manually logging off, shutting down, or restarting the PC, the message was captured and our applications shutdown. Now, when I use rmtool to simulate a shutdown event, they don't shut down.

As for some background information, our application is not designed to restart after shutdown. An example of the command I send is:

rmtool.exe -p 4076 -S

While debugging this, I caputed all the messages that are being sent when using rmtool and it doesn't appear that

WM_QUERYENDSESSION or WM_ENDSESSION are even being sent. I would expect to see a message with value of 17 (0x0011) or 22 (0x0016) being sent, but neither are.

Here's a list of unique message values that are being sent when using rmtool (not in the exact order) -

App1 - 49374,28,144,2

App2 - 49529,28,14,13

*Value are provided as decimal, not hexadecimal.

Any assistance would be much appreciated!



Re: Application Compatibility for Windows Vista RMTool.exe doesn't seem to be working

cjreid

Has anyone else had issues with this Has there been any updates to the Vista Testing Tools over the past couple months When I use rmtool.exe I'd expect that a WM_ENDSESSION or WM_QUERYENDSESSION message would be sent. Is this an incorrect assumption

I'm testing on Vista Ultimate 32-bit edition with a 32-bit application.





Re: Application Compatibility for Windows Vista RMTool.exe doesn't seem to be working

Bruce N. Baker - MSFT

What's your language Managed or Unmanaged Which compiler version




Re: Application Compatibility for Windows Vista RMTool.exe doesn't seem to be working

cjreid

Our application is written in vb.net (managed assembly) using the .Net Framework version 2.0.50727.

The rmtool.exe I'm using has a file and product version of 6.0.5825.16387. It was modified 11/8/2006. Is this the most recent

Here's a code sample.

' Windows message we monitor.

' Sent when windows is about to shut down.

Public Const WM_QUERYENDSESSION As Int32 = &H11 '= 17 '0x0011

' Sent when windows is shutting down.

Public Const WM_ENDSESSION As Int32 = &H16 ' = 22 '0x0016

' The LPARAM to look for in QueryEndsession and EndSession.

Public Const ENDSESSION_CLOSEAPP As Int32 = &H1

...

...

Protected Overrides Sub WndProc(ByRef ThisMsg As System.Windows.Forms.Message)

Select Case ThisMsg.Msg

Case WM_QUERYENDSESSION

' NEVER RECHED - USING RMTOOL!!!

If (ThisMsg.LParam.ToInt32 AndAlso ENDSESSION_CLOSEAPP = ENDSESSION_CLOSEAPP) Then

' Shut down the application.

Me.systemCloseMethod()

End If

Case WM_ENDSESSION

' NEVER RECHED - USING RMTOOL!!!

If (ThisMsg.LParam.ToInt32 AndAlso ENDSESSION_CLOSEAPP = ENDSESSION_CLOSEAPP) Then

' Shut down the application.

Me.systemCloseMethod()

End If

End Select

' If this isn't an session end message, then pass the

' data onto the base WndProc() method.

MyBase.WndProc(ThisMsg)

End Sub





Re: Application Compatibility for Windows Vista RMTool.exe doesn't seem to be working

Bruce N. Baker - MSFT

Take a look at this post

http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=1234478&SiteID=1






Re: Application Compatibility for Windows Vista RMTool.exe doesn't seem to be working

cjreid

Thanks for the reply Bruce!

I read over the article you provided, but it doesn't completely apply since I'm not using VB6. After building a couple different test apps in vb.net, I was able to get the required WM_QUERYENDSESSION and WM_ENDSESSION messages.

Here's what I believe the problem is: We have a Start exe that creates a COM object and runs it. Being that the Start exe is running the COM code (which is our main app); the Start exe isn't idle that therefore, rmtool doesn't send it the WM_QUERYENDSESSION or WM_ENDSESSION messages. When I manually test this logging out, shutting down, or restarting the system messages are sent and the applications close within the specified time frame.

I understand that the specs for TC30 say that the application must be idle and not running. I can't be the only one out there who runs there application as COM. Have others found a way around this Are there any workaround you know of I don't think I should have to change my application architecture just because a test tool doesn't correctly simulate the test.





Re: Application Compatibility for Windows Vista RMTool.exe doesn't seem to be working

Bruce N. Baker - MSFT

I'd look at this differently. I believe the tool/api sends the message, why wouldn't it I just think for whatever reason your app isn't getting it...maybe....

What's your language What VS How are you trying to get the message, can you show a code frag






Re: Application Compatibility for Windows Vista RMTool.exe doesn't seem to be working

cjreid

It is possible that my applications aren't getting the messages, sure. Maybe you can help me deteremine why.

The controlling app, let¡¯s call it App1, is in VB.NET. .NET Framework version 2.0.50727. Visual Studios 2005 Version 8.0.50727.42. The main app, App2 is written in VFP. VFP has a QueryUnload event similar to VB6, however, there is no status available as mentioned in the link you provided referencing VB6. Both applications override WndProc and have code to be RestartManager aware.

I am capturing the messages by overriding WndProc. I provided the example above. I know which messages are being sent because I add MessageBox.Show("ThisMsg.Msg=" + ThisMsg.Msg.ToString) just before the select statement when debugging.

The code is fairly lengthy, but here is an overview of what's going on.

App1:

In the load event:

o = CreateObject("xxx.myapplication") ' Create an instance of our main application.

o.Start() ' Start the main application and wait until it closes.

This would be similar to making the following call (we start a second app and wait for it to exit):

Interaction.Shell("C:\WINDOWS\SYSTEM32\Calc.exe", AppWinStyle.NormalFocus, True)

App2: This is the main application.

I've duplicated this behavior in a .NET test application where App1 was a blank .NET form that had wndProc overridden and made this call in its load event:

Interaction.Shell("C:\Test\App2.exe", AppWinStyle.NormalFocus, True)

App2 was just a blank .NET form that also had wndProc overridden.

In TaskManager there will be two exe's running. When using rmtool on App1, WM_ENDSESSION and WM_QUERYENDSESSION are not received. I beleive this is because App1 isn't idle.

Any thoughts





Re: Application Compatibility for Windows Vista RMTool.exe doesn't seem to be working

Bruce N. Baker - MSFT

Ok, I forwarded this to internal and will get back with you.






Re: Application Compatibility for Windows Vista RMTool.exe doesn't seem to be working

cjreid

The issue was that one of our exe's run in the background and since it doesn't use forms nor show up in the task bar (for design reasons), it doesn't receive the proper windows messages. I've made design changes to accomodate.





Re: Application Compatibility for Windows Vista RMTool.exe doesn't seem to be working

Bruce N. Baker - MSFT

Well, that explains a lot. I wasn't sure exactly what design you had and yea, if there's no UI, etc it is a problem :-) A good note for others.