forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Listbox is empty in 64 bit C++

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
Ryan



Joined: 25 Feb 2016
Posts: 110

PostPosted: Fri Jul 12, 2019 11:38 am    Post subject: Listbox is empty in 64 bit C++ Reply with quote

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.


Code:


#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;
}
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Fri Jul 12, 2019 12:38 pm    Post subject: Reply with quote

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

Code:
static char *lb_items[] = {


Given more time I may be able to explain why.
Back to top
View user's profile Send private message AIM Address
Ryan



Joined: 25 Feb 2016
Posts: 110

PostPosted: Fri Jul 12, 2019 12:41 pm    Post subject: Reply with quote

Thank you Paul, that works for me too.

Time is a precious thing, I'm not worried about why it works (unless you are).
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group