|
It's me again.
I'm still fighting with tabs.
I have 7 tabs with spins on them, and one Dialog.
I use Propertypage, and use the instruction "AddPage" to make the 7 tabs on the dialog.
Now I want to store the spin value in a flie when the user click and change the spin value.
(or maybe in 7 different file, for one tab own one file belong to itself)
Then, I have to communicate with a controller throu RS-232 under modbus portocol.
Because I'm slave on modbus, I only can send data out when the controller send out query message. So I planning to store the spin value in files, then waiting untill the query message, then I send the data I stored in the file.
I would like to ask how to deal with the file pointer.
I use the code:
in my base dialog' cpp:
<br />
FILE *filedlg;<br />
filelog = fopen( "file_page1.txt", "r+" )<br />
What code about pointer assignment I suppose to write in tab page1' cpp or h file to complete the rest? I mean page1 doesn't know the exitance of file pointer filedlg.
I'm new about pointer and MFC, and would be many appriciate about your help.
chauteen
|
|
|
|
|
Dear fellow Programmers,
I am currently facing a situation which I can not figure out how to do it.
I have a property sheet with 5 property pages. When the user press the IDOK button, I want to ensure that all Property pages has been visited by the user, all data on those pages has been entered properly and validated.
How can I do that? So far, I override the OnOK in each page, that function is only processing that particular page and exit directly.
Does anybody has any clue on how to solve this problem ? Please inform me and thank you beforehand.
|
|
|
|
|
Why not set it up as a Wizard instead of tab pages with a Next and Prev button. Enable Next when data validation determines everything has been done on the page and when the user gets to the end have a Finish button.
This is IMHO a better way to go if the user must visit all of the pages.
If you want to do it as tabs have a pointer to the property sheet in all the tabs and have a validation routine in the sheet itself. Each routine could then call
if (sheet->IsOK())
EnableWindow(IDOK);
and after each sheet is fully validated call
sheet->Valid(page_x);
Just some quick thoughts.
Dave
|
|
|
|
|
Thanks Dave,
I think I will try to change to the Wizard Mode and let the users look into it.
If they are not satisfied with it, I will change to the second alternative that you suggested.
Again, thanks for your fruitful information.
Alvin.
|
|
|
|
|
Your welcome.
If the users have to touch on all of the pages the wizard will be much easier for them. There is nothing like flailing around trying to figure out why the damned OK button won't enable!
Something to keep in mind. Will the wizard process be repeated often? Will it be basically the same values each time? If it is you either want to save the last values and restore them into the wizard each time it runs or allow the user to store them to a file that can be reloaded from the first or second page to refill all the values. This way the user can just hit Next,Next,Next to quickly repeat. I do this in one of my products where all of the files in each project usually have one format but each project will have unique settings for the files. It works quite well.
Good luck.
Dave
|
|
|
|
|
I am writing a activex control(MFC based) which will be embedded into an IE html page.I want to disable the IE menu(File->new),how can i do it?
please contact:
max_xiayi@hotmail.com
|
|
|
|
|
Hello CPians,
Anyone here ever tried loading a font from a font file(*.ttf)?
I need to theme my gui by using a user-created font. But I'm afraid once I send the app out, the user's pc will replace the font with the default font.
Thank you very much in advance.
|
|
|
|
|
What about installing the font as part of the application installation?
Watch out! I'm a CPian on the edge!
I have a new Gold rating and I'm not afraid to use it! -pete
|
|
|
|
|
"What about installing the font as part of the application installation?"
There's an idea.
But I just started using Visual C++ three months ago.
There are some things I still need to learn, like using the installshield.
I think i need to use installshield to do what you said.
Thanks a heap.
|
|
|
|
|
if you really want to do it that way, you'll need to use CreateScalableFontResource and AddFontResource. i'd just install the font as part of the app install - much easier.
Software | Cleek
|
|
|
|
|
Thanks very much.
I'll try to use these functions. Meanwhile, I am studying how to install a font, as generally suggested.
|
|
|
|
|
How do I access an URL from within the VB or VC++ code.
my requirement is, I need to create a DLL which accesses an URL, and parses the XML returned(the url I'm accessing returns XML, not HTML).How can I do that in VC++/VB?
Also, are there any classes in VC++/VB for parsing XML returned.
Any sample code would be appreciated.
Everything needs to be non .NET.
jmc
|
|
|
|
|
there are a whole bunch of xml classes here on cp that u can plug into your code and leverage to do what u want ... have a look in the relevant sections
"there is no spoon" biz stuff about me
|
|
|
|
|
One of the easiest ways to access web resources is using the MFC WinInet wrapper classes. Take a look at CInternetConnection and related classes. If that does not appeal to you can use the WinInet API directly or even the Winsock2 API to retrieve the web resource.
XML parsers are abundant. To see a large if not complete list of them go to xml.com. Perhaps the most prevalently used parser in Win32 from C++ is the Microsoft MSXML ActiveX control. I have been using it for around 4 years in C++ development. If you are familiar with ATL and _com_ptr_t class using MSXML with the #import directive is a snap.
Watch out! I'm a CPian on the edge!
I have a new Gold rating and I'm not afraid to use it! -pete
|
|
|
|
|
|
I have a peculiar question to ask you gurus...
Being the person I am who pays attention to minor details, I was wondering if you could explain me in as much detail as you can why is it that MFC and some Win32 interface methods instead of using the standard C++ bool data-type, use BOOL (which maps to the plain old int ) ?
Any insights you could provide would be much apreciated.
Thank you so much,
David Nimrod
|
|
|
|
|
BOOL is a type defined by the Windows headers. Since MFC and Win32 were around before bool existed in C++, they use BOOL . (Actually Win32 uses BOOL to maintain C compatibility.)
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
"Kosh reminded me of some of the prima-donna programmers I've worked with. Knew everything but when you asked them a question; never gave you a straight answer."
-- Michael P. Butler in the Lounge
|
|
|
|
|
Michael Dunn wrote:
(Actually Win32 uses BOOL to maintain C compatibility.)
All your BOOL are all belong to C
Watch out! I'm a CPian on the edge!
I have a new Gold rating and I'm not afraid to use it! -pete
|
|
|
|
|
Yeah I was told about that before. Only thing I wonder, though, is that why they used an int not an BYTE , to represent such a type that merely needs to maintain "yes or no", but then I guess we've all used to that already.
|
|
|
|
|
It probably stems back to the days when we had 8-bit integers.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Why use a BYTE instead of an int? It has all the same problems.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Depending on your CPU, access to anything of less than an int may be very slow. Alpha for instance (which windows NT ran on) didn't give you easy access to a single byte, it could be done, but the code was fairly high.
|
|
|
|
|
This is going to sound like a strange question, but I'm wondering if there is any way to statically link an activex control into an app. Basically, I would like my app to use one particular version of an ActiveX control, and one version only. If a subsequent installation installs a newer version of said control and registers it into a different location, I would like for my app to continue using the one it knows about. I want to do this to reduce the dependencies between different apps that use the same control.
Is this possible? Basically, what I'm looking for is a way to bypass CWnd::CreateControl, and get a CWnd* for an activeX control that's linked into the project. Or, alternatively, call LoadLibrary with a particular path, and get the CWnd* for th control that way. I'm thinking maybe LoadLibrary, DllGetClassFactory and some other magic might make this possible. How does CWnd::CreateControl manage to do it? I would think it basicaly looks in the registry for the location of the control, calls LoadLibrary, then DlGetClassFactory, creates an instance of the object given the control's CSLID, and then . . . . what?
|
|
|
|
|
Hi there,
I have a CScrollView containing a large document. When I scroll horizontally and get to a horizontal scroll position of around 32760 pixels the scroll snaps back to the zero horizontal position. This only happens if I scroll by dragging the scrollbar itself. If I click on the little arrow at the end of the scrollbar there is no problem and it can scroll horizontally beyond 32760 pixels.
Does anybody know what could be causing this behaviour? My scrollview class does not override any of the basic scrolling functions so I feel confident it's not a bug that I've programmed in myself.
Thanks for your help!
mick
|
|
|
|
|
Hello again,
I just tested this by building a new mdi application in visual studio.net, using cscrollview as the base view class. The only change I made after the initial files were created by the ide was to set the horizontal scroll width to 35000 pixels in the view's "oninitialupdate" function. True enough, when you scroll towards the end of the view past around 32000 pixels, it hops straight back to zero!
I'd be really grateful if anybody could suggest a way of overcoming this limitation.
Regards,
Mick
|
|
|
|