ICE

Please login or register.

Login with username, password and session length
Advanced search  

News:

ICETCP.PRO and ICETCP.PLUS are compatible with Windows 11!

Pages: 1 [2] 3

Author Topic: OLE-API Questions  (Read 24735 times)

jmabbott

  • John
  • Full Member
  • ***
  • Posts: 23
Re:OLE-API Questions
« Reply #15 on: August 16, 2004, 04:09:09 pm »

The backgroung color setting problem also occurs with version 5.1.09.  This "issue" is visible in your documentation.  So I thought that maybe a description was left out about how 8 and 9 function.

Two things that I noticed about version 5.1.21:

1. I made the following change to my code because I was updating parts of both the visible and hidden screen buffer:
try
{
    m_Telnet.GetVisibleRect(&lLeft, &lTop, &lRight, &lBottom);

// changed for J.River version 5.1.21
//  m_Telnet.GetScreenContents((short)lLeft, (short)lTop, (short)lRight, (short)lBottom, &bstrScreen);
    m_Telnet.GetScreenContents(0, 0, (short)(lRight-lLeft), (short)(lBottom-lTop), &bstrScreen);
   
    m_Telnet.GetCursorPosition(&lColumn, &lRow);
}
catch (...)
{ }

2. The Caps Lock resyncs properly (and automatically) when focus is returned to my application by using the mouse to click anywhere within the application.  It does not resync if the application is activated by clicking on the application button on the task bar.  So far I have only tested the caps lock issue using NT.  I will try 2K and XP later this week.
Logged

jmabbott

  • John
  • Full Member
  • ***
  • Posts: 23
Re:OLE-API Questions
« Reply #16 on: August 20, 2004, 11:14:04 am »

1. Lets make sure the OCX programmer has plenty to do when he returns.

2. Item 2 above appears to only be an NT issue.  Caps lock resyncs properly under all conditions with XP and 2K.  Who needs NT anyway?

3. I don't think I have the "topmost BG (high intensity)" problem but I do have a problem with foreground color.  If I do SetColor (1,n) with n between 8 and F, a GetColor(1) returns n, but new characters on the screen display as if I had done SetColor (1,n-8).  I see that TelnetPro does not have this problem.

4. If I mistakenly do SetColor (1,0) and SetColor (2,0) - black letters on a black background - a GetScreenContents(...) returns garbage.

5. I develop on an NT but the operators run the application on XPs and 2Ks. We use the ICE 437 font with the application.  All our PCs are now at 5.1.21 so I can't determine if an issue is old or new.

6. Have a nice weekend.
Logged

Bob

  • Administrator
  • Ice Artist
  • *****
  • Posts: 1607
Re:OLE-API Questions
« Reply #17 on: August 20, 2004, 11:37:05 am »

1. Lets make sure the OCX programmer has plenty to do when he returns.
Ugh
Quote
2. Item 2 above appears to only be an NT issue.  Caps lock resyncs properly under all conditions with XP and 2K.  Who needs NT anyway?
Agreed.
Quote
3. I don't think I have the "topmost BG (high intensity)" problem but I do have a problem with foreground color.  If I do SetColor (1,n) with n between 8 and F, a GetColor(1) returns n, but new characters on the screen display as if I had done SetColor (1,n-8).  I see that TelnetPro does not have this problem.

4. If I mistakenly do SetColor (1,0) and SetColor (2,0) - black letters on a black background - a GetScreenContents(...) returns garbage.
Hmmm, what development environment are you using?
Quote
5. I develop on an NT but the operators run the application on XPs and 2Ks. We use the ICE 437 font with the application.  All our PCs are now at 5.1.21 so I can't determine if an issue is old or new.
You Could just copy the dejavu.ocx from 5.1.19, register it one one machine and try that. It would really be interesting to see what if any difference that makes.
Quote
6. Have a nice weekend.
Thanks, you too.
Logged

jmabbott

  • John
  • Full Member
  • ***
  • Posts: 23
Re:OLE-API Questions
« Reply #18 on: August 20, 2004, 05:00:17 pm »

