Login Page - Create Account

Support Board


Date/Time: Tue, 25 Feb 2025 10:33:16 +0000



Post From: How to create a Window with a Table in Sierra Chart Custom Study

[2021-04-04 23:39:22]
User741184 - Posts: 44
// Register the window class.
  const char g_szClassName[] = "myWindowClass";

  WNDCLASS wc = { };

  wc.lpfnWndProc = WndProc;
  wc.hInstance = NULL;
  wc.lpszClassName = g_szClassName;

  RegisterClass(&wc);

  HWND hwnd = CreateWindowEx(
    0, // Optional window styles.
    "Sample Window Class", // Window class
    "Learn to Program Windows", // Window text
    WS_OVERLAPPEDWINDOW, // Window style

    // Size and position
    CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,

    (HWND)sc.ChartWindowHandle, // Parent window
    NULL, // Menu
    NULL, // Instance handle
    NULL // Additional application data
  );
  ShowWindow(hwnd, SW_SHOW);


In my Sierra Chart custom study function, I have added this code to create a simple window and show it but it is returning me the error. GetLastError() function is returning error code 1407 and the message says Cannot find window class.

What am I doing wrong in the code? Also what should be supplied for HINSTANCE value? In the code above I have given NULL because I don't know from where to get this value. I am stuck here. Folks, your help is appreciated. Thanks.