|
if you have a function like:
void foo(LPCSTR s)
{
}
unlike
void foo(LPSTR s)
{
}
In the first function the caller knows that you dont change the value of the pointer within the function, in the second function you never know, unless you have the source for the function...
Also if you do embedded programming a const value can stay in ROM where a non-const value have to be moved to RAM.
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Cool,
Thanks for the explaination, funny I have gone all this time without knowing that.
I had a look at CESoftware.dk, you seem to devote most of your CE Programming Skill to developing games. I do alot embedded development myself (I am the King of Unaligned Data Access Exceptions) and I spend most of my time developing Form to Database applications.
I have often felt what CE and other Mobile Platforms lack is a Interface to Database Scripting Language. Something really high level (even higher than embedded VB and faster). That would parse a script from which it would generate a user interface and read/write a datasource. A rough idea only ...
For Example it could look something like this:
FORM FORM1(0,0,240,160, \\Storage Card\\DataSource.cdb)
TREEVIEW TREEVIEW1(10,10, 200, 150, SELECT * FROM CUSTOMERS)
BUTTON BUTTON1(210, 130, 230, 150, "Ok")
FORM_INITALISE
END FORM_INITALISE
FORM_ONBUTTON1CLICK
SQL DELETE * FROM CUSTOMERS
CLOSE FORM1
END ONBUTTON1CLICK
END FORM
Regards
Ray
"Je Suis Mort De Rire"
|
|
|
|
|
The database_interface_thing you describe would be a cool application IMHO.
I just think it would take a lot of time to develop.
Do you think people would by it?
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
It would be a great RAD tool, not very useful perhaps for serious development but if you needs a small app or a demo app it would be excellant. I estimate development time for this at about 4 months.
Petty my time is booked up for this forseeable future
Regards
Ray
"Je Suis Mort De Rire"
|
|
|
|
|
First of all, apologises for my english.
An important point in declaring a const data type is that its placed in the .rdata section (for only reading data) wich is much better than using an object because it'd be stored in .bss section, in the swapping file (at least partially). This is true for integral data types and structures declared as const data types.
So if you think you'll need a value that will remain unchanged it's more efficient to use a const data type.
That's all!
|
|
|
|
|
Hello,
We have a problem with Windows 2000 Professional and Visual Studio 6
Enterprise Edition since we had installed the Windows 2000 Service Pack
2.
The main problem is that the system is rebooted a lot of times while
we are compiling and linking our code; when this happens, some of the
code files are modified with binary data or HTML data, and this causes
the lost of work ...
We tested that this happens with spanish and english versions.
How can we solve this problem? Is there any patch to solve this?
Thanks in advance,
Fernando.
P.S.: Could you answer to my e-mail account? Thanks.
|
|
|
|
|
Does anyone know how to use the paragraph style PFA_JUSTIFY in RichEdit 2 or 3 ?
Further more I would like to know, if it is possible (and how it works)to insert Soft - Line - Breaks and Page - Breaks.
I tried to stream in the RTF Tags but they are not accepted.
|
|
|
|
|
Has anyone out there used Billg's #pragma warning switch in a **large** VC++ project? We're gradually replacing MFC data structures with STL ones in an existing MFC-based project and like (I presume) everyone else we want to suppress the compiler warnings generated by the STL headers (especially the infamous 4786).
Sticking in some #pragmas would seem to be the way to go (as the samples in the MSDN do) but whereever I put them I find that some of the "disabled" warnings are still generated. Perhaps this indicates a problem with my understanding of how C++ source code is compiled.
I would have thought that each individual #pragma switch would apply to the translation unit(s) in which it appears. That is, if we have the appropriate #pragma switch at the top of "fred.cpp", the warning(s) would be disabled during the compilation of that unit, including during the compilation of all #include-d headers and the expansion of templates required by the unit. Also if we put the #pragma switch in "fred.h" and #include-d that in "barney.cpp" as well, the #pragma would be in effect during the compilation of both fred.cpp and barney.cpp.
At this stage I have two questions: 1) Is the above paragraph correct and 2) if so, does MSVC++ actually do it properly? If the answer to both questions is "yes" I'll know to go back and look more closely at why this is not happening in our project.
Tony
|
|
|
|
|
I would have thought that each individual #pragma switch would apply to the translation unit(s) in which it appears.
False. The compiler would have to perform additional pass just to find #pragma.
#pragma warning should appear before code that causes warnings. If you're #including STL headers in stdafx.h, put the #pragma at the top.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
You could also push the warning level to 2 before including the STL headers, then pop it back again after the includes...
#pragma push and pop
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
How I can get m_viewList from MainFrame window class.
I call GetFirstView(). But it genaret error.
Please Help me.
|
|
|
|
|
GetActiveFrame ->GetDocument -> GetFirstViePos GetNextView
|
|
|
|
|
A Question About Asynchronous Property
I use a asynchronous property in my ActiveX control to implement the background of my control.
In the "OnDraw" function, I use the following tactic:
if(GetReadyState()==READYSTATE_COMPLETE)
{
//draw with the background picture
... ...
}
else
{
//draw without the background pictrue
... ...
}
In the "OnDataAvailable" function:
I check the status. If the status is "BSCF_LASTDATANOTIFICATION", I will set the status of the control to "READYSTATE_COMPLETE" and force the control to redraw itself(invalidaing the control).
In the "Set" function of the property:
I just use the function "SetModifiedFlag".
My Question is:
If I changed the value of the asynchronous property, can the background of the picture redraw automatically? Shall I add a statement to reset the status in the "Set" funtion of the property?
Thanks.
Maer.
|
|
|
|
|
Hi there,
I have a dialog box class that is suppose to show various kinds of messages. The reason I don't want to use MessageBox is because I like to have a more colorful message box.
I was wondering how I can adjust my dialog box to handle varying sizes of strigs?
|
|
|
|
|
Look at TcxMessageBox on this site.
|
|
|
|
|
Look at TcxMessageBox on this site.
|
|
|
|
|
Hello,
How can I catch CTRL key combinations in a CEditView? I want to catch CTRL-0 through CTRL-9. Thanks!
Joseph LeBlanc
unixd0od@hotmail.com
|
|
|
|
|
|
I have created a modaless dialog box, that needs to retain the focus, ie I don't want people to be able to click on the main frame, while this dialog box is up. I can't seem to find the style marker or whatever needs to be set to do this.
|
|
|
|
|
A modal dialog box won't suffice. I need the rest of my application to continue running, where-as a modal dialog box suspends the rest application until that dialog box is closed.
|
|
|
|
|
I would do this by checking the variable that holds the modeless dialog when my main app recieved focus, and if it was non-NULL ( the dialog existed ), set the focus back to the dialog.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
I just attempted to over-ride the WM_SETFOCUS message for my CMainFrame class. When I received it, I checked a boolean variable I created to determine whether the dialog was still "alive" and if it was, I called the ::SetFocus() function to give the focus back to that dialog. This created a bad flickering. Each time I tried to revert the focus back, the program then tried to give the focus back to the main frame (i'm not sure why), and thus I had an endless loop. I also tried to over-ride the WM_LBUTTONUP message, but for some reason I could never get into that function.
Any more help would be great.
- John
|
|
|
|
|
Hmmm... Here's a thought. When you create the dialog, call SetCapture() so that your dialog recieves all mouse messages first, and then you can catch and kill anything that occurs outside your dialog. That's better - the solution is contained in the dialog where it should be.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Ok. Here's the trouble with that. It does capture all the mouse input, but the dialog does not respond to it. No matter where I click or what I try to drag, nothing happens. If I click outside the main frame, then whatever app that was in the back ground get the focus, which is fine. However, when I bring my app back up, I can click on the main frame and such all over again, and SetCapture has been invalidated or something.
|
|
|
|
|
I remember having trouble like that. I did a colour picker dialog and made it so you could click anywhere on the screen to select colours. I'm loading the code right now to see what I did.
I set a timer in OnInit to go off twice a second and then do this:
if(nIDEvent == 42)
{
CPoint pt;
GetCursorPos(&pt);
CRect rc;
GetWindowRect(&rc);
if (!rc.PtInRect(pt))
SetCapture();
}
CDialog::OnTimer(nIDEvent);
In MouseMove I do this:
CPoint pt;
GetCursorPos(&pt);
CRect rc;
GetWindowRect(&rc);
if (rc.PtInRect(pt))
ReleaseCapture();
Essentially I found I had to release capture every time the mouse was in the dialog, and set it before it left, releasing it when people click.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|