|
Hi,
Can I override DefWindowPro() in my MFC application, plz give me hint or steps to do this.
modified on Monday, March 16, 2009 4:49 AM
|
|
|
|
|
I'm sure you mean override.
The signature of the DefWindowProc function of the CWnd class is as follows
virtual LRESULT DefWindowProc(
UINT message,
WPARAM wParam,
LPARAM lParam
);
So you simply create a function with the same name in your class that is derived from CWnd .
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Overwrite?
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Btw, why would someone need to intercept DefWindowPro() ?
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
when i use connect() fuction. I got a WASENOBUFS error,but when i restart computer,the application works.after a while the errors again.
MSDN says there is not enough buffer.but how to solve the problem?
thanks
|
|
|
|
|
See here[^].
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
the solution you gave me says that too many applications are running on my computer,but there is not so many applications on my computer.
so how to solve this?
|
|
|
|
|
I've faced this one. But doesn't strike to me now. Are you doing something in a rigorous loop?
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
yes.I connect()a server in a loop.
How to solve this?
|
|
|
|
|
Ah I think you are sending packets of bigger size?
http://support.microsoft.com/kb/201213[^]
Also another scenario:
For a duplicated TCP socket on Windows 95 and Windows 98, the closesocket() function fails to close the connection of the duplicated socket. This can be a problem when you launch several (10 to 20) applications which use WSADuplicateSocket() to create a duplicate socket and call closesocket() to clean up the connection. It eventually exhausts all the socket resources. Using the NETSTAT -AN command shows the maximum number of sockets already in use and most of them are either in CLOSE_WAIT or FIN_WAIT_2 state indefinitely. At this point, any attempt to call connect() will fail with error WSAENOBUFS since there is no more socket available for a new connection.
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
modified on Monday, March 16, 2009 4:51 AM
|
|
|
|
|
I meet a problem about using PSSM(Parallel-Split Shadow Maps) to render the shadow to a shadow result texture (restore the shadow pixel, 1 means lighted, 0 means shadowed). The shadow result texture is a render target texture with the format of R32F. My problem is that if I render a flag model in PS_SRT (pixel shader to generate shadow result texture) and using "return fLightingFactor;", I will see the nofilled shadow. If I using "return float4(fLightingFactor,1.0f,1.0f,1.0f);" in PS_SRT, I will see the filled shadow.
The filled shadow: http://cid-fbeb6373d9321a7f.skydrive.live.com/self.aspx/Questions/shadow/PSSM%7C_shadow%7C_fill.JPG
The unfilled shadow: http://cid-fbeb6373d9321a7f.skydrive.live.com/self.aspx/Questions/shadow/PSSM%7C_shadow%7C_notfill.JPG
The filled shadow also has a stranger aliasing problem. The program is written by my lowerclassman. I implement PSSM into this program. I also implement the PSSM into my MapEditor, but my MapEditor has no this stranger shadow aliasing and no unfilled problem---no matter the return statement ("return fLightingFactor;" or "return float4(fLightingFactor,1.0f,1.0f,1.0f);" ).(My MapEditor's flag shadow : http://cid-fbeb6373d9321a7f.skydrive.live.com/self.aspx/Questions/shadow/PSSM%7C_shadow%7C_fill%7C_ME%7C_no%7C_aliasing.JPG).
These are my partial shader code:
void VS_RenderShadowMap(
float4 vPos : POSITION,
out float4 vPosOut : POSITION,
out float3 vPixelOut : TEXCOORD0)
{
vPosOut = mul(vPos, wvp);
vPixelOut=vPosOut.xyz;
}
float4 PS_RenderShadowMap(float3 vPixelPos : TEXCOORD0): COLOR
{
return vPixelPos.z;
}
technique RenderShadowMap
{
pass p0
{
CullMode = CW;
ZWriteEnable=TRUE;
ZEnable=TRUE;
VertexShader = compile vs_3_0 VS_RenderShadowMap();
PixelShader = compile ps_3_0 PS_RenderShadowMap();
}
}
void VS_SRT(
in float4 vPos : POSITION,
in float3 vNormal : NORMAL,
in float4 vDiffuseTex : TEXCOORD0,
out float4 vPosOut : POSITION,
out float4 vShadowTex : TEXCOORD0,
out float4 vDiffuseTexOut : TEXCOORD1
)
{
vPosOut = mul(vPos, wvp);
vShadowTex = mul(vPos, g_mShadowMap);
vDiffuseTexOut=vDiffuseTex;
}
float4 PS_SRT(
float4 vShadowTex : TEXCOORD0,
float4 vDiffuseTex: TEXCOORD1
) : COLOR
{
float4 Color=tex2D(DiffuseMapSampler1, vDiffuseTex);
if (Color.a<0.5f)
{
discard;
}
vShadowTex.xy/=vShadowTex.w;
.......
if (g_bUseColorfulSplit==true)
{
.......
#ifdef _RETURN_FLOAT4_
return float4(fLightingFactor,1.0f,1.0f,1.0f);
#else
return fLightingFactor;
#endif
}
}
technique generateSRT
{
pass p0
{
CullMode=CCW;
ZWriteEnable=TRUE;
ZEnable=TRUE;
VertexShader = compile vs_3_0 VS_SRT();
PixelShader = compile ps_3_0 PS_SRT();
}
}
modified on Monday, March 16, 2009 3:20 AM
|
|
|
|
|
Hi !
I have using the following code for creating the toolbar button for office 2000 to office 2003.
It is generic. So I am using this code.
Actually I need 2 buttons in 1 single toolbar. how to do that.
Also Help to how to add the same in file menu item. and also it should work office 2000 to office 2003.
Give a solution for this.
also following code object model is like this commandbars("standard").controls.add (,,,,,)
how to change the code refer like this commandbars(0).controls(2).add.
I have tried to add "Index as property" but no use
STDMETHODIMP CSampleAddin::AddToolBarButton(LPOLESTR lpToolBarName,LPOLESTR lpButtonName,LPOLESTR lpToolTip,LPOLESTR lpTag,long lFaceId,long lBitmapResource)
{
TCHAR szTest[MAX_PATH]={0};
VARIANT vtCmdBars; VariantInit(&vtCmdBars);
VARIANT vtCmdBar; VariantInit(&vtCmdBar);
VARIANT vtCtrls; VariantInit(&vtCtrls);
VARIANT vtButton; VariantInit(&vtButton);
VARIANT vtParam; VariantInit(&vtParam);
VARIANT vtButton1; VariantInit(&vtButton1);
VARIANT vtExp; VariantInit(&vtExp);
HRESULT hr = S_FALSE;
ZeroMemory(szTest,sizeof(szTest));
hr = GetProperty(m_pParentApp, L"CommandBars", &vtCmdBars);
if (FAILED(hr)) goto cleanup;
vtParam.vt = VT_BSTR; vtParam.bstrVal = ::SysAllocString(lpToolBarName);
hr = CallMethod(vtCmdBars.pdispVal, L"Item", &vtCmdBar, 1, &vtParam);
VariantClear(&vtParam);
if (FAILED(hr)) {
vtParam.vt = VT_BSTR; vtParam.bstrVal = ::SysAllocString(lpToolBarName);
hr = CallMethod(vtCmdBars.pdispVal, L"Add", &vtCmdBar, 1, &vtParam);
VariantClear(&vtParam);
if (FAILED(hr)) goto cleanup;
}
m_pOurCmdBar[nCount] = vtCmdBar.pdispVal;
m_pOurCmdBar[nCount]->AddRef();
hr = GetProperty(m_pOurCmdBar[nCount], L"Controls", &vtCtrls);
if (FAILED(hr)) goto cleanup;
vtParam.vt = VT_BSTR; vtParam.bstrVal = ::SysAllocString(lpButtonName);
hr = CallMethod(vtCtrls.pdispVal, L"Item", &vtButton, 1, &vtParam);
VariantClear(&vtParam);
_stprintf(szTest,TEXT("Value of hr at button item is (Item): %X"),hr);
OutputDebugString(szTest);
if (FAILED(hr))
{
vtParam.vt = VT_I4; vtParam.lVal = 1;
hr = CallMethod(vtCtrls.pdispVal, L"Add", &vtButton, 1, &vtParam);
if (FAILED(hr)) goto cleanup;
vtParam.vt = VT_I4; vtParam.lVal = 3;
hr = PutProperty(vtButton.pdispVal, L"Style", &vtParam);
if (FAILED(hr)) goto cleanup;
if(lBitmapResource > 0 )
{
HANDLE hBmp = NULL;
hBmp = (HANDLE)LoadImage(_Module.m_hInst,MAKEINTRESOURCE(lBitmapResource),IMAGE_BITMAP,0,0,LR_LOADMAP3DCOLORS);
::OpenClipboard(NULL);
::EmptyClipboard();
::SetClipboardData(CF_BITMAP, (HANDLE)hBmp);
::CloseClipboard();
::DeleteObject(hBmp);
hr = CallMethod(vtButton.pdispVal, L"PasteFace", NULL, 0, NULL);
if (FAILED(hr)) goto cleanup;
}
vtParam.vt = VT_BSTR; vtParam.bstrVal = ::SysAllocString(lpButtonName);
hr = PutProperty(vtButton.pdispVal, L"Caption", &vtParam);
VariantClear(&vtParam);
if (FAILED(hr)) goto cleanup;
vtParam.vt = VT_I4; vtParam.lVal = 100;
hr = PutProperty(vtButton.pdispVal, L"Width", &vtParam);
if (FAILED(hr)) goto cleanup;
vtParam.vt = VT_BSTR; vtParam.bstrVal = ::SysAllocString(lpTag);
hr = PutProperty(vtButton.pdispVal, L"Tag", &vtParam);
VariantClear(&vtParam);
if (FAILED(hr)) goto cleanup;
vtParam.vt = VT_I4; vtParam.lVal = 1;
hr = PutProperty(vtButton.pdispVal, L"Visible", &vtParam);
if (FAILED(hr)) goto cleanup;
if(lFaceId > 0 )
{
vtParam.vt = VT_I4; vtParam.lVal = lFaceId;
hr = PutProperty(vtButton.pdispVal, L"FaceId", &vtParam);
if (FAILED(hr)) goto cleanup;
}
vtParam.vt = VT_BSTR; vtParam.bstrVal = ::SysAllocString(lpToolTip);
hr = PutProperty(vtButton.pdispVal, L"TooltipText", &vtParam);
VariantClear(&vtParam);
if (FAILED(hr)) goto cleanup;
}
else
{
vtParam.vt = VT_I4; vtParam.lVal = 1;
hr = PutProperty(vtButton.pdispVal, L"Visible", &vtParam);
if (FAILED(hr)) goto cleanup;
}
m_pButtonHandler = new CButtonHandler();
if (NULL == m_pButtonHandler) goto cleanup;
m_pButtonHandler->AddRef();
m_pButtonHandler->SinkEvents(vtButton.pdispVal);
m_pButtonHandler->m_pParentApp = m_pParentApp;
vtParam.vt = VT_I4;
vtParam.lVal = 1;
hr = PutProperty(m_pOurCmdBar[nCount], L"Visible", &vtParam);
if (FAILED(hr)) goto cleanup;
CHAR szBuffer[512];
CHAR szName[256];
hr = GetProperty(m_pParentApp, L"Name", &vtParam);
if (FAILED(hr)) goto cleanup;
::WideCharToMultiByte(CP_ACP, 0, vtParam.bstrVal, -1, szName, 256, 0, 0);
wsprintf(szBuffer, "Hello from a VC COM addin. You are running in %s.", szName);
cleanup:
VariantClear(&vtParam);
VariantClear(&vtButton);
VariantClear(&vtCtrls);
VariantClear(&vtCmdBar);
VariantClear(&vtCmdBars);
if (nCount > 1)
nCount = 0;
else
nCount++;
return hr;
}
|
|
|
|
|
Hi friends,
My requirement is that I have 16 channels. I have to display the 16 channels and from that the user has to select any 3 channels whose voltage and the time values should be displayed as graph. I have done this program in MFC.I need to represent the voltage and the time values of the selected three signals in MFC. Can anyone help me how to do???? I have tried with Microsoft chart 10.0 which is an active x control??I am not able to plot the graph for 3 signals.Please help me to plot the graph....
Quick reply is appreciated..
Thanks a heap...
|
|
|
|
|
Will this help?[^]
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
"Add a custom control to your dialog resource, open the Properties of the control, and specify ChartCtrl for the Class attribute".How to do this???? I have tried in Visual c++ 6.0. I have clicked on insert-> resource->dialog,i selected the custom feature,but when i clicked properties are not coming. Please help me..
Thanks a heap..
|
|
|
|
|
Well let me get you the guy. Hold on
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
You have to open your dialog with the resource editor. Once you have your dialog in front of you, add a custom control to it where you want the control to be displayed. Right-click on it and select "Properties". Then follow the steps explained in the article.
|
|
|
|
|
On simply excuting the downloaded demo and source file,I am getting an error "_tstof undeclared variable". Can u help me...
Thanks a heap...
|
|
|
|
|
Yes, there is still a compatibility problem with VC6 (it's avery old compiler, never thought about upgrading ? ). If you are not using UNICODE, you can replace all the _tstof calls by calls to atof instead. This should fix the problem.
|
|
|
|
|
Thanks a lot it is working when I have given atof.
I have a doubt.. I need to display time values which is stored in an array in X axis.I need the voltage values which is stored in array to be displayed in y axis.
I have selected xy graph, I need to plot voltage and time values of three signals.
I don't know in the source code where I have to include the x axis value that is the time array values and y axis voltage values. In which part I ahve to include the array values??
Thanks a heap...
|
|
|
|
|
Please read the article, everything is documented there. Basically, you first need to add a new series to the control and add data to it.
There's also an example at the end of the article.
|
|
|
|
|
|
MFC, STUDIO 2008, ADO
Edited columns into control CListCtrl.
How do to save changed fields into table?
Below fragments the code:
_RecordsetPtr pRecordset;
pRecordset->Open ((IDispatch *) pCommand, vtMissing,
adOpenForwardOnly, adLockOptimistic, adCmdUnknown);
ListView_SetExtendedListViewStyle(m_listCtrl,LVS_EX_GRIDLINES | \
LVS_EX_FULLROWSELECT | LVS_EX_TRACKSELECT);
CListCtrl* m_pListCtrl_3;
m_pListCtrl_3 = (CListCtrl* ) GetDlgItem(IDC_LIST1);
m_pListCtrl_3->UpdateData(TRUE); // not fixed into table
m_pListCtrl_3->UpdateData(true); // not fixed into table
m_pListCtrl_3->Update(true); // not fixed into table!
|
|
|
|
|
You should use ADO Recordset 's [^] methods to update the table. CListCtrl::UpdataData (i.e. CWnd::UpdateData [^]) has nothing to do with the database).
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]
|
|
|
|
|
I write a MapEditor and implement PSSM(Parallel-Split Shadow Maps into my MapEditor(DirectX9, VC++). My lowerclassman write a game with DirectX9 and VC++. I implement PSSM into his game, but the shadow seems to have some alisings in his game. We use the same camera parameter (excludes the camera position and look at). His game use deferred shading to render the scene. I restore the screenshots of ours as below:
lowerclassman's game::
http://cid-fbeb6373d9321a7f.skydrive.live.com/self.aspx/Questions/pssm%20flag%20error.JPG
my mapeditor:
http://cid-fbeb6373d9321a7f.skydrive.live.com/self.aspx/Questions/pssm%20flag%20right.JPG
Could somebody know the cause of the difference of ours? And how to I solve this problem?
|
|
|
|
|