View previous topic :: View next topic |
Author |
Message |
Ryan
Joined: 25 Feb 2016 Posts: 110
|
Posted: Fri Jul 12, 2019 11:38 am Post subject: Listbox is empty in 64 bit C++ |
|
|
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 |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
Posted: Fri Jul 12, 2019 12:38 pm Post subject: |
|
|
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 |
|
|
Ryan
Joined: 25 Feb 2016 Posts: 110
|
Posted: Fri Jul 12, 2019 12:41 pm Post subject: |
|
|
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 |
|
|
|