|
I think you should assign a palette. A simple way is:
CxImage image(...);
image.SetGrayPalette();
image.Clear(0xFF);
Since your text must be black, I think instead of
RGBQUAD c={255,255,255,255};
which is white, you should try
RGBQUAD c = {0, 0, 0, 0};
I hope this helps.
|
|
|
|
|
Thank you Viorel.
Now it has shown the white page but i wonder why it hasn't shown my text on it. It only a balnk page created.
My code is
FILE *fp1,*fp2;<br />
fp1 = fopen(fileSrc,"r");<br />
fp2 = fopen(fileDest,"wb+");<br />
<br />
while((ch[0] = fgetc(fp1))!= EOF)<br />
{<br />
if(ch[0] == '\n' || ch[0] =='\r')<br />
{<br />
x=10;<br />
y+=10;<br />
}<br />
x+=10;<br />
ch[1]='\0';<br />
image.DrawString(hdc, x, y, ch,c, "Arial");<br />
}<br />
<br />
fclose(fp1);<br />
fclose(fp2);
KIRAN PINJARLA
|
|
|
|
|
I think you should make an experiment with a greater y , for instance set the initial y to 100. Also check if you are using black colour, i.e. "RGBQUAD c = {0, 0, 0, 0}; ".
|
|
|
|
|
HDC hdc = ::GetWindowDC(NULL); int l = image.DrawString(hdc, x, y, "ch",c, "Arial");<br />
::ReleaseDC(NULL,hdc);
what exactly the line GetWindowDC(NULL) does. and what happens when we place the hdc in the Drawstring(hdc,..).
KIRAN PINJARLA
|
|
|
|
|
Analyzing the source of CxImage library (ximawnd.cpp), it seems the HDC value is used to format and draw the text on a temporary in-memory bitmap, and then the image is copied from this bitmap to CxImage object.
It does not look much optimized for speed, and maybe you will have time to investigate some other approaches, like creating your own HBITMAP object, drawing on it, and then saving it to a file, for example using CImage class from ATL/MFC?
|
|
|
|
|
Hi,
I am writing an application that generates documents and I wqould like to open them in Microsoft Word automatically. Does anyone have an idea how to launch Word with the relevant document from within my application?
Thanks in advance,
William
|
|
|
|
|
|
|
Hi try this, may help u
http://support.microsoft.com/kb/178749/E-US/
then use this code in ur programme
BOOL CLastApp::InitInstance()
{
if(!AfxOleInit()) // Your addition starts here
{
AfxMessageBox("Could not initialize COM dll");
return FALSE;
}
else
{
//AfxMessageBox("Inint");
}
_Application app; // app is the Excel _Application object
if(!app.CreateDispatch("Word.Application"))
{
AfxMessageBox("Couldn't start Excel.");
}
else
{
app.SetVisible(TRUE);
}
COleVariant covTrue((short)TRUE),covFalse((short)FALSE),covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR),covFormat( short(7));
COleVariant m_Long((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
AfxEnableControlContainer();
Documents docs = app.GetDocuments();
unsigned long int i = 1;
CFileFind finder;
CString file_name;
CString path;
BOOL bWorking = finder.FindFile("d:/george/*.doc");
while(bWorking){
bWorking = finder.FindNextFile();
file_name = finder.GetFileName();
path = "D:\\george\\"+ file_name;
//AfxMessageBox(path);
_Document doc = docs.Open(
COleVariant(path),
covTrue, // Confirm Conversion.
covTrue, // ReadOnly.
covFalse, // AddToRecentFiles.
covOptional, // PasswordDocument.
covOptional, // PasswordTemplate.
covFalse, // Revert.
covOptional, // WritePasswordDocument.
covOptional, // WritePasswordTemplate.
covTrue,
covTrue,
covOptional,
covOptional,
covOptional,
covOptional);
/*VARIANT* FileName,
VARIANT* FileFormat,
VARIANT* LockComments,
VARIANT* Password,
VARIANT* AddToRecentFiles,
VARIANT* WritePassword,
VARIANT* ReadOnlyRecommended,
VARIANT* EmbedTrueTypeFonts,
VARIANT* SaveNativePictureFormat,
VARIANT* SaveFormsData,
VARIANT* SaveAsAOCELetter,
VARIANT* Encoding,
VARIANT* InsertLineBreaks,
VARIANT* AllowSubstitutions,
VARIANT* LineEnding,
VARIANT* AddBiDiMarks)*/
/*doc.SaveAs(COleVariant(path),
covFormat,covOptional,covOptional,
covOptional,covOptional,covFalse,covOptional,
covTrue,covFalse,covOptional, covOptional,covTrue,covOptional,covOptional,covOptional);*/
file_name.Format("%lu",i);
path = "D:\\work\\"+file_name+".txt";
//AfxMessageBox(path);
doc.SaveAs( COleVariant(path),
covFormat,
covOptional,
covOptional,
covOptional,
covOptional,
covFalse,
covOptional,
covTrue,covFalse,covOptional, covOptional,covTrue,covOptional,covOptional,covOptional);
doc.Close(m_Long,m_Long,m_Long);
i++;
//docs.Close(m_Long,m_Long,m_Long);
}
app.Quit(m_Long,m_Long,m_Long);
AfxMessageBox("Completed");
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
return FALSE;
}
|
|
|
|
|
Is the keyword 'void' a datatype?
|
|
|
|
|
Pointers can also be declared as void. They can't be dereferenced without explicit casting. This is because the compiler can't determine the size of the object the pointer points to. For example,
int x;
float f;
void *p = &x; // p points to x
*(int*)p = 2;
p = &r; // p points to r
*(float*)p = 1.1;
Answer your question?
Regards
Programm3r
|
|
|
|
|
Its more of an anti-datatype. When used by itself (e.g. as a return value for a function) it means there is nothing coming back. When used as a pointer (void* ) it means it is pointing to an address in memory, but you either don't know what datatype it is, or don't care what type it is (that is, that you are just concerned with the bytes that start at that address, and not the actual datatype that is there).
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
No example for my code I NEED HELP !
I don t now how to do it !
Nothing in msdn library !
Please someoane ! someone must have an ideea !!!!!!
i don t have any ideea how to it , all i have done he give me the same answer , exactly the same result ! (first step)!
Bravoone
|
|
|
|
|
NOTHING ?! i need some help over here !!!!!
Bravoone
|
|
|
|
|
Read the lines in the list control, one by one.
For each line, split it into it's parts (name, city, country)
Compare the name from the list with the given name. If it matches, compare the city (from the list) with the given city. If it matches, display the country (from the list).
What's the problem?
|
|
|
|
|
you can give an example how can i do this !?
PLEASE !
Thank you !
Bravoone
|
|
|
|
|
Sorry, I don't have the time right now.
But there *is* (for sure) a lot of examples how to:
1. Find out the number of used rows in a list control.
2. Get the text from a specific line in a list control.
That's a good way to start.
When you got that logic working, continue with splitting a text line into it's components (in your case, name, city and country).
When that's done, go on with the comparison.
And you are done.
A hint: Study the methods of the CListCtrl class.
Here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmfc98/html/_mfc_clistctrl.asp[^]
-- modified at 6:53 Monday 7th August, 2006
|
|
|
|
|
kakan wrote: What's the problem?
There's no nice way to say it. Maybe if we ignore him, he'll go away.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
For sure, I won't try to answer his questions again. He won't give up until someone else presents him a complete, running sample. He won't ever be a coder with that attitude.
|
|
|
|
|
And after reading all your posts I need a good strong stiff drink. Geez, have patience!
|
|
|
|
|
You've only waited 16 minutes. Why are you so impatient? Do you think asking the same question in a 4-5 hour window will actually get you any useful help? Any chance you had is surely gone by now.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Flaviu_2006 wrote: Nothing on codeproject I NEED HELP !
Yet another useless subject line. By now I would have expected you to have read the forum rules to discover why you are not getting a response that you can use. Perhaps you should stop whining too.
|
|
|
|
|
Can't you wait any longer than 57 minutes?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
hi all
How to add table inside tooltip using Win32 C based application. Means when i move mouse over a button it should show tooltip containing table(say 5 x 5)with some information. (I know how to create normal tooltips).
OR
How to show/hide .bmp file instead of tooltip when a mouse moves over a button in Win32 C based application.
thanks
Manjunath S
Bangalore
|
|
|
|
|
Can this [^]help ?
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|