|
I have a program in which items are added to a listcontrol box. I run the program once, add some items to the list and then exit from the program. The requirement is that, when i run the program again, the listbox should show the items i added in the previous run. What should i do???
God is Merciful...
|
|
|
|
|
|
Shudder.
I don't know what the standard practice is, but the thought of every program using the registry to store "junk" scares me. No wonder my registry is so full of junk.
Are there any quidelines which say what a program should store in registry, and what should be stored in a data file?
|
|
|
|
|
NormanS wrote: but the thought of every program using the registry to store "junk" scares me
Nice to hear that.
NormanS wrote: Are there any quidelines which say what a program should store in registry, and what should be stored in a data file?
There are no guidelines as such. But normally applications store their settings inside the registry (could be because it's easy to store and retrieve). Or else you've got to store it somewhere. Create your own dat file or opt file or just write these values inside a collection and serialize them (this is what I do).
Jesus Loves <marquee direction="up" height="40" scrolldelay="1" step="1" scrollamount="1" style="background:#aabbcc;border-bottom:thin solid 1px #6699cc">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
A DAT file sounds better to me. Less stuff in registry!
The original poster will have to balance the amount of stuff which needs to be stored with the convenience of using registry.
|
|
|
|
|
What's wrong with good old .INI files?
Steve
|
|
|
|
|
|
when you use CColorDialog dlg ; how do you get the rgb value of the color you picked?
|
|
|
|
|
|
locoone wrote: how do you get the rgb value of the color you picked
To get RGB value what Gavin said is fine.
To get values of Red , Green , and Blue from a COLORREF you have to use:
BYTE nRed = GetRValue(clrRef);
BYTE nGreen = GetGValue(clrRef);
BYTE nBlue = GetBValue(clrRef);
For more details on how this works take a look in MSDN.
Jesus Loves <marquee direction="up" height="40" scrolldelay="1" step="1" scrollamount="1" style="background:#aabbcc;border-bottom:thin solid 1px #6699cc">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
I was going to leave that bit as an learning excerse for the guy...
Now they'll have to put off learning to read the MFC documentation for another day...
Gavin Taylor
w: http://www.gavspace.com
|
|
|
|
|
|
|
We've all seem examples of simple web servers that use Winsock. When you're running one of these you can browse to an address like "http://127.0.0.1/" and, say, browse the contents of a folder as if it was a website - And it works in IE and Firefox and other browsers. If you're on a network other machines can access it using your IP address. Is it possible to create the sockets in such a way that it is only accessible from the local machine?
Steve
|
|
|
|
|
You could either filter out incoming requests using a firewall or better yet when you create the listening socket only bind[^] it to the IP "127.0.0.1" that way it's only ever visible to the localhost.
Gavin Taylor
w: http://www.gavspace.com
-- modified at 22:28 Monday 23rd January, 2006
|
|
|
|
|
Ta,
Thanks for your help. I'll give it a burl.
Steve
|
|
|
|
|
Greetings,
I am using Visual C++ .NET 2003.
How do I add event handlers for a custom toolbar that I created? In my SDI app, I created, attached to the the main frame, but I can't find a way to create event or message handlers for the buttons. It's just sitting there...any help you can provide would be great.
Finally, last question: I know that you have to tell Visual C++ .NET if you want a class to be serializable. My question is, supposed the class contains other class objects as variable (i.e. a CAutomobile class has a member variable of type CEngineType), do I have to also tell Visual C++ that I also need to serialize the member object class (i.e. CEngineType) of the already serializable overall class (i.e. CAutomobile). Also, how does it work for derived classes?
Thanks for all of your help.
|
|
|
|
|
BlitzPackage wrote: custom toolbar that I created
How did you create this custom toolbar . Is it inherited from CToolBar ?
Jesus Loves <marquee direction="up" height="40" scrolldelay="1" step="1" scrollamount="1" style="background:#aabbcc;border-bottom:thin solid 1px #6699cc">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
Yes, it is inherited from CToolBar. (I decided to use that instead of CToolBar Ctrl.)
|
|
|
|
|
|
Thanks again for replying.
Can you show me what you mean? Are you talking about a message map?
|
|
|
|
|
|
Hi
Will like to ask if anyone has ever try opening a comport with baudrate other than those even in Microsoft APIs? like BaudRate of 141250 etc?
I have a device that will work best with this baudrate but could not set the comport baudrate to this value for communication?
|
|
|
|
|
The Windows API supports any baud rate, but the driver and COM port usually only support a standard set of baud rates (integer factors of 115200; a legacy hardware limitation). If your COM port and driver supports other baud rates, then Windows won't stop you using them.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
As Ryan says, the standard PC hardware supports a maximum of 115200 bit per second, as well as half that (57600), one quarter (28800), 14400, 9600, 4800, etc. Thus 141250 is not available with standard hardware.
I made an interface a few years ago which used two Intersil 6502 UARTS, with different crystal oscillators for each and a little bit of glue logic components - receiving on one UART triggered transmission on the other, so this converted between different baud rates. No buffering or anything, so you had to "go slow".
Try posting on the hardware forum - maybe some of the USB-to-serial adapters allow strange rates like you need.
|
|
|
|