|
Codeproject has an example[^] of convert mp3/wav to pcm maybe its helpful for you.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
hi,all.
i have a puzzle for this problem that i can use ON_EN_CHANGE like this:
ON_EN_CHANGE(IDC_IPADDRESS_NVR_IPADDR, OnFieldchangedIpaddressNvrIpaddr)
i thought ON_EN_CHANGE can only used for CEdit control because MicroSoft defined the ON_EN_CHANGE:
#define ON_EN_CHANGE(id, memberFxn) \
ON_CONTROL(EN_CHANGE, id, memberFxn)
and
#define EN_CHANGE 0x0300
and in MSDN:
Edit Control Handlers
ON_EN_CHANGE( <id>, <memberfxn> ) afx_msg void memberFxn( );
all of these defined in CEdit, so why i can used in IPCtrl? thank u very much.
</memberfxn></id>
|
|
|
|
|
kaviniswell wrote: all of these defined in CEdit, so why i can used in IPCtrl? thank u very much.
Because the IP Address control is made up of four edit controls, so IP address control must be forwarding this message to it's parent window.
|
|
|
|
|
Because the IP Address control is made up of four edit controls, so IP address control must be forwarding this message to it's parent window.
---------
the IP Address control is made up of four edit controls? but we know:
class CIPAddressCtrl : public CWnd
{...
class CEdit : public CWnd
{...
so it seems like no this relation between CIPAddressCtrl and CEdit?
|
|
|
|
|
What I meant was these edit controls are it's child controls. This MFC class is just a wrapper around it's SDK version, so you don't those edit controls as members.
Use Spy++ to locate these edit controls.
|
|
|
|
|
ok, i see. thank u very much.
|
|
|
|
|
Nibu babu thomas wrote: Use Spy++ to locate these edit controls.
humm.. teaching hacking!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
ThatsAlok umm.. teaching hacking!
Naah, an interesting tool to use when developing in windows. There is another one called WinID (quick and fast, very useful to me )
|
|
|
|
|
Hello guys,
Hope you can help me with this one.
For example,
BYTE buf[100000]; // contains binary data of an image
I wanted it to be written in an image file(*.bmp).
Thanks in advance.
modified on Wednesday, April 22, 2009 10:28 PM
|
|
|
|
|
You can use CFile object to write or read a binary file.
|
|
|
|
|
Thanks for the comment.
Well I have tried using CStdioFile and had successfuly created a file but the file cannot be opened to any image viewer. Error message implied of the wrong header.
// my code here
CStdioFile fp;
CFileException e;
if(fp.Open("c:\\Image.bmp",CFile::modeCreate|CFile::modeWrite|CFile::typeBinary,&e))
fp.Write(&buf,100000);
// end
* file was created and not 0 byte.
Did I use it wright? or There's something wrong with my code?
|
|
|
|
|
You can write as following:
CStdioFile fp_read,fp_write;
CFileException e;
char buf[1024];
fp_read.Open("c:\\ImageSrc.bmp",CFile::modeRead|CFile::typeBinary,&e);
fp_write.Open("c:\\Image.bmp",CFile::modeCreate|CFile::modeWrite|CFile::typeBinary,&e);
while (int count = fp_read.Read(buf,sizeof(buf)))
{
fp_write.Write(buf,count);
fp_write.Seek(0,CFile::end); // Important! You lose it!
fp_read.Seek(0,CFile::current); // Important! You lose it!
}
|
|
|
|
|
I have tried your code but has an error accessing Image.bmp.
Another thing is that I will not copy from a bitmap file to another bitmap file.
Instead, I have already a binary data in an array to copy to a bitmap file.
Hope you can help me with this.
Thanks.
|
|
|
|
|
Your code:fp.Write(&buf,100000);
The length of buf may be not enough. So you haven't copy the whole binary data.
Are you sure there are all binary data in the array?
If the answer is YES,you may use cycle to write in a bitmap file.Every time write 1024B binary data or more;
My code which send to you have no error when it runs in my computer.You may send me your error information.
|
|
|
|
|
Well, of course if you want to have a valid bmp image in the file, you should follow the .bmp file format. You can't just write a bunch of bytes into a file and expects that it will be interpreted as a bitmap. See here[^] for more information.
|
|
|
|
|
Cedric Moonen wrote: ...if you want to have a valid bmp image in the file, you should follow the .bmp file format. You can't just write a bunch of bytes into a file and expects that it will be interpreted as a bitmap.
His initial post indicated that buf "contains binary data of an image."
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
For me, "binary data of an image" means the data part of the image (so, excluding the header). I think he has an array that he filled in some way with the values of the pixels of the image. Of course, this is just my opinion because he wasn't really clear.
|
|
|
|
|
Cedric Moonen wrote: ...he wasn't really clear.
True. I just didn't want to assume too much one way or the other.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
TooShy2Talk wrote: Well I have tried using CStdioFile...
Why are you not using CFile ?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi,
I am trying to figure out the length of a RicheditControl
There is any article on the CodeProject which sheds some light on this
http://www.codeproject.com/KB/edit/richeditsize.aspx
Seems like the Main jist of the Article is the sending of a EN_REQUESTRESIZE to the parent Window the lparam
paramter of which has a pointer to a REQRESIZE structure which has whitin it a RECT structure
point is I am not sure in what units the rect is dealing with probably pixels
However I would like to convert it to what I get from the output of the Linelength method from Cricheditctrl
as that deals in bytes
As I know How many bytes or Characters I would like to output
anyway I could convert the output of REQRESIZE structure for pourposes of finding how many bytes/characters fit in a line
thankx
I can output
|
|
|
|
|
This program is for our motor engine.
include
int main(0)
while(1)
{
//do{
PORTA = 0xFF;
PORTB = 0xFF; //Turn all port D on
}
return(0);
}
void ioinit (void)
{
// 1 = output, 0 = input
DDRA = 0b11111111; //All outputs
DDRB = 0b11111111; //All outputs
return 0;
}
since me and my parter are relativly new to programming, we both looked at the sensor board program at the bottom of this page and made a few adjustments. what we want our engine to do is to just turn on and run. unlike the the program down below that had the lights on the sensor board flick on and off repeatedly. our circuit board only have 2 ports, A and B. so does this look correct?
5-10-07
Copyright Spark Fun Electronics© 2007
Nathan Seidle
nathan at sparkfun.com
ATmega168
Example Blink
Toggles all IO pins at 1Hz
*/
#include
//Define functions
//======================
void ioinit(void); //Initializes IO
void delay_ms(uint16_t x); //General purpose delay
//======================
int main (void)
{ int stepval=0;
ioinit(); //Setup IO pins and defaults
while(1)
{
do{
PORTC = 0xFF;
PORTB = 0xFF;
PORTD = stepval;
delay_ms(1000);
stepval+=(0x20);
}
while(stepval<0xE0);
do
{
PORTC = 0x00;
PORTB = 0x00;
PORTD = stepval;
delay_ms(1000);
stepval-=(0x20);
}
while(stepval>0);
}
return(0);
}
void ioinit (void)
{
//1 = output, 0 = input
DDRB = 0b11111111; //All outputs
DDRC = 0b11111111; //All outputs
DDRD = 0b11111110; //PORTD (RX on PD0)
}
//General short delays
void delay_ms(uint16_t x)
{
uint8_t y, z;
for (; x > 0; x--){
for ( y = 0; y < 90; y++){
for ( z = 0; z < 6; z++){
asm volatile ("nop");
}
}
}
}
|
|
|
|
|
Hi there's a cool thing called <pre> that will turn your code into something that has correct indentation, is a different color, and will help us help you!
First thing you didn't do is call ioinit().
Blinkenlights:
int main (void)
{
int stepval=0;
ioinit();
while(1)
{
do {
PORTC = 0xFF;
PORTB = 0xFF;
PORTD = stepval;
delay_ms(1000);
stepval+=(0x20);
} while(stepval<0xE0);
do {
PORTC = 0x00;
PORTB = 0x00;
PORTD = stepval;
delay_ms(1000);
stepval-=(0x20);
} while(stepval>0);
}
return(0);
}
void ioinit (void)
{
DDRB = 0b11111111;
DDRC = 0b11111111;
DDRD = 0b11111110;
}
Here's your code:
int main(0) {
while(1)
{
PORTA = 0xFF;
PORTB = 0xFF;
}
return(0);
}
void ioinit (void)
{
DDRA = 0b11111111;
DDRB = 0b11111111;
return 0;
} All this is going to do is set every wire on portA and portB high. If nothing is setting these ports low again (an external switch?), then you don't need a while(1) , which is for doing repetitive things. so maybe this would work:
int main() {
motorInit();
while(1);
return 0;
}
void motorInit(){
DDRA=0xff;
DDRB=0xff;
}
>.< I typed all this in and then didn't hit submit until this morning
|
|
|
|
|
I think you had it there, but went off the rails a bit.
ioinit just sets the direction registers, you still need to set the bits in the port.
int main() {
motorInit();
while(1);
return 0;
}
void motorInit(){
DDRA=0xff;
DDRB=0xff;
}
int main(0) {
ioinit()
while(1)
{
PORTA = 0xFF;
PORTB = 0xFF;
}
return(0);
}
void ioinit (void)
{
DDRA = 0b11111111;
DDRB = 0b11111111;
return 0;
}
|
|
|
|
|
I have tried to search on samples to see how I could populate a List control from a function. I have been able to do it without using a tab control. However I am now trying to use a tab control that has 2 pages and have been unsucessful.
If anyone has any samples in getting this accomplished I would greatly appreciate it.
I have m_Dialog[1] = CTableSummary.
In this Dialog I have a IDC_LIST2 = m_summary.
In the function DoDataExchange(CDataExchange* pDX)
DDX_Control(pDx,IDC_LIST2, m_summary);
I have a function thats trying to update that list control.
m_summary.InsertItem(0,EmployeeName);
I have included the TableSummary.h into the function file thats trying to update the list control.
I am getting a compile error left of m_summary must have class/struct/union.
What have i missed or is my insert statement wrong.
I am only having this problem when I use a tab control. It would be stupid of me not to use a tab control since most of the data is summary and details are viewed when there seems to be a problem
Could someone please help.
thanks a million
|
|
|
|
|
FISH786 wrote: I am getting a compile error left of m_summary must have class/struct/union.
What type is m_summary ?
What statement produces the error?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|