I did the following and there was no improvement or change in performance: I restored 5.1.19 OCX; I rebuilt the "dejavu wrapper" - dejavu.cpp, dejavu.h, font.cpp, font.h - from 5.1.21 because mine where nearly two years old; Tried static and dynamic linking of the MFC dlls.  I did these test on my NT and on a 2K (the compile was done on the NT) that I use for testing.

I develop on a NT using MS Visual C++ 6.0.  The application is used in production on XPs and 2Ks.
Logged

jmabbott

  • John
  • Full Member
  • ***
  • Posts: 23
Re:OLE-API Questions
« Reply #19 on: December 07, 2004, 09:54:45 am »

Good morning.

I have upgraded to version 5.1.25.
I still have the problem of unable to set high intensity colors and by the way the little funny about "GetScreenContents(...) returns garbage when colors are set to black on black" still exist too.

My application allows operators to change colors on the fly.  That is when high intensity settings display as low intensity settings.  I see that TelnetPro only allows color changes when disconnected.

When is the best time to do things like:
    set color mapping flag
    set colors
    set key maps
    etc.
Before issuing the Connect.
While processing the OnConnectionComplete event.
After issuing the Connect.

Not to deviate from the color problem but I found that doing a "SetTerminalType()" before connecting crashed my application.  So I do it during the "OnConnectionComplete" event as:

try
{
m_Telnet.GetVisibleRect(&lLeft, &lTop, &lRight, &lBottom);
m_Telnet.GetScreenCharacters((short)lLeft, (short)lTop, (short)lRight, (short)lBottom, &bstrScreen);
m_Telnet.GetCursorPosition(&lColumn, &lRow);
m_Telnet.SetTerminalType (lType);
m_Telnet.SetScreenCharacters((short)lLeft, (short)lTop, (short)lRight, (short)lBottom, &bstrScreen);
m_Telnet.SetCursorPosition(lColumn, lRow);
}
catch (...)
{ }

Logged

jmabbott

  • John
  • Full Member
  • ***
  • Posts: 23
Re:OLE-API Questions
« Reply #20 on: March 04, 2005, 03:05:26 pm »

Any estimate about when I will get a reply?
(If it helps, we are scheduled to buy 60 additional licenses this month.)

In summary, the two hot questions are:
1. How do I make SetColor(ID,Value) work with Values between 8 and F?
2. When is the best time to do things like:
    set color mapping flag
    set colors
    set key maps
    etc.
 a:Before issuing the Connect.
 b:While processing the OnConnectionComplete event.
 c:After issuing the Connect.
Logged

Bob

  • Administrator
  • Ice Artist
  • *****
  • Posts: 1607
Re:OLE-API Questions
« Reply #21 on: March 08, 2005, 10:00:23 am »

Any estimate about when I will get a reply?
(If it helps, we are scheduled to buy 60 additional licenses this month.)

In summary, the two hot questions are:
1. How do I make SetColor(ID,Value) work with Values between 8 and F?
I'm not sure. What terminal type are you setting?

Quote
2. When is the best time to do things like:
    set color mapping flag
    set colors
    set key maps
    etc.
 a:Before issuing the Connect.
 b:While processing the OnConnectionComplete event.
 c:After issuing the Connect.
You cannot set emulation related parameters until after a connect. This is because the emulator core isn't initialized until just before the connect and there is no hook to get into the process between the core initialization and the connect that I know of.

I think the best bet is to set the terminal type OnConnectionComplete then set the color mapping flag, colors, etc OnTerminalTypeChanged. I'm assuming that these are all acting on the active profile. The default profile must be used for the connection. Perhaps it's possible to change the default profile to get what you want before the connect?
Logged

jmabbott

  • John
  • Full Member
  • ***
  • Posts: 23
Re:OLE-API Questions
« Reply #22 on: March 08, 2005, 11:39:59 am »

1. Terminal type is 2 - ANSI (25 Line).  At OnConnectionComplete: the terminal type is set, the colors are set (with bright foreground), the screen is re-written.  At that point the J.River copyright is on the screen in bright letters.  Then the text that arrives from the host is in dim letters.

