|
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
|
|
|
|
|
DDX_Control(pDx,IDC_LIST2, m_summary);
Its a CListCtrl.
|
|
|
|
|
Hi,
i have created an ActiveX in MFC which I call from a local HTML page via vbscript(XP Pro IE6) however it
always pops up a warning I have been told I need to implement IObjectSafety
But I don't Have a clue!!!
pls help me out....
|
|
|
|
|
This page [^] might interest you.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I am able to control the mouse movement on the screen as the following:
double fScreenWidth = GetSystemMetrics( SM_CXSCREEN )-1;
double fScreenHeight = GetSystemMetrics( SM_CYSCREEN )-1;
double fx = PosX * (65535.0f/fScreenWidth);
double fy = PosY * (65535.0f/fScreenHeight);
INPUT Input={0};
Input.type = INPUT_MOUSE;
Input.mi.dwFlags = MOUSEEVENTF_MOVE|MOUSEEVENTF_ABSOLUTE;
Input.mi.dx = fx;
Input.mi.dy = fy;
SendInput(1,&Input,sizeof(INPUT));
However, I am not able to highlight the text or scroll the text as I wanted! Can it be some thimg like this:
For scroll (as WM_MOUSEWHEEL in http://code.google.com/p/lomm/source/browse/trunk/LOTROMusicManager/SDK.cs?spec=svn105&r=105):
Input.mi.dwFlags = 0x020A|MOUSEEVENTF_MOVE|MOUSEEVENTF_ABSOLUTE; For Highlight (as Left button down & XY moving):
Input.mi.dwFlags = MOUSEEVENTF_LEFTDOWN|MOUSEEVENTF_MOVE|MOUSEEVENTF_ABSOLUTE;
Can anyone help? Thank in-advanced.
|
|
|
|
|
hi all,
i am working on Text to Speech in MFC and i have to highlight words when TTS speaks
can anyone tell me how to do this, how text will highlight when speaks.
waiting for reply.
thanxs in advance
|
|
|
|
|
Member 2828452 wrote: am working on Text to Speech in MFC and i have to highlight words when TTS speaks
can anyone tell me how to do this, how text will highlight when speaks.
waiting for reply
Which control are you using?
"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
|
|
|
|
|
how to change slave sound device to primary sound device(usb sound device and realtek
high definition audio in my computer).
change its in C++ or C# .
look forward to your favorable reply.
best regards
|
|
|
|
|
I am building an application that has on openGL window in an MFC dialog
the OpenGL window is implemented using CWnd class and CRect...
the OpenGL window has a 1D graph plotted.
i want to implement a horizontal scroll in the dialog if my graph goes out of the veiwport or if the OpenGL window is scaled..
Any help would be really appreciated
& its a little urget
please help
|
|
|
|
|
Hi,
i created an ActiveX control using MFC ..pls let me know how can i make ActiveX control as Safe for Scripting and Initialization...
|
|
|
|
|
This page might interest you.
How to mark MFC ActiveX controls as Safe for Scripting and Initialization[^]">
|
|
|
|
|
Hello,
I'm new to MFC and I have a situation that I cannot handle ...
I have a dialog based application and within this dialog I have a tab control.
For each tab, I've created a property page as a new resource.
Within these property pages I have edit boxes, combo boxes and other controls.
The tabs are working fine ... but I can't find a way to have access to the controls within each property page
I've tried in many, many ways but with no success.
I would be grateful if you can help me.
Many thanks,
Mike.
|
|
|
|
|
One way is to set the values you need from the controls in the property sheet class using the get/set functions. In this manner you can access the values across different tabs
See GetPage function from CPropertyPage
Hope it helps
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
OK, I will try.
Thank you for your quickly reply!
Mike.
|
|
|
|
|
Mihai Andrei Dragnea wrote: The tabs are working fine ... but I can't find a way to have access to the controls within each property page
Using ClassWizard (Ctrl+W), associate each control a member variable of the appropriate type (edit control = CEdit , combobox = CCombobox ). Now when you want to assign a value to an edit control, just use:
m_editPhone.SetWindowText("(800) 555-1212"); When you want to add items to the combobox, use:
m_cbStates.AddString("Oklahoma");
"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
|
|
|
|
|
David,
I am running into a simillar issue. I am trying to update a list control on one of the pages and have declared a variable for the control. However I get a compile error m_summary must have class/struct/union.
I am trying to update the page from a function withing the same app.
m_summary.InsertData(0,EmployeeName);
Could you please advice.
Thanks a Million.
|
|
|
|
|
FISH786 wrote: ...and have declared a variable...
Of what type?
"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
|
|
|
|
|
IDC_LIST2, which is a List control.
|
|
|
|