Re: VB app nolonger works with XP SP2

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Jason Dravet (dravet_at_calumet.purdue.edu)
Date: 09/10/04


Date: Thu, 9 Sep 2004 20:52:46 -0500

I used the MSCOMM32.OCX for the first version of the application (power on
and power off) that I wrote a couple of years ago in VB6. VS 2003 came out
and the department switched to that, then about 6 months after the switch I
needed to add volume control. This was when I switched from MSCOMM32 to the
RS232.vb code. The goal was to update the app so it did volume control and
did not rely on a ocx. The thinking at the time was once the app was
updated we could just put it on a server and have the people access it from
there. No fuss about regsrv32 mscomm32.dll on the PCs. The problem when we
tried this was the .NET framework gave similar type errors about security
exceptions. We had to copy the app to the c: drive and then it worked. The
intention was to go back later and figure out how to run the app from the
network, but like most good intentions it never happened. I would rather
not go back to using an ocx because then I have two files to worry (the app
and the ocx). The ocx complicates matters. Currently after we image the
PCs all we have to do is put the app on the c: drive, create a shortcut, and
we are done. If we use the ocx, then I have to copy the app and ocx, login
as an admin to register the ocx, create the shortcut. A few more steps, not
difficult, but just more stuff to worry. This was the beauty the rs232
code, no fuss no muss. I will probably have to go back to the ocx method,
but I will do it kicking and screaming at Microsoft. Why oh Why can't
Mircosoft document these problems and make the solutions easy to find.

Jason