2. Thanks - great info.  I never considered changing the color info in the default profile.  Our application extracts key mapping information from a user profile and passes it on to the OCX during OnConnectionComplete.  That lets us use your profile editor to setup key mappings.  Do you guys publish the exact structure of a profile?

Thanks again.  I have a few things to try.
Logged

Bob

  • Administrator
  • Ice Artist
  • *****
  • Posts: 1607
OLE-API Questions
« Reply #23 on: March 08, 2005, 03:13:33 pm »

The bright foreground on the copyright is normal. Also, it should go dim forground after you change terminal type to ANSI because that is the default for all non-wyse terminals. If it didn't go dim, the normal attribute changes (i.e. bold) wouldn't work right.

I'm not sure about whether or not changing the default profile will help (it's in the registry), We were thinking that it might be already read by the container before the OCX is run however you can try to test it if you want. The easiest test would be to just run telnet pro and change something in the default profile and see if the chage is reflected in your app.

Update, the default profile in the registry isn't read by the ocx. The default profile in the ocx needs to be changed with the get and set profile commands documented below.
« Last Edit: April 07, 2006, 04:24:31 pm by Bob »
Logged

jmabbott

  • John
  • Full Member
  • ***
  • Posts: 23
Re:OLE-API Questions
« Reply #24 on: July 06, 2005, 08:23:19 am »

1. Changes to the default profile are not reflected in applications using the OCX.  I just thought about rebooting - maybe the OCX only reads the default profile once.

2. Using the code below that swaps the ColorEntryTerminal makes Dejavu ANSI terminal emulation behave like other emulators that my users seem to like.

Thanks.


// long l0 = m_ac1.GetColorTableEntry (0);
   long l1 = m_ac1.GetColorTableEntry (1);
   long l2 = m_ac1.GetColorTableEntry (2);
   long l3 = m_ac1.GetColorTableEntry (3);
   long l4 = m_ac1.GetColorTableEntry (4);
   long l5 = m_ac1.GetColorTableEntry (5);
   long l6 = m_ac1.GetColorTableEntry (6);
   long l7 = m_ac1.GetColorTableEntry (7);
// m_ac1.SetColorTableEntry (0, m_ac1.GetColorTableEntry ( 8));
   m_ac1.SetColorTableEntry (1, m_ac1.GetColorTableEntry ( 9));
   m_ac1.SetColorTableEntry (2, m_ac1.GetColorTableEntry (10));
   m_ac1.SetColorTableEntry (3, m_ac1.GetColorTableEntry (11));
   m_ac1.SetColorTableEntry (4, m_ac1.GetColorTableEntry (12));
   m_ac1.SetColorTableEntry (5, m_ac1.GetColorTableEntry (13));
   m_ac1.SetColorTableEntry (6, m_ac1.GetColorTableEntry (14));
// m_ac1.SetColorTableEntry (7, m_ac1.GetColorTableEntry (15));
// m_ac1.SetColorTableEntry ( 8, l0);
   m_ac1.SetColorTableEntry ( 9, l1);
   m_ac1.SetColorTableEntry (10, l2);
   m_ac1.SetColorTableEntry (11, l3);
   m_ac1.SetColorTableEntry (12, l4);
   m_ac1.SetColorTableEntry (13, l5);
   m_ac1.SetColorTableEntry (14, l6);
// m_ac1.SetColorTableEntry (15, l7);
Logged

Bob

  • Administrator
  • Ice Artist
  • *****
  • Posts: 1607
Re:OLE-API Questions
« Reply #25 on: July 07, 2005, 04:04:01 pm »

1. Changes to the default profile are not reflected in applications using the OCX.  I just thought about rebooting - maybe the OCX only reads the default profile once.
I believe the "Default Profile" when using the ocx is in the data section of the ocx. This "default" is overwritten by the registry default when the telnet pro container reads the registry on  execution. Then if a different profile is selected in the telnet pro app it lays that over the same data area  again.
Quote
2. Using the code below that swaps the ColorEntryTerminal makes Dejavu ANSI terminal emulation behave like other emulators that my users seem to like.

Thanks.


