|
Hello every body.I'm from Thailand and this First time to visit this website. ....
I want to Made Soure code Crc 10 by c++. Program can calculate Crc10 to input binary(bit for check) and out put binary too .please help me how to made it.
Thanks...
|
|
|
|
|
what is the simplest way to get the output of a cmd window into a dialog?
mfc VC++ 6
-- modified at 22:07 Saturday 18th November, 2006
|
|
|
|
|
CHeck out this article[^], the sample code runs a console app and reads the output.
|
|
|
|
|
In my memory,i think PIP2 can catch the output of cmd app's message.....
|
|
|
|
|
I would need to have a different spacing between lines in a multiline edit box, but I can't find anything. I can change the spacing between character, but not lines. Is there anything that could do this?
|
|
|
|
|
Besides rolling your own edit control, you could use a ES_MULTILINE Rich Edit (2.0+) control and
set the line spacing with the EM_SETPARAFORMAT message using the PARAFORMAT2 structure.
It may be over-kill for your needs but it works
|
|
|
|
|
Seems a bit too much to go now and change all the Edit controls to Rich Edit and so on. So I guess I'll leave everything as it is and no line spacing this time
|
|
|
|
|
Sorin Basca wrote: Seems a bit too much to go now and change all the Edit controls to Rich Edit and so on.
It's actually not too bad since Rich Edit controls work with the same messages as standard
edit controls. They sure have alot of stuff you may not need though!
Mark
|
|
|
|
|
I have a problem with passing function pointer as lParam. I get an error message like that: error C2440: 'type cast' : cannot convert from 'void (__thiscall Screenshots::* )(void)' to 'LPVOID'
how to fix that?
Screenshots::Screenshots()
{
void (Screenshots::*ScrLoopPtr)(void);
ScrLoopPtr = &Screenshots::ScrLoop;
hookHD = CreateThread(0, 0, mThread, (LPVOID)ScrLoopPtr, 0, 0);
}
thanks for help
|
|
|
|
|
Whats the purpose of this line?
void (Screenshots::*ScrLoopPtr)(void);
Is your Screenshots::ScrLoop function declared as static?
Try this
typedef void (Screenshots:: ScrLoopPtr)( void );<br />
ScrLoopPtr = &Screenshots::ScrLoop; <br />
hookHD = CreateThread(0, 0, mThread, (LPVOID)ScrLoopPtr, 0, 0);
|
|
|
|
|
it was simpler than i thought
ScrLoop was not static so i declared it as static and passed its pointer like that CreateThread(0, 0, mThread, &Screenshots::ScrLoop, 0, 0);
|
|
|
|
|
Hi
I am reading some documents about win32 programming.And try to understand its event procedure.
For windows controls which i added to my application.When an event occurs windows add a msg to its msg tail.But also send WM_COMMAND msg to my application so i can do something when that event occurs.
For example for button click event:
Message:BM_CLICK
Notification:BN_CLICKED
(I hope i am right until now)
But i looked other controls mesg and notification lists.They don't match.I mean there is not notification for every message.
For example combobox have CB_ADDSTRING mesage, but it does not have CBN_ADDSTRING notification.
But why?
What is the concept for notification and messages, what is the differnces between them?
I hope i can explain my question well, i am trying to understand win32 event procedure fully when an event occurs.
I am looking for your answers.
Thanks..
|
|
|
|
|
One more question.
When an event ocuurs for example button clicks.
Which one is first doing by OS.
Notification or msg?
I mean, first windows put msg to msg tail of button control and put WM_comaand msg to my application.Or reverse order?Which one is first?
|
|
|
|
|
The best thing to do is use spy++ (comes with VC6) to watch the messages in a window. In Visual Studio, click 'Tools' from the menu and then click spy++. Use this tool to first find a window, then watch it's messages. You can start clicking buttons in the window to watch which messages are being sent and recieved.
|
|
|
|
|
I'm not I follow your logic "When an event occurs windows add a msg to its msg tail". But here is the basic principle.
A message is more like a command. A BM_CLICK tells the button to click. A notification only occurs if something meaningful happened. The button was clicked, you need to know about it so a BN_CLICK is sent. You chose a bad example here because BM_CLICK tells the button to simulate a click, which you already know about since you sent it.
CB_ADDSTRING will tell the combobox to add a string, there is no notification because you already know a string is being added ( YOU added it ). But, if the user clicks an item, you need to know, so the combobox will send a notification to you.
Most messages you will deal with ( the command type ), are what the OS wants your application to do. WM_PAINT to display itself, WM_CLOSE to close, WM_DESTROY to jump of a cliff and commit suicide. All the window controls will process the same messages, but this is hidden from you because windows does it for you. But for example, if you click the minimize button in your app, the desktop window will need to be notified so that it can repaint itself, so a WM_SYSCOMMAND will notify the parent.
Understand?
|
|
|
|
|
Hmm, thank you WalderMort
But still i am not sure about whether notification or message sending proceed first.
Which one is first making by OS.
Put msg to msg tail and then notify parent or notfy parent and put msg to tail.
Thansk again.
|
|
|
|
|
There is no notification for "a string was added to a combobox" because that's not something the user can do. There is a notification for "a button was clicked" because the user can click buttons, and your app needs to know when it happens.
|
|
|
|
|
ok
thank you Michael Dunn, i understand it.
Which one is doing first by OS for example for button click.
Notification or adding msg to msg queue?
|
|
|
|
|
The message is the notification.
|
|
|
|
|
For button message, I think you can just ignore the notification code of BN_CLICKED.
|
|
|
|
|
I have just started experimenting with drawing. The following code simply draws some nonsense to get an idea of how the commands work.
Question: In my code I define the rectangle. Is there a way to get the rectangle coordinates of a dialog object? Then assign them to MyRectangle ? Then draw in those coords? Then the drawing area could be moved around the dialog in the dialog editor.
CClientDC dc(this);<br />
CPen MyNewPen;<br />
MyNewPen.CreatePen(PS_SOLID,1, RGB(255,0,0)); <br />
CPen *pOriginalPen;<br />
pOriginalPen = dc.SelectObject(&MyNewPen);<br />
<br />
CRect MyRectangle(20, 10, 120, 110); <---can I get these coords for a dialog item?<br />
<br />
dc.MoveTo(100,100);<br />
dc.Ellipse(&MyRectangle);<br />
dc.LineTo(200,200);<br />
dc.SelectObject(pOriginalPen);
|
|
|
|
|
Have a look at GetWindowRect(), GetClientRect(), ClientToScreen() and ScreenToClient(). Also look at the CRect member functions, there are lots of functions there for manipulating the rectangle.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Hi guys,
I’m hoping that someone might be able to help with a problem I have porting some libraries from VC6.0 to compile in VC7/Visual Studio .NET 2003.
The Author of the libraries is unable to help, and it seems that the problem is with c++ standards conformance (related to mostly templates.)
I’ve stripped down part of the code to one of the lib’s, and made a small simple example ( Win32 console test app ) below to show the problem, and the error(s) the VC7 compiler gives when trying to compile it. I’ve never been that good getting my head round and using templates, so this is turning into a major headache for me to fix.
If anyone can help, i would really appreciate it.
Thanks.
#include "stdafx.h"
#include <iostream>
using namespace std;
namespace lang
{
template <class T> class NumberReader
{
public:
NumberReader();
int put( char ch );
const T& value() const;
bool valid() const;
};
template <> class NumberReader<double>
{
public:
NumberReader()
{m_state=STATE_INIT; m_valid=false;}
int put( char ch );
T value() const;
bool valid() const{return m_valid;}
private:
enum State
{
STATE_INIT,
STATE_SIGN,
STATE_BODY,
STATE_FRACTION,
STATE_EXP,
STATE_EXP_BODY,
STATE_EXP_FRACTION,
};
bool m_valid;
State m_state;
};
}
int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}
error C2146: syntax error : missing ';' before identifier 'value'
error C2501: 'lang::NumberReader<double>::T' : missing storage-class or type specifiers
warning C4183: 'value': missing return type; assumed to be a member function returning 'int'
|
|
|
|
|
The problem is here
template <> class NumberReader<double>
and then here
T value() const;
The template doesn't know anything about T. Perhaps you left out the
template < class T > class NumberReader<double>
when you modified it?
|
|
|
|
|
cobra999 wrote:
template <> class NumberReader<double>
{
public:
NumberReader()
{m_state=STATE_INIT; m_valid=false;}
int put( char ch );
T value() const;
bool valid() const{return m_valid;}
You must replace all occurences of "T" with "double" when you are specializing the template for the type double.
|
|
|
|