Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (1 invisible), 672 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
CHOOSECOLOR structure #151474
09/01/07 10:44
09/01/07 10:44
Joined: Jan 2007
Posts: 651
Germany
R
RedPhoenix Offline OP
User
RedPhoenix  Offline OP
User
R

Joined: Jan 2007
Posts: 651
Germany
You added the chooseColor function to the api list (api.def). But this function is senseless without having the CHOOSECOLOR structure. Please add the CHOOSECOLOR structure to the windows.h by default.

EDIT: Here the definitions:
Code:
  
typedef DWORD COLORREF; //unnecessary, but for being more similar to the msdn examples
typedef struct _CHOOSECOLOR{
long lStructSize;
long hwndOwner;
long hInstance;
COLORREF rgbResult;
COLORREF *lpCustColors;
long Flags;
long lCustData;
long lpfnHook;
char* lpTemplateName;
}CHOOSECOLOR;
DWORD __stdcall ChooseColor (DWORD);



And for dealing with the returned values there is also the need for these windows macros:
http://msdn2.microsoft.com/en-us/library/ms532645.aspx


P.S. You already included the flag definitions for this structure

Last edited by RedPhoenix; 09/01/07 11:28.
Re: CHOOSECOLOR structure [Re: RedPhoenix] #151475
09/01/07 21:37
09/01/07 21:37
Joined: Jan 2007
Posts: 651
Germany
R
RedPhoenix Offline OP
User
RedPhoenix  Offline OP
User
R

Joined: Jan 2007
Posts: 651
Germany
Ok nevermind about the macros, I found a better solution:

Code:
 
typedef DWORD COLORREF; //unnecessary, but for being more similar to the msdn examples
typedef struct _CHOOSECOLOR{
long lStructSize;
long hwndOwner;
long hInstance;
char rgbResult[4];
COLORREF *lpCustColors;
long Flags;
long lCustData;
long lpfnHook;
char* lpTemplateName;
}CHOOSECOLOR;
DWORD __stdcall ChooseColor (DWORD); //function prototype



If the rgbResult member is defined as a char array, the bytes of the rgb value structure (0x00BBGGRR or sth. like that) will be seperated automatically. No need for the macro functions then.

Last edited by RedPhoenix; 09/01/07 21:39.
Re: CHOOSECOLOR structure [Re: RedPhoenix] #151476
09/03/07 08:34
09/03/07 08:34
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
Thanks for the suggestion. We'll add the CHOOSECOLOR struct and related defines and functions to the next version.

Re: CHOOSECOLOR structure [Re: jcl] #151477
09/18/07 22:10
09/18/07 22:10
Joined: Mar 2007
Posts: 197
Y
yorisimo Offline
Member
yorisimo  Offline
Member
Y

Joined: Mar 2007
Posts: 197
I am trying to use the ChooseColor function (i replaced my windows.h file with the new one from V7.06 beta that has the CHOOSECOLOR structure and function definition)
I get an "E1513 Crash in main" error when I try to run this:
Code:
 
#include <acknex.h>
#include <default.c>
#include <windows.h>

function main()
{
wait(1);

CHOOSECOLOR cc;
cc.lStructSize=sizeof(CHOOSECOLOR);
cc.hwndOwner=hWnd;
cc.hInstance=NULL;
cc.rgbResult=0x00aa0000;
cc.lpCustColors=NULL;
cc.Flags=CC_RGBINIT;
cc.lCustData=NULL;
cc.lpfnHook=NULL;
cc.lpTemplateName=NULL;

ChooseColor(&cc); //crashes here
}



Why?
Also when I try to use the RGB() macro, e.g, cc.rgbResult=RGB(0, 0, 0);, I get the error "machine code generator: can not translate CONV:CHAR::SHORT"

Last edited by yorisimo; 09/19/07 14:18.
Re: CHOOSECOLOR structure [Re: yorisimo] #151478
09/19/07 16:33
09/19/07 16:33
Joined: Jan 2007
Posts: 651
Germany
R
RedPhoenix Offline OP
User
RedPhoenix  Offline OP
User
R

Joined: Jan 2007
Posts: 651
Germany
I don't know how conitec finally included the structure because I don't have the A7.06 beta, but if they did as I sugested above they won't have included the rgb macros, but defined the rgbresult as a byte array with 4 values. The rgba value will then be seperated automattically (it did in my code!).
You should check this in the windows.h, and then try it with the var type which they used for the rgbresult.

Re: CHOOSECOLOR structure [Re: RedPhoenix] #151479
09/19/07 17:04
09/19/07 17:04
Joined: Mar 2007
Posts: 197
Y
yorisimo Offline
Member
yorisimo  Offline
Member
Y

Joined: Mar 2007
Posts: 197
They didn't do it your way. This is what they added to windows.h:
Code:
 
typedef DWORD COLORREF;
typedef struct CHOOSECOLOR {
long lStructSize;
long hwndOwner;
long hInstance;
COLORREF rgbResult;
COLORREF *lpCustColors;
long Flags;
long lCustData;
long lpfnHook;
char* lpTemplateName;
} CHOOSECOLOR;

#define RGB(r,g,b) ((COLORREF)(((BYTE)(r)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(b))<<16)))
#define GetRValue(rgb) ((BYTE)(rgb))
#define GetGValue(rgb) ((BYTE)(((WORD)(rgb)) >> 8))
#define GetBValue(rgb) ((BYTE)((rgb)>>16))

BOOL WINAPI ChooseColor(CHOOSECOLOR* lpcc);
#define PRAGMA_API ChooseColor;comdlg32.dll!ChooseColorA




I figured out my problem: lpCustColors cannot be null

Last edited by yorisimo; 09/19/07 17:35.

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1