// long l0 = m_ac1.GetColorTableEntry (0);
   long l1 = m_ac1.GetColorTableEntry (1);
   long l2 = m_ac1.GetColorTableEntry (2);
   long l3 = m_ac1.GetColorTableEntry (3);
   long l4 = m_ac1.GetColorTableEntry (4);
   long l5 = m_ac1.GetColorTableEntry (5);
   long l6 = m_ac1.GetColorTableEntry (6);
   long l7 = m_ac1.GetColorTableEntry (7);
// m_ac1.SetColorTableEntry (0, m_ac1.GetColorTableEntry ( 8  ));
   m_ac1.SetColorTableEntry (1, m_ac1.GetColorTableEntry ( 9));
   m_ac1.SetColorTableEntry (2, m_ac1.GetColorTableEntry (10));
   m_ac1.SetColorTableEntry (3, m_ac1.GetColorTableEntry (11));
   m_ac1.SetColorTableEntry (4, m_ac1.GetColorTableEntry (12));
   m_ac1.SetColorTableEntry (5, m_ac1.GetColorTableEntry (13));
   m_ac1.SetColorTableEntry (6, m_ac1.GetColorTableEntry (14));
// m_ac1.SetColorTableEntry (7, m_ac1.GetColorTableEntry (15));
// m_ac1.SetColorTableEntry ( 8, l0);
   m_ac1.SetColorTableEntry ( 9, l1);
   m_ac1.SetColorTableEntry (10, l2);
   m_ac1.SetColorTableEntry (11, l3);
   m_ac1.SetColorTableEntry (12, l4);
   m_ac1.SetColorTableEntry (13, l5);
   m_ac1.SetColorTableEntry (14, l6);
// m_ac1.SetColorTableEntry (15, l7);


What change does that make to the colors? (just curious).
Logged

jmabbott

  • John
  • Full Member
  • ***
  • Posts: 23
OLE-API Questions
« Reply #26 on: July 07, 2005, 05:17:55 pm »

Before the change the application displayed all text as dim letters no matter how the colors are set.  After changing the color table the application displays text as bright and dim letters as it does in other emulators.  Makes my users happy.
Logged

Bob

  • Administrator
  • Ice Artist
  • *****
  • Posts: 1607
OLE-API Questions
« Reply #27 on: July 07, 2005, 07:59:35 pm »

What happens when an application sets bold mode? The point of the dim default is to act like a real terminal which uses the bright colors to represent the bold attribute when an application sets it.
Logged

Bob

  • Administrator
  • Ice Artist
  • *****
  • Posts: 1607
OLE-API Questions - set/get profile call structure
« Reply #28 on: September 20, 2005, 05:06:00 pm »

This file contains the struct's and functions used to construct the profile variant that is used in the connect function (2nd parameter).
Theoretically you should be able to get the profile, change the terminal type and set the profile before calling the connect.

This code Copyright(C) Jriver, Inc. All rights reserved.

typedef struct {
        // data members
        char    ProfileName[128];
        int             TerminalType;

        LOGFONT fontText;

        int             TextColor;              // Index into color table.
        int             BkColor;                // Index into color table.


        BYTE    TerminalScreenHeight;   // Based on terminal type...
        DWORD   LineWidth;              // Current width of a line on the terminal screen.
        DWORD   NumberOfLines;  // Number of lines in virtual screen...cannot be smaller
                                                        // than terminal screen height.

        BOOL    UseVisualBell;
        BOOL    UseKeyboardCopyPaste;
        BOOL    TelnetSendOnEveryChar;  // Or send on EOL if false.
        BOOL    TelnetRemoteEcho;               // Or local echo if false.

        // Printing settings...either use system default or specify a printer.
        BOOL    UseDefaultPrinter;              
        char    Device[128];
        char    Driver[128];
   
   char  LocalModeDevice[128];
   char  LocalModeDriver[128];

        int      PrinterTimeout;
        long    PrintMethod;
        char    DirectPrintName[128];
        long    SegmentSize;
        int       BoldFont;

        BOOL    UsePCScanCodeKeyboard;

        // Hypertext link settings.
        BOOL    UseLinkHighlighting;
        int         LinkHighlightTextColor;
        BOOL    LinkHighlightingUnderLined;

        int       NumberOfVirtualScreens;
        char    MScreenPath[128];               // Directory to find mscreen program.
        char    MScreenCapPath[128];            // Directory to store mscreencap config file.
} PassProfile;

