|
I'm a newhand .Yesterday ,my boss let me to construct a class that can be used to print text,html and bitmap.But ,I don't know how to begin my work,so I want somebody to help me ,thanks!
|
|
|
|
|
Check the many fine articles on printing fine articles on printing here on CP. If you have a specific problem then ask here again.
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
Head over to http://www.codeproject.com/printing/[^] and read it. That'll give you a start, at least. The really hard bit will be HTML - i wish you luck with that, it could end up being quite a bit of work.
|
|
|
|
|
Does anyone know how to make a combobox sort data dynamically? Is there a CBS_SORT and if there is, how do I call it (note that I'm not creating the combobox dynamically)?
Thanks,
~ Selevercin
|
|
|
|
|
Annonomous wrote:
Is there a CBS_SORT
Yes.
Annonomous wrote:
how do I call it (note that I'm not creating the combobox dynamically)?
Properties Dialog -> Styles tab -> Sort checkbox
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
Yes, but how do you do that with code?
Thanks,
~ Selevercin
|
|
|
|
|
Anonymous wrote:
Yes, but how do you do that with code?
????
If you specify the CBS_SORT style the strings are automatically sorted when they are added with AddString() .
You said you are not creating the control dynamically, so I assumed you were using a template to create it. If you are creating the control dynamically, then you use the Create() member function, and add CBS_SORT as one of the styles in the dwStyle parameter.
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
Yes, but I need to be able to change the setting during the program. Can I add this ability in the program? I AM using the dialog control maker (not dynamic). Thanks VERY much,
~ Selevercin
|
|
|
|
|
Ok, now I get what you want
You can use the ModifyStyle() function. Just remember that some styles can not be changed after the control is created, I am not sure if CBS_SORT is one of them or not. Also, after you modify some styles you may have to call RedrawWindow() or SetWindowPos() with the SWP_FRAMECHANGED flag in order for the changes to show.
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
When the user changes the selection of a combo box, I receive the CBN_SELCHANGE notification (via the MFC callback mechanism). The problem is that the UpdateData(TRUE) with the handler sets the CString to the previous.
Who was this guy at Microsoft who might think that if a user changes the Combo box selection that I would be interested in the previous selection, not in the new?
Btw, I tried catching the CBN_EDITCHANGE , CBN_EDITUPDATE , CBN_CLOSEUP , and CBN_SELENDOK notifications. They all return the previous selection, except for CBN_EDITCHANGE and CBN_EDITUPDATE that are never called.
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
AFAIK, the window is not actually updated until the message handler returns.
Use GetCurSel() and GetLBText() to get the new selection.
|
|
|
|
|
Using UpdateData(TRUE) would have been too simple, isn't it? Btw, when do I call these functions?
What I want to do is to update another control when the user changes the selection.
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
Michel Prévost wrote:
Btw, when do I call these functions?
You should be able to call them from your CBN_CHANGE (from memory & it's early - something like that) handler. Heck, you could even put them in your DoDataExchange() method if you just want to keep using UpdateData() (make sure you only do it when going one way).
|
|
|
|
|
tx i will try those for sure
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
You need to call UpdateData(FALSE) in your handler to get the current value updated from the combo. Then you can do your other processing and call UpdateData(TRUE)
The opinions expressed in this communication do not necessarily represent those of the author (especially if you find them impolite, discourteous or inflammatory).
|
|
|
|
|
Phil, I think it is the reverse. Anyway, UpdateData(TRUE) don't get the value from the combo box.
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
I have a small class that I am working with, however when I try to compile main I get some strange errors. Any clues? Thanks
Errors
<br />
--------------------Configuration: hw3 - Win32 Debug--------------------<br />
Compiling...<br />
hw3.cpp<br />
c:\documents and settings\user\desktop\hw3\hw3.cpp(6) : error C2143: syntax error : missing ';' before 'PCH creation point'<br />
c:\documents and settings\user\desktop\hw3\hw3.cpp(6) : error C2239: unexpected token '{' following declaration of 'days_array'<br />
c:\documents and settings\user\desktop\hw3\hw3.cpp(6) : error C2513: 'int' : no variable declared before '='<br />
c:\documents and settings\user\desktop\hw3\hw3.cpp(7) : fatal error C1903: unable to recover from previous error(s); stopping compilation<br />
Error executing cl.exe.<br />
<br />
hw3.obj - 4 error(s), 0 warning(s)<br />
hw3.cpp
#include "hw3.h"
int days_array{} =
{
31, 28, 31, 30, 31, 30,
31, 31, 30, 31, 30, 31
};
int main()
{
Date today
today.set(03, 01, 1994);
for (int I = 0; I < 370; ++I)
{
today.increment();
today.display();
}
return 0;
}
hw3f.cpp
#include <iostream.h>
#include "hw3.h"
void Date::setdate(int month, int day, int year)
{
Date::month = month;
Date::day = day;
Date::year = year;
}
void Date::increment()
{
int i = day++;
if(i > days_array[month])
{
if(month == 12)
{
month = 1;
day = 1;
year++;
}
else
{
month++;
day = 1;
}
}
else
{
day = i;
}
}
void Date::display()
{
cout << month << "/" << day << "/" << year << endl;
}
hw3.h
#ifndef hw3_h
#define hw3_h
class Date
{
private:
int month;
int day;
int year;
public:
void setdate(int, int, int);
void increment();
void display();
}
#endif
Nick Parker
“Nothing is less productive than to make more efficient what should not be done at all.”
-Peter Drucker
|
|
|
|
|
in hw3.h you need a semicolon after the closing brace in your class declaration.
#ifndef hw3_h
#define hw3_h
class Date
{
private:
int month;
int day;
int year;
public:
void setdate(int, int, int);
void increment();
void display();
}<font color="red">;</font>
#endif
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
PJ Arends wrote:
in hw3.h you need a semicolon after the closing brace in your class declaration.
Thanks PJ , I completely missed that.
Nick Parker
“Nothing is less productive than to make more efficient what should not be done at all.”
-Peter Drucker
|
|
|
|
|
And one after: "Date today" in hw3.cpp
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
the 3 lasts errors come from this:
int days_array{} = {31, 28, 31, 30, 31, 30,31, 31, 30, 31, 30, 31};
I suppose, you wanted to write that:
int days_array[12] = {31, 28, 31, 30, 31, 30,31, 31, 30, 31, 30, 31};
.... I think ....
Hello World!!!
from Raphaël
|
|
|
|
|
i hope that someone can answer this question cause i spent about two hours on it last night and came no closer.. I have this sample code on socket programming, but it says that i have to link in the ws2_32.lib for support of some classes. Unfortunately i don't know how to enable this option in visual studio.net!!!! can anyone answer this. Can i compile socket programs using the visual IDE or does it have to be done with the command prompt. If so, could you help me find a tutorial that might help on using the command prompt compiler? Thanks, any help would be appreciated. I have joined this group because a lot of you seem well experienced with visual c++. i am dying to make some socket programs..
xai
xai
|
|
|
|
|
i have tried this:
in the solution explorer > right clicked on the project name > properties > expanded linker (folder) > input >
then in the additional dependencies i tried two things..
first i put the path C:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\lib .....<didn't work="">.....
then i just put C:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\lib\ws2_32.lib ....<didn't work="">....
then i just put ws2_32.lib and again. ....<didn't work="">.....
xai
|
|
|
|
|
If I have to link to an extra library, I usually use a #pragma in the .cpp file that requires it.
#pragma comment(lib, "ws2_32.lib") Or, you could use the project settings dialog
- Project menu -> Settings (or Alt-F7)
- Link tab
- Object/Library modules edit box
- Add ws2_32.lib to the end of the list
HTH
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
are you using visual Studio.net cause i am and i don't see a settings and when i press (Alt-F7), it does nothing. also when i am in the property pages dialog all i see is a bunch of folders, one of which is called linker... so i open that and i see these options..
-additional dependencies
-ignore all default libraries
-ignore specific library
-module definition file
-add module to assembly
-embed managed resource file
-force symbol references
-delay loaded dlls
i have tried putting this line in all of the above
C:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\lib
with no luck!
am i in the right dialog... is that right way to do it??
also when i used that #pragma, it didn't help i am still receiving this error.
Fatal Error C1010 unexpected end of file while looking for precompiled header directive
<snippet>
#include <winsock2.h>
#include <stdio.h>
#pragma comment(lib, "ws2_32.lib")
void main(int argc, char **argv)
{
WSADATA wsaData;
SOCKET s;
SOCKADDR_IN ServerAddr;
int Port = 5150;
int Ret;
xai
|
|
|
|
|