Silverfrost Forums

Welcome to our forums

Listbox is empty in 64 bit C++

12 Jul 2019 10:38 #23981

The following works under 32 bit but when compiled with /64 the listbox is empty. I have tried passing the number of items (as noted below) but this results in a winio error.

#include <stdlib.h>
#include <windows.h>

// Compile with;
//   scc ls.cpp /link
// or
//   scc ls.cpp /link /64
int main()
{
    char *lb_items[] = {
        'Line 1',
        'Line 2',
        'Line 3',
        'Line 4', NULL};
    int selection=2;
    int numItems=4;

    winio('%ca[Listbox test]&');
    // Works in 32 bit, 64 bit shows an empty list.
    winio('%40.4ls',lb_items,&selection);

    // Trying to pass number of items (as per docs) 'Error - Unused arguments in winio call.'
    //winio('%40.4ls',lb_items,&numItems,&selection);

    return 0;
}
12 Jul 2019 11:38 #23982

It works OK if you make the array static...

static char *lb_items[] = { 

Given more time I may be able to explain why.

12 Jul 2019 11:41 #23983

Thank you Paul, that works for me too.

Time is a precious thing, I'm not worried about why it works (unless you are).

Please login to reply.