|
GDI+ allows this. Anyway why bother? Simply properly scale the rectagle before drawing it.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
pls let me know how can i do that...
|
|
|
|
|
GDI+ uses floating point coordinates. You just need to use GDI+.
|
|
|
|
|
Let me be more clear...
Suppose i want to draw segments(rect) on a Dialog and the given coordinates of the segemnt is
0.499567,0.000000,1.000000,0.499369 (these coordinates are independent of the width and height of the Dialog Rect) then how to draw the segment with the given coordinates.....
|
|
|
|
|
Do you sometimes read the answers that are given to you ?
|
|
|
|
|
Hi all,
I have made a exe using VS-2008.
I am trying to run that exe on another pc which not having VS-2008 inatalled on it (having OS - win xp with sp3), in my exe i have initialised COM using this code.
hres = CoInitializeEx(0, COINIT_MULTITHREADED);
if (FAILED(hres))
{
AfxMessageBox(_T("Failed to initialize COM library") );
return;
}
But every time i run my exe on this machine it gives "Failed to initialize COM library".
Do i need to install anything extra on this machine...
Or what other problem there might be?
Can anybody help me in this...
Thanks in advance
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
You should check better the function return value (make your program reporting it). See the documentation for details [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
HI,
For the function CoInitializeEx(), dont check for the returned code.
Because if the COM has been initialized on the calling thread, the return code will be failed i.e S_FALSE.
Just call the CoInitializeEx() and proceed to next.
|
|
|
|
|
DurgaDevi_hr wrote: For the function CoInitializeEx(), dont check for the returned code.
Because if the COM has been initialized on the calling thread, the return code will be failed i.e S_FALSE.
Your point is wrong.
In fact, CoInitializeEx() may return S_FALSE the way you depicted. However FAILED(S_FALSE) evaluates to false .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Did you register COM in the new machine?
Using following function always successes for me.
hr = CoCreateInstance( CLSID_App, NULL, CLSCTX_INPROC_SERVER, IID_IUnknown, (void **) &pUnk );
|
|
|
|
|
Hi,
Im trying to draw text on a button which is placed on a Dialog...using the below code in Onpaint
CWnd* pWnd = GetDlgItem(IDC_BUTTON1);
CDC* pDC = pWnd->GetDC();
CRect rect1(3,5,8,10);
pDC->SetTextColor(::GetSysColor(COLOR_HIGHLIGHTTEXT));
pDC->SetBkColor(::GetSysColor(COLOR_HIGHLIGHT));
CBrush brush(RGB(0,0,64));
pDC->SelectObject(&brush);
pDC->DrawText(_T("Example"),&rect1,DT_LEFT|DT_SINGLELINE|DT_VCENTER);
CDialog::OnPaint();
but the above code doesn"t reflect the text...
pls correct me...
|
|
|
|
|
Yout cannot do that, that way. See, for instance [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thanks for ur Reply...but the button control is from Resource not a custom Control....
Is it not possible to draw text on a control which is created from resource..?
|
|
|
|
|
Usually the button is loaded from resource (where is stored with BS_OWNERDRAW style).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
If Possible can u explain in more detail..i didn"t get the point..
|
|
|
|
|
If you're using MFC , this article [^] (from the competitors... ) may help.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi,
The following sample failed to create the DSN,
void main()
{
//As my DB path will change frequently i am using this method.
bool aDSNCreated = false;
char temp[MAX_PATH];
sprintf(temp,"DSN=SAMPLE\0DBQ=D:\\SAMPLE.mdb\0");
aDSNCreated = SQLConfigDataSource(NULL, ODBC_ADD_SYS_DSN, "Microsoft Access Driver (*.mdb)\0", temp);
printf("%d",aDSNCreated );
}
whereas when I execute the below code; it execute successfully.Can anyone help in this why its happening?
void main()
{
bool aDSNCreated = false;
aDSNCreated = SQLConfigDataSource(NULL, ODBC_ADD_SYS_DSN, "Microsoft Access Driver(*.mdb)\0","DSN=SAMPLE\0DBQ=D:\\SAMPLE.mdb\0");
printf("%d",aDSNCreated );
}
|
|
|
|
|
DurgaDevi_hr wrote: "Microsoft Access Driver(*.mdb)\0","DSN=SAMPLE\0DBQ=D:\\SAMPLE.mdb\0"
Interesting string format with a double Null-Terminator[^], what were they thinking?
The extra Null-Terminator will cause problems with most C-Runtime string functions.
Have a look at SQLConfigDataSource attributes with variables[^], does this help?
/M
|
|
|
|
|
Hi Moak,
I tried the logic as specified in the link.
It worked fine. Thanks for that.
But can u tell me, why SQLConfigDataSource() parameter alone is accepting the null terminator string?
Any idea about that?
|
|
|
|
|
DurgaDevi_hr wrote: But can u tell me, why SQLConfigDataSource() parameter alone is accepting the null terminator string?
In a nutshell, the SQLConfigDataSource() uses a strange string format and with a literal text string this is fortunately not a problem (your second example code). But when you use string functions such as sprintf/strcpy/strlen they will stop at the first Null-Terminator. For example "bla\0fasel\0" would be copied only to the the first \0 and becomes "bla\0" . You can try it in the debugger.
modified on Monday, December 14, 2009 7:53 AM
|
|
|
|
|
|
DurgaDevi_hr wrote: The following sample failed to create the DSN,
So then why aren't you calling SQLInstallerError() to find out why?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi all,
I have developed a SDI. It is divided into two parts using a splitter i)simple view ii) another is a dialog(derived from CFormView).
My problem is, whenever i resizing the dialog, all static text and controls are erased and redrawing. How can i stop it?
Thanks to all
|
|
|
|
|
can you try WS_CLIPCHILDREN[^] style?
-Sarath.
Rate the answers and close your posts if it's answered
|
|
|
|
|
Hi...
I am doing a MFC Applicaton.
That is Multiple Document and Base class is CView Class. While i am running the program a white color window is opening. I need to change the white colour window to Block colour window.
Any one have idea, how to convert the window color?
Any help will be appreciated.
Thanks...
G.Paulraj
|
|
|
|