////////////////////////////////////////////////////////////////////

PassProfile ProfileData::GetPassProfile()
{
        PassProfile     Result;

        ZeroMemory(&Result, sizeof(Result));

        strcpy(Result.ProfileName, ProfileName.GetBuffer(ProfileName.GetLength()));
        ProfileName.ReleaseBuffer();

        Result.TerminalType = TerminalType;

        Result.fontText = fontText;
        Result.TextColor = Colors[DEJACOLOR_F_NORMAL];
        Result.BkColor = Colors[DEJACOLOR_B_NORMAL];
        Result.BoldFont= BoldFont;
        Result.TerminalScreenHeight = TerminalScreenHeight;
        Result.NumberOfLines = NumberOfLines;
        Result.LineWidth = LineWidth;

        Result.UseVisualBell = UseVisualBell;
        Result.UseKeyboardCopyPaste = UseKeyboardCopyPaste;
        Result.TelnetSendOnEveryChar = TelnetSendOnEveryChar;  
        Result.TelnetRemoteEcho = TelnetRemoteEcho;            

        // Printing settings...either use system default or specify a printer.
        Result.UseDefaultPrinter = UseDefaultPrinter;          
        strcpy(Result.Device, Device.GetBuffer(Device.GetLength()));
        Device.ReleaseBuffer();
        strcpy(Result.Driver, Driver.GetBuffer(Driver.GetLength()));
        Driver.ReleaseBuffer();

        strcpy(Result.LocalModeDevice, LocalModeDevice.GetBuffer(LocalModeDevice.GetLength()));
        LocalModeDevice.ReleaseBuffer();
        strcpy(Result.LocalModeDriver, LocalModeDriver.GetBuffer(LocalModeDriver.GetLength()));
        LocalModeDriver.ReleaseBuffer();
        Result.PrinterTimeout = PrinterTimeout;
                 Result.PrintMethod = PrintMethod;
        strcpy(Result.DirectPrintName,DirectPrintName.GetBuffer(Device.GetLength()));
        Result.SegmentSize = SegmentSize;

        Result.UsePCScanCodeKeyboard = UsePCScanCodeKeyboard;

        // Hypertext link settings.
        Result.UseLinkHighlighting = UseLinkHighlighting;
        Result.LinkHighlightTextColor = Colors[DEJACOLOR_F_LINK];
        Result.LinkHighlightingUnderLined = LinkHighlightingUnderLined;

        Result.NumberOfVirtualScreens = NumberOfVirtualScreens;

        strcpy(Result.MScreenPath, MScreenPath.GetBuffer(MScreenPath.GetLength()));
        MScreenPath.ReleaseBuffer();

        strcpy(Result.MScreenCapPath, MScreenCapPath.GetBuffer(MScreenCapPath.GetLength()));
        MScreenCapPath.ReleaseBuffer();

        return Result;
} // ProfileData::GetPassProfile()

////////////////////////////////////////////////////////////////