"Greg Burns" <greg_burns@DONT_SPAM_ME_hotmail.com> wrote in message
news:e9dc7KtlEHA.3452@TK2MSFTNGP15.phx.gbl...
> Might be time to rewrite this little thing:
>
> It is possible to use the MSCOMM32.OCX in VB.NET (I've done it before).
>
> VB.NET will create a wrapper around the COM object to use in .NET code.
>
> The problem is finding a copy of the file & the licensing issues (it isn't
> even on my home Windows XP Pro system).
>
> I would suggest going with a third party control like...
>
> http://www.sax.net/dotnet/communications/
>
> Greg
>
>
> "Jason Dravet" <dravet@calumet.purdue.edu> wrote in message
> news:un1BXvslEHA.2020@TK2MSFTNGP09.phx.gbl...
>> You are correct I did not post the full error. My mistake. Yes I did
>> see your eariler post, but I don't know how to go about what you suggest.
>> I am not a programmer. The reason I wrote this is because there was an
>> immediate need for the exe. So I hopped on the web and found the
>> rs232.vb code. It worked great until SP2. I was hoping someone from
>> microsoft could point to the document mentioned in one of the other
>> replies about how to fix these kind of SP2 related errors. I could not
>> find it on there website.
>>
>> Thanks,
>>
>> Jason
>>
>>
>> "Greg Burns" <greg_burns@DONT_SPAM_ME_hotmail.com> wrote in message
>> news:ulbmiCslEHA.596@tk2msftngp13.phx.gbl...
>>> Jason, did you see my post on your thread?
>>>
>>> You are not reporting the full error. When I ran your code this is what
>>> I got:
>>>
>>> "System.Security.SecurityException: Request for the permission of type
>>> System.Security.Permissions.SecurityPermission, mscorlib,
>>> Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
>>> failed.
>>> at
>>> System.Security.SecurityRuntime.FrameDescHelper(FrameSecurityDescriptor
>>> secDesc, IPermission demand, PermissionToken permToken)
>>> at WindowsApplication9.Rs232.CreateFile(String lpFileName, Int32
>>> dwDesiredAccess, Int32 dwShareMode, Int32 lpSecurityAttributes, Int32
>>> dwCreationDisposition, Int32 dwFlagsAndAttributes, Int32 hTemplateFile)
>>> at WindowsApplication9.Rs232.Open() in C:\Documents and
>>> Settings\Greg\My
>>> Documents\Visual Studio Projects\WindowsApplication9\Class1.vb:line 559"
>>>
>>> Which I assume is failing on this API call:
>>>
>>> <DllImport("kernel32.dll")> Private Shared Function CreateFile( _
>>> <MarshalAs(UnmanagedType.LPStr)> ByVal lpFileName As String, _
>>> ByVal dwDesiredAccess As Integer, ByVal dwShareMode As Integer, _
>>> ByVal lpSecurityAttributes As Integer, _
>>> ByVal dwCreationDisposition As Integer, _
>>> ByVal dwFlagsAndAttributes As Integer, _
>>> ByVal hTemplateFile As Integer) As Integer
>>> End Function
>>>
>>> You need to be looking at what changed in this API functionl with SP2...
>>>
>>> Greg
>>>
>>> "Jason Dravet" <dravet@calumet.purdue.edu> wrote in message
>>> news:%23UBuJyrlEHA.2504@TK2MSFTNGP14.phx.gbl...
>>>> The text box is filled with the text I programmed, but I still get the
>>>>
>>>> Request for the permission of type
>>>> System.Security.Permissions.SecurityPermission, mscorlib,
>>>> Version-1.0.5000.0, Culture=neutral,
>>>> PublicKeyToken=b77a5c561934e089 failed.
>>>>
>>>> error with the application. There was no McAfee anti-virus software
>>>> installed at the time of the test.
>>>>
>>>> Jason
>>>>
>>>>
>>>>
>>>> "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
>>>> news:2q8pfkFs24f8U3@uni-berlin.de...
>>>>>* "Jason Dravet" <dravet@calumet.purdue.edu> scripsit:
>>>>>> I am running McAfee Antivirus 8i. This seems very strange to me.
>>>>>> How can
>>>>>> McAfee Antivirus cause this problem? I know McAfee 8i contains some
>>>>>> new
>>>>>> things like buffer overflow protection, prevention of launching
>>>>>> unwanted
>>>>>> programs, and prevention of software communicating over certain ports
>>>>>> (not a
>>>>>> replacement for a firewall). I turned off all of these features, but
>>>>>> the
>>>>>> blank message box remains. I will delay the rollout of 8i until a
>>>>>> fix is
>>>>>> available.
>>>>>
>>>>> I am very unsure about the reason why this program is in conflict with
>>>>> the .NET Framework too. The guy who posted the problem to the German
>>>>> group uninstalled the virus scanner and the problem went away. I know
>>>>> that this is not always an option, but I would at least test the
>>>>> application on a Windows XP SP2 machine that doesn't have McAfee
>>>>> Antivirus 8i installed.
>>>>>
>>>>> --
>>>>> M S Herfried K. Wagner
>>>>> M V P <URL:http://dotnet.mvps.org/>
>>>>> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Relevant Pages

  • Re: LoadLibrary/FreeLibrary
    ... Loading the ocx seems to resolve the error, ... activebar control. ... Does the app crash without the usercontrol? ...
    (microsoft.public.vb.winapi)
  • RE: executionEngineException
    ... I changed the registration of the .ocx from ... the vb.net app to treat other appsas embedded objects. ... One of the functions of this COM control is to search ... to execute ok but if I then try ctrl.SomeMethod, ...
    (microsoft.public.dotnet.framework.interop)
  • Re: Manifests and VB6
    ... com ocx exe .local. ... I have the same file v. 6.0.96.37 in the app folder ... I don't want to install the OCX in the Windows System32 ...
    (microsoft.public.vb.general.discussion)
  • Re: SSTAB problem
    ... every VB app, and for me there's no need to replace them, be they hooky ... If your goal is to run OCX free VB apps, ... >>Some years ago, I gave up the SSTAB control for the TabStrip control, which is part of the ... >>PictureBox and to hide all other PictureBoxes. ...
    (microsoft.public.vb.general.discussion)
  • Re: Ghost breakpoints
    ... and some MFC function was throwing a DEBUGCHK because it couldn't find ... still be able to debug your app but MFC won't choke as your app loads. ... the OCX dll you have is a debug version. ... Steve Kelley ...
    (microsoft.public.windowsce.embedded.vc)