|
i understand and apreciate it. Thank you.
|
|
|
|
|
Bit flags are widely used for performance reasons, not for style reasons. In a pure OOP, you're right. And maybe, using inline functions we could accomplish the same thing.
But, as I've said, programmers are so accostumed to do things this way, that they won't change so soon.
The other reason to do this is that it's much easier to change this flags using a single window message (WM_*) than to do it dispatching a ton of messages.
In some API calls this is also used to reduce the number of parameters. Ok, this could also be done with unions and bitfields but, it's so easy to do a ACCESS_READ | ACCESS_WRITE when calling a function, that's still done this way.
lazy isn't my middle name.. its my first.. people just keep calling me Mel cause that's what they put on my drivers license. - Mel Feik
|
|
|
|
|
Thank you. So, since there are many issues i have to cover, i'd better stick to conventional ways instead of playing around to find something more comfortable. It probably will wind up causing problems or need to write to more code.
Thanks again.
|
|
|
|
|
Internet Explorer allows me to scroll using middle button of my mouse. How can I do the same for a list control ?
Orcun Colak
|
|
|
|
|
handle the WM_MOUSEWHEEL message?
|
|
|
|
|
I have a functionality in a trackpopupmenu (right context menu). I want to put this into my main menu as well. When the context menu item runs, it triggers a function: OnCustomContextEdit(). How can I make the same function run if I click on my new menu item? Or do I have to make a new OnStandardMenuEdit(), and cut and paste the code?
Thanks,
Appreciate your help,
ns
|
|
|
|
|
Set the menu item resource ID to the same value.
|
|
|
|
|
Thanks!
Appreciate your help,
ns
|
|
|
|
|
Worked great! It took care of the OnUpdate function as well.....is that expected? So basically it ran both OnEdit and OnUpdateEdit().....
Appreciate your help,
ns
|
|
|
|
|
If your speaking of the ON_UPDATE_COMMAND_UI() message. Yes, thats expected. That is expected of any message you handle. If two controls have the same ID, it will handle them with the same function.
|
|
|
|
|
Thats the function I was talking about. Thanks. The changes took no time and were painless with your idea!
Appreciate your help,
ns
|
|
|
|
|
I've been referring to the article here on win32 serial comms. Im building a link to perform just one character(1 byte) transmission/reception via the serial port. I managed to get the send(WriteFile) working, but the receiver just doesnt seem to work, nor does it give an error. This is the code im using for the receive character function.
void CBuggyControllerDlg::OnRec() <br />
{<br />
<br />
UpdateData(TRUE);<br />
if((ReadFile(handlePort_,&recd,1,&length,NULL))==0)<br />
{AfxMessageBox("No Data on Input Serial Buffer");}<br />
else{<br />
m_strlistupdate=recd;<br />
m_list.InsertString (0, _T(m_strlistupdate));}<br />
<br />
}
The function is called only after a byte has been sent and hence no monitoring of the port is necessary, although i imagine a loop would be needed. When i send a byte to this programs serial port, and then click recieve{OnRec() }, it doesnt give an error, nor does it display the right character. Could somebody please help me? I have set all the dcb config, including the one for flow control. Send Data works perfectly.
|
|
|
|
|
On second thought, it might be working except for the fact that i might be messing up my strings. The buffer for readfile/writefile needs to be a void* hence i declared recd as BYTE recd; . Now how does one make the character thats been stored in recd , into a string, or make m_strlistupdate take the value of recd ?
The serial readfile could probably be wrong, but i just noticed this. Please let me know if you find errors in the code.
Thanks!
|
|
|
|
|
Anyone know any tricks for displaying a context menu when the left mouse button clicks the status bar?
|
|
|
|
|
You could subclass from CStatusBar and handle WM_LBUTTONDOWN and WM_LBUTTONUP .
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Yeah, I was trying to stay away from that.. I was hopeing to catch a message inside main frame.. I may just create a CStatusBar Class.. It would probably be easier.
Thanks!
|
|
|
|
|
I have a 2d array that I'd like to display in a colored grid. The colors on the grid would be based on the contents of the array. There would be 1 grid square for each point in the array.
Example:
I have int grid_data[ 3 ][ 3 ], I'd want to display a grid like
. . . .
. . . .
. . . .
. . . .
And would like to be able to change the colors of each point easily.
What's the best way to do this?
Thanks
|
|
|
|
|
The easiest way is to use a grid control like MSFlexGrid.
Thanks for the help,
Bill
|
|
|
|
|
I know this is a lot to ask from strangers but any help would be appreciated. I am currently trying to recreate or modify the program here (this is the source <http://www.installsite.org/files/HTMLautoplaySrc.zip>). It is an executable that is used for launching a html page on a CD automatically (autorun). It reads options from an ini/inf file and opens the htm in a html control. I have at this point managed to recreate the application to about 95% completeness, but I found that mine has the same problem as the original. My htm page that is displayed contains a Flash file (swf) that has buttons with links to other htm/swf pages that are local (on the CD). If you launch one of these pages and it opens over the original window AND you close the new window BEFORE it finishes loading, the original page does not repaint. In other words it just shows white where the window was open over it. This also happens sometimes if you minimize the window then restore it again. If you let the new window load entirely everything works fine most of the time. I need to get this fixed. I am at an intermediate level (mostly self taught) of C++.
Thanks,
Steve
PS. I am willing to supply sample documents if you think it is the htm/swf causing the problem instead of the html control.
|
|
|
|
|
<br />
CString m_n, m_e, n_str, e_str; <br />
int n_strlen, e_strlen;<br />
UINT k_keyID;<br />
<br />
m_Proc.GetInfo(FileName, n_str, e_str, n_strlen, e_strlen, k_keyID);<br />
<br />
m_n = n_str;<br />
m_e = e_str;<br />
These above is somepart of my code. m_Proc is object and call function GetInfo which have 5 function parameters (FileName, n_str, e_str, n_strlen, e_strlen, k_keyID)
These below is detail of GetInfo function
<br />
void CExtract::GetInfo(const CString& m_FileName, CString n_str, CString e_str, int n_strlen, int e_strlen, UINT keyID)<br />
{<br />
n_str ="1234";<br />
e_str = "578756";<br />
n_strlen = 4;<br />
e_strlen = 6;<br />
keyID = 48756;<br />
}<br />
but when I see n_str value after exit GetInfo function. I see n_str = {""}
e_str = {""}
I expect n_str = {"1234"} , e_str = {"578756"}
Do you know how to solve my problem?
Thank you for your answer.
|
|
|
|
|
You're passing in parameters by value, which means you can alter them locally (in your function) but they won't be written to. You can use CString& (CString references), and int pointers, so you'd modify your program accordingly:
void CExtract::GetInfo(const CString& m_FileName, CString& n_str, CString& e_str, int* n_strlen, int* e_strlen, UINT* keyID)
{
n_str ="1234";
e_str = "578756";
*n_strlen = 4;
*e_strlen = 6;
*keyID = 48756;
}
m_Proc.GetInfo(FileName, n_str, e_str, &n_strlen, &e_strlen, &k_keyID);
You should probably do checks to make sure no NULL pointers are getting passed in, or just create an info class or structure to use, and pass that back and forth.
|
|
|
|
|
Hi
I know how to save strings to a file using MFC and without MFC (file streams).
But i would like to know how i can save integers and floats and BYTEs and other things like that. I mean,.. i just used to convert them to a string and save them that way but that actually takes up more space in the end so it seems. So how do i save them binary? like... an integer is 4 bytes right? how do i save it to a file so it only takes up 4 bytes? Same for a float..
Thank you.
Kuniva
--------------------------------------------
|
|
|
|
|
3 suggestions: serialize, serialize, serialize. See this[^] article.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Thanks!!!
Great article btw
Kuniva
--------------------------------------------
|
|
|
|
|
It's only a sample...
typedef struct
{
DWORD Version;
DWORD QueryPosition;
DWORD GridPosition;
DWORD ChartPosition;
DWORD NotePosition;
BOOL IsStatic;
}HEADER;
HEADER header;
header.Version = (DWORD)1.0;
header.QueryPosition = 1230;
header.GridPosition = 0;
header.ChartPosition = 0;
header.IsStatic = TRUE;
pFile.Open(strFileName, CFile::typeBinary | CFile::modeCreate | CFile::modeWrite);
pFile.Write(&header, sizeof(HEADER));
Regards
Carlos Antollini.
Pi Five[^]Creator
Sonork ID 100.10529 cantollini
|
|
|
|