|
Hello,
I am trying to 'SendMessage' thru a DLL, can i do this?
i Have written following code in DLLMain
===================================================================
AppLog *app = new AppLog;
if(!app)
return TRUE;
wcscpy(app->strAppName,strTemp);
COPYDATASTRUCT cpd;
cpd.cbData = sizeof(AppLog);
cpd.dwData = 0;
cpd.lpData = (PVOID)app;
MessageBox(NULL,app->strAppName , L"Copied exe Name", 0);
BOOL bRet = SendMessage(hCompactEngine, WM_COPYDATA, (WPARAM)1, (LPARAM)&app);
DWORD dwret = GetLastError();
===================================================================
Here dwret = 120 (This function is not supported on this system.)
Can anybody help me with this. Am i missing anything.
|
|
|
|
|
tony_udz wrote: BOOL bRet = SendMessage(hCompactEngine, WM_COPYDATA, (WPARAM)1, (LPARAM)&app);
app, but you want to send cpd right?
|
|
|
|
|
Hello, I have an application in VC++6.0 that create a .DOC file for Word2007.
When I inserting text and image (.bmp) in file .DOC I need retrieve current row. How I can do it?
Someone can help me with link or sample code in VC++?
Thanks
|
|
|
|
|
Check which font you are using for the text. Calculate how many letters can this font fit into a line (test and error). Count how many letters and line-ends do you have.
Get the rectangle of the bitmap, get how high it is, calculate how many lines can be ocuped with that high.
Add all together.
Greetings.
--------
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?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
A method more immediate there isn't?
|
|
|
|
|
AFAIK... no. You can check the web, but I don't know anyone.
Greetings.
--------
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?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Hello sir,
i have a problem could you please solve it.
i have to connect Microsoft access to c programming language. any c book dosnt provide this topic.
i want source code.
thank you sir.
yogesh
|
|
|
|
|
It is urgent or not?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
yogesh_softworld123 wrote: could you please solve it
US to solve YOUR problem ?
yogesh_softworld123 wrote: i want source code
you're not in a position to require source code, knowing that we generally don't give source code to someone that impolite.
have you only searched the web/google/codeproject first before asking the forum ?
|
|
|
|
|
yogesh_softworld123 wrote: i have to connect Microsoft access to c programming language.
Probably you need the opposite.
There are a lot of articles at CP about databases [^], you may choose a technology (for instance ODBC) and have a look to related articles.
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
|
|
|
|
|
|
Update:
The problem seems to occur in some condition.
For example, when minimizing a message dialog of MSN Messenger, it flicks, when minizing the main dialog of MSN Messenger, it doesn't flick.
================================================
The parent windows aready has both WS_CLIPCHILDREN and WS_CLIPSIBLINGS styles,
but the child control of it still flicks, when another application cover it is minimized.
Here is some code:
int CMyEditorDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDialog::OnCreate(lpCreateStruct) == -1)
return -1;
...
style=WS_CHILD|WS_VISIBLE|BS_OWNERDRAW|BS_NOTIFY;
m_btnMin.Create(NULL,style,rc,this,ID_BTN_MIN);
m_btnMax.Create(NULL,style,rc,this,ID_BTN_MAX);
...
}
CMyButton m_btnMin;
CMyButton m_btnMax;
class CMyButton : public CBitmapButton
I've tried to let OnEraseBackground return only TRUE , but no help.
modified on Tuesday, May 6, 2008 7:56 PM
|
|
|
|
|
I had an issue like that in a project, the solution had nothing to do with the controls itself. The problem was that I wrongly made some conditions for the OnDraw and I entered in a loop.
I would check your OnDraw or OnPaint function step by step. It may be a reason.
Greetings.
--------
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?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
The OnDraw function is left default.
The OnErase is as below:
BOOL CMyEditorDlg::OnEraseBkgnd( CDC* pDC )
{
CRect rcClient;
GetClientRect(&rcClient);
Graphics g(pDC->m_hDC);
CRect rc(rcClient);
rc.bottom=rc.top+m_capH;
Bitmap bmBkCap(rc.Width(),rc.Height(),PixelFormat32bppARGB);
Graphics gMemBkCap(&bmBkCap);
TextureBrush brBkCap(&m_bmCapBkM);
gMemBkCap.FillRectangle(&brBkCap,m_bmCapBkL.GetWidth(),0,
rc.Width()-m_bmCapBkL.GetWidth()-m_bmCapBkR.GetWidth(),m_bmCapBkM.GetHeight());
gMemBkCap.DrawImage(&m_bmCapBkL,0,0);
gMemBkCap.DrawImage(&m_bmCapBkR,rc.right-m_bmCapBkR.GetWidth(),0);
gMemBkCap.DrawImage(&m_bmCapBkTitle,(rc.Width()-m_bmCapBkTitle.GetWidth())/2,0);
rc=rcClient;
rc.top=rc.bottom-m_footH;
Bitmap bmBkFoot(rc.Width(),rc.Height(),PixelFormat32bppARGB);
Graphics gMemBkFoot(&bmBkFoot);
TextureBrush brBkFoot(&m_bmFootBkM);
gMemBkFoot.FillRectangle(&brBkFoot,m_bmFootBkL.GetWidth(),0,
rc.Width()-m_bmFootBkL.GetWidth()-m_bmFootBkR.GetWidth(),m_bmFootBkM.GetHeight());
gMemBkFoot.DrawImage(&m_bmFootBkL,0,0);
gMemBkFoot.DrawImage(&m_bmFootBkR,rc.right-m_bmFootBkR.GetWidth(),0);
g.Clear((ARGB)Color::White);
g.DrawImage(&bmBkCap,0,0);
g.DrawImage(&bmBkFoot,0,rc.top);
return TRUE;
}
|
|
|
|
|
what about trying double buffer here.
CMemDC class [^] comment out the background filling with FillSolidRect
and use CMemDC class
BOOL CMyEditorDlg::OnEraseBkgnd( CDC* pDC ){
CRect rcClient;
GetClientRect(&rcClient);
CMemDC memDC(pDC, &rcClient);
Graphics g(memDC.m_hDC);
. . .
. . .
|
|
|
|
|
I've tried to make it as:
BOOL CMyEditorDlg::OnEraseBkgnd( CDC* pDC ) {
return TRUE;
}
It still flicks (no less), so I think it's other problem.
However, I tried your suggestion, now it flicks much less (say 90% less).
|
|
|
|
|
Here is the new version with less flicker
BOOL CEditorDlg::OnEraseBkgnd( CDC* pDC )
{
CRect rcClient;
GetClientRect(&rcClient);
static CRect rcClientPrev(0,0,0,0);
Graphics g(pDC->m_hDC);
if (rcClient!=rcClientPrev || m_pBmBk==NULL) {
rcClientPrev=rcClient;
CRect rc(rcClient);
rc.bottom=rc.top+m_capH;
Bitmap bmBkCap(rc.Width(),rc.Height(),PixelFormat32bppARGB);
Graphics gMemBkCap(&bmBkCap);
TextureBrush brBkCap(&m_bmCapBkM);
gMemBkCap.FillRectangle(&brBkCap,m_bmCapBkL.GetWidth(),0,
rc.Width()-m_bmCapBkL.GetWidth()-m_bmCapBkR.GetWidth(),m_bmCapBkM.GetHeight());
gMemBkCap.DrawImage(&m_bmCapBkL,0,0);
gMemBkCap.DrawImage(&m_bmCapBkR,rc.right-m_bmCapBkR.GetWidth(),0);
gMemBkCap.DrawImage(&m_bmCapBkTitle,(rc.Width()-m_bmCapBkTitle.GetWidth())/2,0);
rc=rcClient;
rc.top=rc.bottom-m_footH;
Bitmap bmBkFoot(rc.Width(),rc.Height(),PixelFormat32bppARGB);
Graphics gMemBkFoot(&bmBkFoot);
TextureBrush brBkFoot(&m_bmFootBkM);
gMemBkFoot.FillRectangle(&brBkFoot,m_bmFootBkL.GetWidth(),0,
rc.Width()-m_bmFootBkL.GetWidth()-m_bmFootBkR.GetWidth(),m_bmFootBkM.GetHeight());
gMemBkFoot.DrawImage(&m_bmFootBkL,0,0);
gMemBkFoot.DrawImage(&m_bmFootBkR,rc.right-m_bmFootBkR.GetWidth(),0);
Bitmap bmMemBk(rcClient.Width(),rcClient.Height(),&g);
Graphics gMemBk(&bmMemBk);
gMemBk.Clear((ARGB)Color::White);
gMemBk.DrawImage(&bmBkCap,0,0);
gMemBk.DrawImage(&bmBkFoot,0,rc.top);
delete m_pBmBk;
m_pBmBk=new CachedBitmap(&bmMemBk,&g);
}
g.DrawCachedBitmap(m_pBmBk,0,0);
return TRUE;
}
|
|
|
|
|
what about a single offscreen bitmap (cached), you are using 3 bitmaps now, (bk, cap, foot). I think background has to drawn first but you are drawing last.
|
|
|
|
|
I have a dialog and this dialog's domodal function(myDlg->DoModal) is called from another cpp file. I got rectangle of this dialog at the end of the oninitdialog function and a button clicked event after the dialog had been visible but these two rectangle values were different. Does domodal function do something about position of the dialog after oninitdialog function of this dialog?
<br />
other.cpp:<br />
<br />
myDlg->domodal()<br />
<br />
<br />
myDlg.cpp:<br />
<br />
myDlg::OnInitDialog<br />
{<br />
......<br />
......<br />
GetWindowRect(&rect);
}<br />
myDlg::ButtonClick
{<br />
GetWindowRect(&rect);
}<br />
Why are these two rectangle diffenrent? Thanks.
|
|
|
|
|
Did you move your dialog before clicking the button ? If yes, then it's normal that the rectangle changed.
|
|
|
|
|
mehmetned wrote: Does domodal function do something about position of the dialog after oninitdialog function of this dialog?
There is a function called _AfxPostInitDialog which does some additional house keeping after OnInitDialog !
From what I see it's centering the dialog!
Nibu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
Sure, GetWindowRect is not correct at OnInitDialog.
Use GetWindowPlacement to get window position is a better idea.
Chintse Wu/[^]
|
|
|
|
|
I need to find CButton\CComboBox\ some other control properties and i have the hwnd of the component - How can i do it ?
Thanks.
|
|
|
|
|
try
LONG GetWindowLong(HWND hWnd, int nIndex);
|
|
|
|
|
What i need is little more complex.
I want not only the properties that i can get by using GetWindowLong - i want also the properties around the object.
I mean properties like - object color, text, size, class, parent of the object ( if the object is CButton that "sit" on some panel or dialog )
So... How can i get all those information ?
|
|
|
|
|