Question to guy

Discuss PocketC for CE (including Desktop Edition)

Postby KOU on Fri Jun 28, 2002 3:20 pm

I have two questions for you.

1. How are you using variable types not really supported in PocketC?
Are you using it like this...
HWND mainWnd = (HWND) arrayArg[7].Int();
or are you locking memory inside DLL?
(ex. LocalAlloc, new, malloc)

2. What's wrong with this code?
It freezes in LV_additem function.
#define WS_BORDER 0x00800000
#define WS_VISIBLE 0x10000000
#define WS_VSCROLL 0x00200000
#include "/pocketc/windef.h"
#include "/pocketc/commctrl.h"

LV_addcolumn(int id, int ncolumn,
string itext,int width){
LVCOLUMN column;

column.mask = LVCF_TEXT|LVCF_WIDTH; = width;
column.pszText = itext;
ListView_InsertColumn(gethwnd(id), ncolumn, column);

LV_additem(int id,int itemn,
string itext,int icon,int mask){

Item.state = 0;
Item.stateMask = 0;
Item.cchTextMax = 0;
Item.lParam = 0;
Item.iIndent = 0;
Item.mask = mask;
Item.iItem = itemn;
Item.iSubItem = 0;
Item.pszText = itext;
Item.iImage = icon;

ListView_InsertItem(gethwnd(id), Item);

string str;

str = "test";

LV_addcolumn(100, 0, str, 50);

--- Deleted Message ---
Edited by - KOU on 07/01/2002 09:46:37

--- Restored Message ----

Edited by - KOU on 07/01/2002 16:25:48

Edited by - KOU on 07/01/2002 16:27:08
Posts: 92
Joined: Mon Mar 18, 2002 8:04 pm
Location: USA

Postby guy on Mon Jul 08, 2002 1:46 pm

I'll answer question 1 for now. I'd need to look at the code in question 2 in more detail.

The variable types are things known to the compilers. The CPU just knows about memory locations. As long as you know how a variable is ultimately stored and used by the CPU (follow the chain of typedefs back to the basic variable type) then you can cast variables in either direction.

With the PocketC CVMStackEntry class you have to look at the definition in stackentry.h because some of the casts don't do what you would expect. In particular, for characters and strings you have to use wchar_t and wchar_t* casts, otherwise the constructors in the CVMStackEntry class try to be too clever.

Everything is going to end up as a 16 bit or 32 bit (int, unsigned int, pointer to anything, reference to anything, array, pointer to function, HWND, ...) value, except for PocketC floats which turn into doubles.

The problem in your code in question 2 could be the API interface function itself. I didn't write the LV interfaces and haven't really checked that part of the library. I'll have a look next time I'm editing the listview source file.

PocketC CE API interface:
PCForm and CE API forum:
PocketC CE API interface:
PCForm and CE API forum:
Posts: 879
Joined: Thu Dec 07, 2000 8:58 am
Location: United Kingdom

Postby KOU on Wed Jul 10, 2002 2:17 pm

Thank you guy.
I understand now.

In question number 2, it really does not freeze, but it exits without any prompt. when it executes ListView_InsertItem() function.
ListView_InsertColumn() function seems to be fine.
It is same in my own DLLs.
That's why I quitted programming MidiPP PocketC Version.

Do you have any idea why it does this? >guy, Admin
Posts: 92
Joined: Mon Mar 18, 2002 8:04 pm
Location: USA

Return to PocketC for CE

Who is online

Users browsing this forum: No registered users and 1 guest