|
Also, if mapping to the system palette doesn't give you the quality you want then try a halftone
palette. Even better, there's the Gervautz-Purgathofer octree color quanitization algorithm.
Check out this MSJ article: Wicked Code [^]
|
|
|
|
|
Hi!
I would like to know whether the value of dmPaperSize in DEVMODE structure for custom papersize varies with the printer used. How is it possible to know the dmPaperSize for custom paper size for a particular printer.
Thanks
|
|
|
|
|
vcpgmr wrote: is it possible to know the dmPaperSize for custom paper size for a particular printer
Hi,
Did you try like this?
pDevModeOutput->dmFormName = NewFormName;
pDevModeOutput->dmPaperSize = DMPAPER_USER;
pDevModeOutput->dmPaperLength = CustomLength;
pDevModeOutput->dmPaperWidth = CustomWidth;
Krishnakumar
|
|
|
|
|
Hi!,
Thank you for the reply.
Yes I had tried the way you said, but its not working. Are there any other variables/properties which we need to set before setting value to DocumentProperties
Thank you
|
|
|
|
|
|
how to write and read into files using vc++ for smartphones
i am able to write into file.
i am not able to read and append the file.
after reading how do i print that data on smartphones?
please send me the sample code.
|
|
|
|
|
Can you show us the code that you have tried that does not work?
|
|
|
|
|
Hi
All
I create one DLL with unicode support and i want to use this DLL in my other non unicode application in MFC/VC++, but while using this i get error message of "Application.exe error memory can not read" so anybody have solution to this plz send me.
Thanks
Atool
Atool
|
|
|
|
|
M. Atul wrote: so anybody have solution to this plz send me.
create both dll with unciode support.
I doubt the error comes when u try to call a function of the dll having some TCHAR as parameter..
nave
|
|
|
|
|
I am not using two DLL, i am using one unicode dll and i want to call it in other non unicode client application. In client application i call one fun from DLL which takes DWORD parameter and return CString values.But when i run client application there is error as " Application.exe error memory could not read"
When i debug client application i got error in messagebox where i display CString values which is return from DLL function.
Thanks
Atool
Atool
|
|
|
|
|
M. Atul wrote: I am not using two DLL
M. Atul wrote: and return CString values
here is the pblm. CString internally keeps a pointer of type LPTSTR.
in a unciode define dll it becomes LPTSTR = whcar_t*
in a non unciode application it become LPTSTR - char*
In your case a wchar_t pointer is interpreted as char* pointer after u have got the retun value from the function.
solution:
Change the return type from CString to wchar_t*.
// in dll
wchar_t* fun( DWORD dw )
{
return somepointer;
}
// in client application
CString cs = fun( 2 );
-- modified at 1:49 Friday 2nd February, 2007
nave
|
|
|
|
|
Thanks Naveen R for help
I change in code as u said , though i have problem when i run client application there is message that memory could not read. Is there any need for project setting to run unicode dll in Non unicode client application.
Regards
Atool
Atool
|
|
|
|
|
no. Only thing is that u should not use TCHAR, LPTSTR etc which have different meaning in unicode and non unicode application.
Can u show me the code in that function of dll and how is it called from the client?
nave
|
|
|
|
|
This is code in DLL
wchar_t* CEngDLL::GetStringResourceID(DWORD dwResID) // This function return resource string
{
// CString str;
wchar_t myString[300];
HINSTANCE hInstance = AfxGetResourceHandle();
AfxSetResourceHandle(::GetModuleHandle(L"NSEngDLL.dll"));
LoadStringW(hInstance,dwResID,myString,300) ;
return &myString[0];
}
Following code in client application
BOOL CEngTestDlg::OnInitDialog()
{
CString msg;
CDialog::OnInitDialog();
msg = obj.GetStringResourceID(10);
m_lblExample.SetWindowText(msg); // for loading string from DLL
//other code
}
void CEngTestDlg::OnOK()
{
UpdateData(true);
CString resStr;
//wchar_t* resStr;
resStr = obj.GetStringResourceID(100);
MessageBox(resStr);
// TODO: Add extra validation here
//CDialog::OnOK();
}
when i debug DLL it run fine but when i run client application there is error msg as "Application.exe reference memory x0000000.. could not read memory" so plz guide about this error.
Thanks
Atool
Atool
|
|
|
|
|
M. Atul wrote: return &myString[0];
u r returning an address of locally define object. this is a wrong implementation. Cause the
wchar_t myString[300]; will get destroyed as soon as u return from the function GetStringResourceID.
u should allocate it in heap.
wchar_t* CEngDLL::GetStringResourceID(DWORD dwResID) // This function return resource string
{
// CString str;
wchar_t* pmyString = new wchar_t[300];
HINSTANCE hInstance = AfxGetResourceHandle();
AfxSetResourceHandle(::GetModuleHandle(L"NSEngDLL.dll"));
LoadStringW(hInstance,dwResID,pmyString,300) ;
return pmyString;
}
dont forget to delete the pointer in the client app.
nave
|
|
|
|
|
I need to print from a C++ application using the custom form. It is possible to set user defined paper length and paper width to this custom form. Addition of custom form from the application using AddForm function worked fine. But it was not possible to change the printer settings (paper size) using this custom form. Is there any method by which this can be achieved. I tried with ::DocumentProperties function to get the printer properties.
The reference link to microsoft knowledge base is http://support.microsoft.com/kb/282474
How can we change the printer settings using custom form settings. Please help.
Thankyou
|
|
|
|
|
Do you want to set size of paper for printer A3,A4,.. if yes see DEVMODE structure
|
|
|
|
|
Hi!
Thank you for ur reply.
Yes, I want to set paper size to custom value. But from the form properties. I had set the custom paper size to FORM_INFO_1 structure and added this form to printer server propeerties. But couldn't set the printer properties using this form. Can somebody please help me on this.
thankyou
|
|
|
|
|
|
|
Hi all
Is there any possibility to add tooltips to resource like bimaps.
please help me.
-- modified at 23:47 Thursday 1st February, 2007
#sanroop#
|
|
|
|
|
Sanroop wrote: (Urgent)
O'Rly?
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்ம குரு
|
|
|
|
|
Sanroop wrote: Is there any possibility to add tooltips to resource like bimaps
yes. you will be showing the bitmap in some window na? So u can add tool tip to that window.
nave
|
|
|
|
|
Thanque for u r reply
here iam pacing the bitmap in Richedit like chatting emotions.here the requirement is add tooltip to that bitmaps on recieving side.
#sanroop#
|
|
|
|
|
derive a class for the richedit( or u have to do it in the PreTranslateMessage function of the dialog )
overide the WindowProc function and call the RelayEvent of the tooltip from it( u need to create an object of CTooltip in that class)
Also overide the mousemmove message of the richedit control. In that function Check the mouse is over the bitmap, if yes call AddTool function of the tooltip with the message that you want to display. If it is not over the bitmap remove the tooltip using DelTool .
nave
|
|
|
|