|
Hi Baerten Thank you. That's great to know.
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
How to reduce bitmap colors from 24 bits to 256 or less?
my purpose is to save rich colored bitmap to gif file.
As I test, CxImage can not save rich colored bitmap to gif file properly because it can not reduce colors properly.
CxImage is fine to transfer 256 color bitmap to gif file.
So I need source code (similar to CxImage etc) to reduce bitmap colors first then use CxImage to transfer it to gif file.
|
|
|
|
|
GDI+ will do this for you, although it may not dither in the way you're hoping.
Dithering is the process you want, that's the word to google to get more info.
|
|
|
|
|
Hey all, Iam currently trying this small example to understand the pointers, arrays,etc. in C.
When I try executing the following , the program breaks inside fruitexec() as it would pass the list FrList sometime and not other time.
Why? Isnt the list passed the right way?
Am I pointing at differnt location?
Any help appreciated.
struct Fr_t<br />
{<br />
<br />
char * name;<br />
<br />
char * colour;<br />
<br />
};<br />
static struct Fr_t g_fr[] =<br />
{<br />
<br />
{<br />
"Apple",<br />
"pink",<br />
<br />
},<br />
{<br />
"Mango",<br />
---<br />
<br />
},<br />
<br />
{<br />
<br />
},<br />
<br />
{<br />
<br />
},<br />
{<br />
0,<br />
0,<br />
0<br />
}<br />
};<br />
<br />
struct FrList_t<br />
{<br />
char * name;<br />
} FrList_s[4];<br />
<br />
all the above structs are declared globally.<br />
<br />
<br />
<br />
static struct Fr_t* pickFr( struct Fr_t *Frtcollection, const char * name ) <br />
{<br />
struct Fr_t * what = 0;<br />
if ( Frtcollection )<br />
{<br />
<br />
for ( what = Frtcollection; what->name; ++what )<br />
{<br />
if ( strcmp( what->name, name ) == 0 )<br />
{<br />
break;<br />
}<br />
}<br />
<br />
}<br />
<br />
return ( what );<br />
}<br />
<br />
<br />
<br />
<br />
int fruitexec(int farm, struct FrList_t * Fr_List)<br />
{<br />
int next_fr = 0;<br />
struct Fr_t* fruit = 0;<br />
--------<br />
------<br />
Fr_List = & (FrList_s[next_fr])<br />
if( FrList_s[next_fr].name )<br />
{<br />
fruit = pickFr( g_fr, Fr_List->name );<br />
}<br />
<br />
printf( "The name is %s.\n", FrList_s[next_fr].name );<br />
<br />
<br />
-------<br />
---------<br />
}<br />
in main, we assign <br />
{<br />
FrList_s[0] = "Mango";<br />
FrList_s[1] = "Apple";<br />
...<br />
....fruitexec(..., Fr_List_s);<br />
}
|
|
|
|
|
thathvamsi wrote: FrList_s[0] = "Mango";
FrList_s[1] = "Apple";
where are you reserving memory for these ?
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
thathvamsi wrote: static struct Fr_t* pickFr( struct Fr_t *Frtcollection, const char * name )
is static here necessary ?
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
where do i reserve memory? and how?
if i dont put static, the warning message i get is "no predefined prototype"
|
|
|
|
|
allocating memory:
char *name;
name = new char[5];
as for the function, simply put the prototype of the funtion after your global declaration.
int myfunc(void);
bla...
int myfunc(void)
{
}
Are you writing C or C++ ?
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
iam writing C.
Do I have to do this for every structure member?
is that why you think the code is breaking?
|
|
|
|
|
thathvamsi wrote: Do I have to do this for every structure member
Yes. Because
char *str;
str="Hello";
simply does not work. You háve to allocate memory somewhere for your strings.
char str[5];
str="Hello";
thathvamsi wrote: is that why you think the code is breaking
Not only (see Mickael's comment). This is something that will cause your app to crash asa it can compile.
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
Rage wrote: char *str;
str="Hello";
simply does not work.
Sure it does. The string literal "Hello" resides at a static memory location that str points to.
Rage wrote: char str[5];
str="Hello";
Are you kidding (str is not an l-value)?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: Are you kidding
I was too lazy to strcpy .
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
Your type and variable names are really confusing, but I think the problem is you're mixing up FrList_t and Fr_t in your pointer types.
|
|
|
|
|
HI all,
I want to get notified when we change from 1 doc/view to other in a MDI application. Thanks in advance.
Regards
Gan
|
|
|
|
|
create a new MDI app, then copy code to right places.
there are lots of modifications for a large project.
The work depends on your expeirence - I don't think there is any good method to do that.
|
|
|
|
|
I think you completely misunderstood his question...
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
Maybe with OnActivateView or OnActivateFrame ?
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
I have a property sheet ,
I am not able to process the WM_CTLCOLOR msg for the tabes in the sheet
can anyone , I am also not able to process the WM_KEYUP message
can anyone tell me how to do that for property windows.
take care
vikas
Vikas Amin
EATON
PUNE
|
|
|
|
|
(1)there is no simple method to change table color of sheet - some people use "owner-draw" to do that.
(2)is the message for sheet or controls on sheet or pages?
microsoft blocks some key messages for edit-box etc. in MFC dialog, property-sheet and property-page, I don't know why they do that.
for a controls: try PreTranslateMessage(...) to see if the message is processed, otherwise, go to its parent (sheet or pages) to get the message then post it to the control - I did this in Win95/98 time.
|
|
|
|
|
I m trying to capture particular key combination (For e.g ctrl + s to Save) and then i want to execute my piece of code before call goes to actual " Save " routine ?
Can any1 help me ...?
vaibhav
|
|
|
|
|
You need to install a KeyBoardHook to achieve this.
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
You have to filter very "WM_KEYDOWN" message and check whether "CTRL + S" is happend.
For that you can override "PreTranslateMessage(pMsg)" .
Plz see the code snippet you have to add in "PreTranslateMessage(pMsg)".
if ( WM_KEYDOWN == pMsg->message && pMsg->wParam == 0x53 /* 'S' */)
{
if ( ( ::GetKeyState ( VK_LCONTROL ) & KF_UP ) ||
( ::GetKeyState ( VK_RCONTROL ) & KF_UP ) )
{
// Ctrl + s pressed. Write ur code here.
}
}
return CDialog::PreTranslateMessage(pMsg);
|
|
|
|
|
Hi guys.
I used from "EditLabel" property of CListCtrl, but it gets only one parameter (item).I want to edit
other column.
On the other hand, how can I Edit all column of CListCtrl.
Truely yours.
|
|
|
|
|
The CListCtrl class only allows you t edit the one column, you probably want some sort of grid control.
|
|
|
|
|
use BOOL SetItem(
int nItem,
int nSubItem, // index of column that you need to edit.
UINT nMask,
LPCTSTR lpszItem, // value that you need to change.
int nImage,
UINT nState,
UINT nStateMask,
LPARAM lParam
);
good luck!
i love vc!This will appear at the
end of messages you post
to the Code Project
|
|
|
|