|
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
|
|
|
|
|
|
Hi all,
I'm struggling with a strange problem. The thing is I wrote a application that installs / creates a DSN. I'm using a dll called Interop.ODBCTool.2.0.dll. And this dll has a function called CreateDSN() which accepts the following parameters:
- DSNname
- ODBCDriver
- Server Name
- Database Name
- Username
- Password
- Silent Option (bool)
- ODBC ATT (parameter can be NULL)
So the problem is that, I can create a DSN on a machine that has a established MySQL installation (that has other datasources, databases and so on.) But when I install a fresh copy of MySQL on a machine and nothing has been done concerning DSN, Databases and so on, the function (which is bool) returns false. It doesn't want to create a DSN. (But ... Like on my machine it works fine) . So the thing is do you have any idea that the problem could be.
(The MySQL Drivers is installed)
Thanx alot.
-- modified at 7:12 Monday 7th August, 2006
Regards
Programm3r
|
|
|
|
|
Hy all !
Again i have a serious problem with my list control !
This code works , but now i want to do something new and I don t have any ideea how to do it !
If is someoane to help me with my code !
void CMyList::OnOK()
{
UpdateData();
m_list2.RedrawItems(0,m_list2.GetItemCount());
CString sName;
sName = _T("NAME");
m_name.GetWindowText(sName);
LVFINDINFO stInfo1 = {0};
stInfo.flags = LVFI_PARTIAL;
stInfo.psz = sName;
int nItem = m_list2.FindItem( &stInfo );
if( nItem != -1 )
{
sSecondColumnText = m_list2.GetItemText( nItem, 1 );
// set the text to the second edit box
m_explicatia.SetWindowText(sSecondColumnText);
}
}
This code find me the item in the second column !
Now i have 2 edit boxes to search in the list control !
And all i want is to find them in list control but :
My list control:
------------------------------------------------
| NAME | City | Country |
________________________________________________
|George |London | England |
|George |NewYork | USA |
------------------------------------------------
I have 3 edit boxes
1) m_name
2)m_City
3)m_rezult
all 3 are CEdit;
first i want to find if in the m_name matches with "NAME" next m_name with "City" and if is find it the "name" and the "City" from both 2 edit boxes i need the country in the m_rezult !
i want to search this :
George (m_name) -> London (m_City) and if exist on the same line :
m_rezult ---> England !!!!!!!!!!!!!!!
and :
George (m_name) -> NewYork (m_City) and if exist on the same line :
i need the rezult :
m_rezult ---> USA !!!!!!!!!!!!!!!
i need some help !!!!!!
Bravoone
|
|
|
|
|