|
I want to draw the caption area by myself,but the system will draw it when needed.How can I do?
thank you!
Don't look at me in that way!
|
|
|
|
|
http://www.codeproject.com/gdi/customcaption.asp
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
thanks!
but can you give me easy way to stop windows draw the titlebar.
the code of customcaption is so long!
Don't look at me in that way!
|
|
|
|
|
Do I have always to call the CException::Delete method to make sure that it is always deleted?
Best regards,
Alexandru Savescu
|
|
|
|
|
If you get a reference to an CException object you should call Delete() to prevent memory loss.
Vezi ca e important cum construiesti obiectul ala
CException( BOOL b_AutoDelete );
... asa pe romaneste
Bye,
Orbital^
...the night is long ... but not long enought to do some real coding ...
|
|
|
|
|
I think we should post in English only.
I catch a pointer to a CDBException that I didn't create myself, it was thrown by MFC like this:
try
{
}
catch (CDBException* e)
{
}
Best regards,
Alexandru Savescu
|
|
|
|
|
You have to always delete exception, when you catch it as pointer to it.
|
|
|
|
|
Martin Ziacek wrote:
You have to always delete exception, when you catch it as pointer to it.
I thought so. Thanks!
Best regards,
Alexandru Savescu
|
|
|
|
|
1.I want to create two menus in the menubar,and which have different handles.
2.Can i prevent redrawing menubar?I don't want it redraw so much often.
|
|
|
|
|
Hi,
I would like dynamically change a caption in my SDI application (CFrame). I'm trying this (in OnInitialUpdate):
m_pMainFrame = (CMainFrame*)AfxGetApp()->m_pMainWnd;
m_pMainFrame->SetWindowText("Some caption");
But it still go bad.
Can anybody tell me something about this?
Thanks
defox
|
|
|
|
|
You can put this your CMainframe class in your OnCreate .
SetWindowText("some caption");
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
Or you could try that. lol
Mazdak wrote:
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
I'v been a big Metallica fan since Kill'em All days.
|
|
|
|
|
OnInitialUpdate is a virtual function of CView and CView doesn't know who m_pMainFrame is. Here is something you can try though I still don't think it will change the caption (I'm taking it as the titlebar).
<br />
CMainFrame * pFWnd = (CMainFrame *)AfxGetMainWnd();<br />
pFWnd->SetWindowText("Some Caption");<br />
If it was me, I would add a function to the CDocument class or any class you want to change the caption to what ever you liked. Off the top of my head like so...
int ChangeCaption(CString string)
{
CMainFrame * pFWnd = (CMainFrame *)AfxGetMainWnd();
pFWnd->SetWindowText(string);
}
and use the int to check if any error occured. SetWindowText should return a value - Off my head I can't remember what though.
Cheers
Jay Beckert
|
|
|
|
|
#include <windows.h>
int WINAPI WinMain(HINSTANCE hInst,
HINSTANCE hPrevInst,
LPSTR szCmdLine,
int nCmdShow)
{
HWND hWnd;
WNDPROC WndProc;
(VOID)hPrevInst;
(VOID)szCmdLine;
(VOID)nCmdShow;
hWnd=CreateWindowEx(0,"EDIT","Test",WS_POPUP | WS_BORDER | WS_VISIBLE,
CW_USEDEFAULT,CW_USEDEFAULT,
CW_USEDEFAULT,CW_USEDEFAULT,
NULL,(HMENU)NULL,hInst,NULL);
if (hWnd)
{
WndProc=(WNDPROC)GetWindowLongPtr(hWnd,GWLP_WNDPROC);
SetWindowLongPtr(hWnd,GWLP_WNDPROC,(LONG_PTR)WndProc);
}
DestroyWindow(hWnd);
}
I have been updating some old code to allow for 64bit compatibilty I followed an article on MSDN which explained the correct way to convert from GetWindowLong() to GetWindowLongPtr() but I am getting the following compiler warnings.
GetWindowLongPtr - c:\temp\test\test.c(18) : warning C4312: 'type cast' : conversion from 'LONG' to 'WNDPROC' of greater size
SetWindowLongPtr - c:\temp\test\test.c(19) : warning C4244: 'function' : conversion from 'LONG_PTR' to 'LONG', possible loss of data
Can anybody please help me out?
Steve.
Systems AXIS Ltd - Software for Business ...
|
|
|
|
|
Is a LONG 64 bits in Win64 (and in the extension, at the point you try to use it)? A little printf-debugging with sizeof can surely say if it's your code, or if MS once again messed up. My bet is on the latter.
|
|
|
|
|
Hi, in a dialog control , i have 3 sliders, each of them is to do some specific task. I'm aware that everytime i move the slider it calls the message called WM_HSCROLL , and WM_VSCROLL for vertical one. But the problem is how do i identify these controls in the OnHscroll handler? There is a parameter called CScrollBar pointer is passed in too but how do u used this?
Thanks
|
|
|
|
|
tcuong wrote:
But the problem is how do i identify these controls in the OnHscroll handler?
If you use VC6 with classwizard you can define controller for them and identify them whenever you want in your dialog class.
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
how do u do so, i've looked at the classwizard for those control but there r only 3 message which is OUTOFMEMORY, RELEASEDCAPTURE and CUSTOMDRAW. Thanks
|
|
|
|
|
Go to classwizard.(press CTRL+W) Go to Member Variable tab.
In the Class name box, click the CYourclass .
In the Control IDs box, click IDC_YOURID .
In the Category box change Value and then enter name of your control and click ok.With that name you can use your controler.Understand?
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
Hi !
I have the following question : I have 2 machines A and B in the same workgroup and I have a DCOM server at machine A . I'm logging at A and B with different passwords , the probelm is that CoCreateInstanceEx succeds at B but I cannot call any methods of the created DCOM object .(security error 0x80070005)
How could I configure the DCOM sever and Client to work?
I tried DCOMCNFG to allow Everyone to access and launch but it's still not working
Thanks
Jancsi
xxx
|
|
|
|
|
I use a component that returns errors using the ISupportErrorInfo. I create this component inside another component and I can not access the error Description using the code below:
CoInitialize(NULL);
if (FAILED(CoCreateInstance(CLSID_AppSrv, NULL, CLSCTX_ALL,
IID_IAppSrv, (void**)&pAppSrv)))
{
::SysFreeString(bstrInCall);
return;
}
hResult = pAppSrv->DispatchService3(bstrInCall , &vResponse);
if (hResult == S_OK)
*szXMLResponse = vResponse.bstrVal;
else
{
HRESULT hr=S_OK;
IErrorInfo *err;
BSTR str;
hr = GetErrorInfo(0, &err);
if (FAILED(hr))
{
*szXMLResponse = "<error>Unable To Retrieve Error Message";
return;
}
hr = err->GetDescription(&str);
if (SUCCEEDED(hr))
{
CString szTemp;
szTemp = "<error>003 <description>";
szTemp += str;
szTemp += "";
SysFreeString(str);
*szXMLResponse = szTemp;
}
err->Release();
}
Note that GetErrorInfo never fails but GetDescription always fails. Note that this happens when both the components are installed into 2 different packages in the COM+. Also the threading model of the component that produces the error is Apartment while the threading model of the component that fails to access the error is Neutral.
Spiros Prantalos
|
|
|
|
|
What do you do on server side?
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
The STA component is a gate to some services. The Neutral component actually accesses these services. The peculiar case is that if I will take the neutral component outside the COM+ it will retrieve the error info raised by the first component
Spiros Prantalos
|
|
|
|
|
First, you should check for S_FALSE from your call to GetErrorInfo(). S_FALSE means that there was no error info to return.
Second, I don't know exactly what you want. Are you sure the server sets the error info?
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
Ok let me be more specific.
1. I am sure that the component sets the info in the IerrorInfo for 2 reasons:
a. I can receive them and display them from an ASP page
b. I can receive them and display them from the debug program of the second component
as long as the second component is not inserted in the COM+. In other words using
either the debug or the release version of the second component I can receive the
err->GetDescription(&str) never fails. On the contrary when the com is inserted
in the COM+ the same method fails. The error number that I receive in the HRESULT
id -2147417842 and unfortunately does not correspond to a common error code.
2. The whole idea is like this:
COM2<------>COM1<------>SERVICES
COM1 and COM2 live in different packages of the COM+. COM1 is the gate to some
services. COM2 and COM1 are both declared as server in the COM+. COM2's threading
model is Neutral while COM1's threading model is Apartment.
The weird phenomenon in that case is that everything fails only if they are both in the the COM+. Thank you for your time.
Spiros Prantalos
|
|
|
|