Announcement

Collapse
No announcement yet.

How weird can it get?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Jim Fritts
    replied
    As it turns out likely this should be used to eliminate this problem.
    #RESOURCE MANIFEST <manifest file> statement.

    Leave a comment:


  • Jim Fritts
    started a topic How weird can it get?

    How weird can it get?

    I have been working on a COM Client. It's name was Dispatch.bas. I wanted to change the name to DispatchClient.bas via Save As and then proceeded to recompile it. It would not launch after compile.
    This is the message PBWin10 gave:
    "Cannot launch file C:\PBWin70\Samples\Test\DispatchClient.exe
    Incorrect function."
    Here is the app:
    Code:
    '==============================================================================
    '
    ' Loosely based on:
    ' Direct.bas example for PowerBASIC For Windows Compiler
    ' Copyright (c) 2009-2011 PowerBASIC, Inc.
    ' All Rights Reserved.
    '
    ' Demonstrates raising events in a dispatch event interface
    '
    '==============================================================================
    ' COM Dispatch Client
    '==============================================================================
    #COMPILER PBWIN 10
    #COMPILE EXE "Dispatch.exe"  'If I change this to DispatchClient.exe it will not launch after compile.
    
    #DIM ALL
    
    ' Class Identifiers
    $CLSID_MYCLASS = GUID$("{00000098-0000-0000-0000-000000000003}")
    $EvClassGuid = GUID$("{00000098-0000-0000-0000-000000000001}")
    
    ' Interface Identifiers
    $IID_STATUS = GUID$("{00000098-0000-0000-0000-000000000002}")
    $IID_MYMATH = GUID$("{00000098-0000-0000-0000-000000000004}")
    
    ' The Event handler class
    ' This class is called from Event Source class
    CLASS EvClass $EvClassGuid AS EVENT
    INTERFACE IStatus $IID_STATUS AS EVENT
    INHERIT IDISPATCH
    
    ' Event method called by Object Raiseevent IStatus.Done()
    METHOD Done
    ? "The calculations are complete!"
    END METHOD
    
    END INTERFACE
    END CLASS
    
    INTERFACE IMath $IID_MYMATH
    INHERIT IDISPATCH
    METHOD DoMath
    END INTERFACE
    
    
    FUNCTION PBMAIN()
    LOCAL oMath AS IMath ' Object reference to the IMath Interface
    LOCAL oStatus AS DISPATCH ' Dispatch Object reference to the IStatus event Interface
    
    LET oMath = NEWCOM CLSID $CLSID_MYCLASS LIB EXE.PATH$ + "DispatchServer.dll"
    
    oStatus = CLASS "EvClass" ' Create an instance of the EvClass object
    
    ' Connect the event handler interface to the event source Interface
    EVENTS FROM oMath CALL oStatus
    
    ' Call the DoMath method in IMath Interface
    oMath.DoMath
    
    ' Disconnect the event handler interface from the event source Interface
    EVENTS END oStatus
    oMath = NOTHING
    oStatus = NOTHING
    
    END FUNCTION
    Very strange.

    Asked and Answered...
    As it turns out if the name is "DispatchClient.exe" Windows automatically makes it a Run as Administrator file with a Shield on it.
    So I just changed it to Buda.exe and all is well.
Working...
X