|
Hello,
I have a CString in a CDialog and I want to print it in a Network printer.
I have been taking a look of the diffrent methods to do it but in all of them I have find problems,
For example:
1.-
filebuf fb( "prn:" );
filebuf fb( "prn:" );
cout = &fb;
cout << "testing";
Can only print to local printer.
2.- CView::OnPrint
I can't use it because I am using CDialog not Cview, CFormView.....
Fixing:
Does any way to print a CString using CPrintDialog?
Thanks in advance,
Best regards
|
|
|
|
|
QPrint may be what you are looking for.
Best wishes,
Hans
|
|
|
|
|
|
Thank you this is what I was looking for,
It is really easy to use.
Regards
|
|
|
|
|
Hi
When an project is created in VC6.0. It can be opened in VC.Net.
But if i create an project in VC.Net, can I open it in VC6.0.
Could i know in which file the version is serialized.
VIBIN
"Fool's run away,where angle's fear to tread"
|
|
|
|
|
Hi
U can not open project in VC++ 6.0 which is develop in VC.Net. Because it is advance version so all vc.net features are not in VC++ 6.0.
atul
|
|
|
|
|
vibindia wrote: But if i create an project in VC.Net, can I open it in VC6.0.
No, but tools do exist to convert from VS2005 back to VS6.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
vibindia wrote: But if i create an project in VC.Net, can I open it in VC6.0.
NO, but you can achieve that manually by adding blank solution and project and copying files and setting into them
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
please i was confused a little
i have array of unsigned char where if i print its value by
printf("%2X",stemp);
the value is hexadecimal and it is the desired answer
now i want to write this value into file with its hexa format
how is that possible
please urgently help me
emma
|
|
|
|
|
You can use sprintf to change the hexadecimal value into a string format and then write it to a file just like any other string. There could be some other way too, but this is what struck me at this moment.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
i think sprintf will convert it, others these might be of use to you
just dug them out.
void CharStr2HexStr(unsigned char const* pucCharStr, char* pszHexStr, int nSize)
{
char szHex[3];
pszHexStr[0] = 0;
for(int i=0; i<nSize; i++)
{
Char2Hex(pucCharStr[i], szHex);
strcat(pszHexStr, szHex);
}
}
//unsigned char to str of len 2
void Char2Hex(unsigned char uch, char* szHex)
{
unsigned char byte[2];
byte[0] = uch/16;
byte[1] = uch%16;
for(int i=0; i<2; i++)
{
if(byte[i] >= 0 && byte[i] <= 9)
szHex[i] = '0' + byte[i];
else
szHex[i] = 'A' + byte[i] - 10;
}
szHex[2] = 0;
}
reverse the process
void HexStr2CharStr(char const* pszHexStr, unsigned char* pucCharStr, int nSize)
{
unsigned char uch;
for(int i=0; i < nSize; i++)
{
Hex2Char(pszHexStr+2*i, uch);
pucCharStr[i] = uch;
}
}
//convert str of len 2 to unsigned char
void Hex2Char(char const* szHex, unsigned char& uch)
{
uch = 0;
for(int i=0; i<2; i++)
{
if(*(szHex + i) >='0' && *(szHex + i) <= '9')
uch = (uch << 4) + (*(szHex + i) - '0');
else if(*(szHex + i) >='A' && *(szHex + i) <= 'F')
uch = (uch << 4) + (*(szHex + i) - 'A' + 10);
else
break;
}
}
-- modified at 4:50 Wednesday 9th May, 2007
had some format problems
|
|
|
|
|
Hi,
If you want to write it in a Text-File then you can use the answer above or another option.
CString szHex = "";
szHex.Format (_T("%x"), yourVariable); //With little Hexadecimal letters
szHex.Format (_T("%X"), yourVariable); //With capital hexadecimal letters
and then send it to the file as all other strings.
If you want to write it in a Binary-File, I used this in my project.
This from my view:
CFile f (pcFileName, CFile::modeCreate | CFile::modeWrite);
obj.WriteHeader (&f);
dwActualPos = f.SeekToEnd ();
This from the CObject-derived where WriteHeader is:
void obj::WriteHeader (CFile* file)
{ Header[0] = 0x23957112
Header[1] = 0x00001011;
Header[2] = CalculateCodeLarge ();
Header[3] = CalculateDataLarge ();
Header[4] = CalculateNumberOfElements ();
Header[5] = 0x00000000;
Header[6] = (DWORD) GetInputsCount ();
Header[7] = (DWORD) GetOutputsCount ();
Header[8] = 0x00010000;
DWORD* pHeadBuf;
pHeadBuf = &Header[0];
file->Write (pHeadBuf, sizeof (Header));
return;
}
So you can send the hex directly.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
FILE* vl_fp=fopen("Data.txt","w")
fprintf(vl_fp,"%2X",stemp);
fclose(vl_fp)
|
|
|
|
|
Hi
I want to drag a image on dialog box at run time how it is posible
hay
|
|
|
|
|
Set the Accept File property of the dialog to TRUE and then do the rest of the handling
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Can you send me the source code that drag Image(bmp or any one )by mouse
pointer on dialog box at run time
RajeshGupta
|
|
|
|
|
There are always lots of articles available here on CP. So why not search here. A quick search took me to this location[^]. See if it helps you in your cause. :->
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Hi
that project is not downloading can you send me you email for further discussion in detail . because I am new in vc++. I need urgent code snipped requirment I will send you in email with picture.
RajeshGupta
|
|
|
|
|
_AnShUmAn_ is replying in the context of file drag-and-drop. Is that what you need to do
or do you need to drag a bitmap that is drawn in the window/dialog?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I still could not find my answer . I need drag a image (bitmap or any image)on the dialogbox so that every time i drag I find it top and letf coordinated in the textbox .
RajeshGupta
|
|
|
|
|
I still don't quite understand what you need - You want to be able to drag an image around on the
dialog but it should go to the top/left?
Do you have the dialog with an image already? If so, are you drawing the image or using a
control to draw the image? This info will help me hopefully provide some help
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi,
that is what I exactly need
when dialogbox appears .then I want load image from file(.bmp,.jpeg ect)
on the dialog box area . default its left top will be (0,0) at starting.
now I want to drag it by mouse so that its position change and also
I want to appear its changing top left coordinates in Textbox.
I need its code urgent . please help me . i am searching lot but could
not get result. if you forward me mail it will be great helpfull
RajeshGupta
|
|
|
|
|
You can break this down into easier steps...
1) Load the bitmap
2) Sometime in or after the WM_INITDIALOG message is received in the dialog, calculate the rect
the image will be initially drawn at (relative to the client area of the window).
3) If you just want to draw the image on the face of the dialog, add a WM_PAINT handler to the
dialog which draws the image at the image rect position
That'sll get your image drawn in one place on the dialog. Now you want to be able to drag it...
1) Add handlers for the WM_LBUTTONDOWN, WM_MOUSEMOVE, and WM_LBUTTONUP messages.
2) When you receive a WM_LBUTTONDOWN, check if the cursor is within the image rect.
If it is, store the current cursor position and call SetCapture() to capture the mouse to your
window.
3) When you receive WM_MOUSEMOVE, call GetCapture() to see if you are in a drag (if the mouse is
captured to your window). If yes, compare the cursor position with the position saved in step 2.
If it has changed, then the position difference is how far you need to offset the image rect.
Erase the previous image, offset the image rect, and redraw the image at the new rect.
4) When you receive WM_LBUTTONUP, call ReleaseCapture().
Here's sample code: Using Mouse Input[^]
If you have a more specific problem with any of the steps outlined above then just ask
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
|
hi all
i build an application in vc++ MFC
i add a button on dialog box and write upload
now i want that when i click on this button i get
a list of drives in the system to upload a file
can i get help regarding this
thanks alot
hi
|
|
|
|