void SessionControl::CreateSafeArrayProfile(VARIANT & var, ProfileData * Data)
{
        ASSERT_POINTER(Data, ProfileData);

        // prepare data for ole
        HRESULT hCheckReturnValue;

        VariantInit(&var);


        SAFEARRAYBOUND  bound;
        bound.lLbound = 0;
        bound.cElements = sizeof(PassProfile);

        var.parray = SafeArrayCreate(VT_UI1, 1, &bound);

        if (NULL != var.parray)
        {
                var.vt = VT_ARRAY | VT_UI1;
                void *pArrayData = NULL;

                PassProfile     TempPassProfile = Data->GetPassProfile();

                // Lock the memory.
                hCheckReturnValue = SafeArrayAccessData(var.parray, &pArrayData);

                ASSERT(S_OK == hCheckReturnValue);

                // Copy the profile into the variant's SafeArray.
                memcpy(pArrayData, &TempPassProfile, sizeof(PassProfile));

                // Unlock the memory.
                hCheckReturnValue = SafeArrayUnaccessData(var.parray);

                ASSERT(S_OK == hCheckReturnValue);

        } // if
        else
        {
                TRACE("Error creating SafeArray.\n");
        } // if


///////////////////////////////////////////////////////////////

Code Making the call:


                        VARIANT var;

                        CreateSafeArrayProfile(var, Profile);

                        ...
                        // Finally, make the OLE Automation call to connect to the host.
                        pNewConnection->Connect(&strName, var);



Values for the terminal type:
const int DV_ANSI_24    = 1;
const int DV_ANSI_25    = 2;
const int DV_AT386        = 3;
const int DV_ATT60       = 4;
const int DV_VT102        = 5;
const int DV_VT2207BIT  = 6;
const int DV_VT2208BIT  = 7;
const int DV_IBM3151_24 = 8;
const int DV_IBM3151_25 = 9;
const int DV_WYSE60_24  = 10;
const int DV_WYSE60_25  = 11;
const int DV_WYSE160_24 = 12;
const int DV_WYSE160_25 = 13;
const int DV_PCTERM     = 14;
const int DV_LINUX_24   = 15;
const int DV_LINUX_25   = 16;


Logged

jwf

  • Full Member
  • ***
  • Posts: 11
  • Place Personal Text Here
OLE-API Questions
« Reply #29 on: September 29, 2005, 12:05:39 pm »

Hey Bob,

Thanks!  I'm using your AXControl in .NET using managed code.  From your description above I get:

   [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi)]
   public struct LOGFONT
   {
      public const int LF_FACESIZE = 32;
      public int lfHeight;
      public int lfWidth;
      public int lfEscapement;
      public int lfOrientation;
      public int lfWeight;
      public byte lfItalic;
      public byte lfUnderline;
      public byte lfStrikeOut;
      public byte lfCharSet;
      public byte lfOutPrecision;
      public byte lfClipPrecision;
      public byte lfQuality;
      public byte lfPitchAndFamily;
      [MarshalAs(UnmanagedType.ByValTStr, SizeConst=LF_FACESIZE)]
      public string lfFaceName;
   }
   
   [ StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi) ]
   public struct PassProfile
   {
      [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst=128)]
      public string  ProfileName;
      public int     TerminalType;
      public LOGFONT fontText;
      public int     TextColor;              // Index into color table.
      public int     BkColor;                // Index into color table.
      public byte    TerminalScreenHeight;  // Based on terminal type...
      public uint    LineWidth;              // Current width of a line on the terminal screen.
      public uint    NumberOfLines;  // Number of lines in virtual screen...cannot be smaller
                              // than terminal screen height.
      public bool    UseVisualBell;
      public bool    UseKeyboardCopyPaste;
      public bool    TelnetSendOnEveryChar;  // Or send on EOL if false.
      public bool    TelnetRemoteEcho;       // Or local echo if false.

      // Printing settings...either use system default or specify a printer.
      public bool    UseDefaultPrinter;              
      [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst=128)]
      public string  Device;
      [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst=128)]
      public string  Driver;
      [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst=128)]
      public string  LocalModeDevice;
      [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst=128)]
      public string  LocalModeDriver;
      public int     PrinterTimeout;
      public uint    PrintMethod;
      [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst=128)]
      public string  DirectPrintName;
      public uint    SegmentSize;
      public int     BoldFont;
      public bool    UsePCScanCodeKeyboard;

      // Hypertext link settings.
      public bool    UseLinkHighlighting;
      public int     LinkHighlightTextColor;
      public bool    LinkHighlightingUnderLined;

      public int     NumberOfVirtualScreens;
      [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst=128)]
      public string  MScreenPath;              // Directory to find mscreen program.
      [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst=128)]
      public string  MScreenCapPath;           // Directory to store mscreencap config file.
   }


For a quick test I checked Marshal.Sizeof(typeof(PassProfile)) and got 1164.
Is this the right size for this structure?

Next, using aximp.exe I shall see if I can call GetProfile(object l_profile)
Logged
Pages: 1 [2] 3
 

Page created in 0.012 seconds with 20 queries.