|
What about using the bullet character if your font supports it. • Like so. It's alt + 0149 or U+2022. Else you'll have to draw one yourself using GDI.
|
|
|
|
|
I have one function with 3 parameters.
In that function I have one switch case statement which depends on first parameter of my function. Nearly the cases are 28 to 30. For each case there is another sub switch case which depends on the second parameter of my function with more cases. For different cases I am allocating different classes memory in one class object. At last the function returning that object. For this concept implementation is there any simple implementation or any other logic, any template. The cases are increasing because of new implementations. Expecting some better solution.
The sample code is:
CMyCls* CEmr:GetCls(DWORD dwDId, DWORD dwClsId,BOOL bFe)
{
CMyCls* pCls = NULL;
switch (m_byClsFamily)
{
case _FAMILY_1_:
switch (dwClsId)
{
case 0x8242:
if (bFe || (dwDId == DB_18C453))
pCls = new CMyCls1;
break;
case 0x8252:
if (bFe || (dwDId == DB_18C452))
pCls = new CMyCls2;
break;
...
...
}
break;
case _FAMILY_2_:
...
case _FAMILY_3_:
...
case _FAMILY_4_:
...
...
break;
}
return pCls;
}
Here All CMyCls1, CMyCls2, CMyCls3, CMyCls4,... all are derived from a class named "CMyCls".
Any help very thankful to them. It is urgent.
Nice talking to you.
|
|
|
|
|
IIRC, Andrei Alexandrescu's "Modern C++ Design ..." has a dedicated chapter to double/multiple dispatch using templates, you might want to have a look at it.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hi
I have asked the same question but I didn't get any satisfactory answer, so I am again posting it here....
I have a dialog based MFC application in which I have used Microsoft Web Browser ActiveX control through which I allow user to navigate the sites.
Now if I want to hide cursor, I have used SetCursor(NULL) and also tried ShowCursor(FALSE) but the problem is : When I move my mouse with little bit of speed, it shows cursor and then again hides...what seems to be the problem, HOw to overcome it ?
Or is there a way to disable mouse ? So I don't have problem of hiding cursor.
Thankx in Advance
Amarelia Maehsh
Gujarat
India
|
|
|
|
|
Since your trying to take complete control over the system, you should act like it. You have to be firm. I'd say set up a system wide hook listening to WM_MOUSEMOVE messages, and just throw them all away. The cursor should no longer move. Look at SetWindowsHookEx(), remember your message pump must reside outside your application in a DLL if it's going to be global.
|
|
|
|
|
In my MFC application, I create a series of 4 dialog windows all idential (an array of dialogs).
Now I play a different video on each dialog on an Animate control.
For Dialog 1 (index 0) - see code below:-
CAnimateCtrl m_screen;<br />
HWND hMCI[4] = {NULL, NULL, NULL, NULL};<br />
<br />
hMCI[0] = MCIWndCreate(m_screen, AfxGetApp()->m_hInstance, MCIWNDF_SHOWALL | MCIWNDF_NOMENU | MCIWNDF_NOOPEN | MCIWNDF_NOPLAYBAR, "animation.mpg");
PlayVideo(0);<br />
<br />
<br />
<br />
if(hMCI[index])<br />
{<br />
MCIWndClose (hMCI[index]);<br />
m_MainText.ShowWindow (SW_SHOW); <br />
playVideo = true;<br />
displayed = false;<br />
m_screen.ShowWindow (SW_HIDE); <br />
}<br />
<br />
void CEmuDlg::PlayVideo(short index)<br />
{<br />
if(playVideo)<br />
{<br />
m_MainText.ShowWindow (SW_HIDE);<br />
m_screen.ShowWindow (SW_SHOW); <br />
::ShowWindow(hMCI[index],SW_MAXIMIZE);<br />
MCIWndPlay(hMCI[index]);<br />
<br />
MCIWndSetRepeat(hMCI[index],TRUE);
playVideo = false;<br />
}<br />
else<br />
{<br />
MCIWndPause(hMCI[index]);<br />
m_screen.ShowWindow (SW_HIDE); <br />
playVideo = true;<br />
if(!m_pClear.GetCheck ())<br />
m_MainText.ShowWindow (SW_SHOW);<br />
}<br />
}
Now the video only plays on a single dialog window. Do I need to do anything else to allow a different video play on dialog 3 say at the same time.
Can I only play on video per application?
|
|
|
|
|
Good day,
I have two dialogs. The MainDialog and WelcomeDialog.
WelcomeDialoghas a progress bar and MainDialog has
the initialization in which this initialization status is
shown in WelcomeDialog progressbar. I have a function in
WelcomeDialog IncreaseProgressBarStep(int step) which is
public so MainDialog can access it.
Here is what i wanted to do.
MainDialog::OnInitDialog()
{
WelcomeDialog childDlg;
childDlg.DoModal();
->InitializationStatement....
childDlg.IncreaseProgressBarStep(10);
InitializationStatement....
childDlg.IncreaseProgressBarStep(10);
............(until all initialization is done)
done initialization here....
}
The problem with this code is that the code with ->InitializationStatement will not be called
unless the childDlg is exited, thus childDlg.IncreaseProgressBarStep will be useless.
How can we communicate the two dialogs so that WelcomeDialog will stay on the screen while
whole initilization is not yet done.
Thanks and More Power!
|
|
|
|
|
Anonymous wrote:
The problem with this code is that the code with ->InitializationStatement will not be called
unless the childDlg is exited
Of course, this is logical. DoModal is a blocking call that will return the return code of closing the dialog. If you want to have childDlg 'not blocking' you will have to make it modeless. That is, maitaint a member variable in MainDialog and show the window. Take a look at this article[^]. It will help you to understand how it works.
|
|
|
|
|
Thanks. It does what I need.
More Power!
|
|
|
|
|
Hi all,
can someone tell me which open source reporting tools can i used for MFC program?
the reporting tools i knw was crystal report but this is not open source! then the jasperReport is java based right!
Please help me! thanks!
Rgds,
bryan
|
|
|
|
|
How to create Log File in c++ . How to pick up server date and time in c++/VC++ ....
|
|
|
|
|
|
|
I am programming Socket with SSL on server side. The following code depicts how
I m reteriving certificate from a store and obtaining credentials for
schannel.I am getting problem in obtaning credential handle ie AcquireCredentialshandle returns SEC_E_INTERNAL_ERROR
#define ENCODING_TYPE (PKCS_7_ASN_ENCODING | X509_ASN_ENCODING)
TimeStamp tsExpiry;
SECURITY_STATUS Status;
CERT_RDN cert_rdn;// structure to obtain certificate using RDN
attributes
//containing structure CERT_RDN_ATTR
CERT_RDN_ATTR cert_rdn_attr;// structure for one attribute of RDN ie
//Common Name
//only one attribute of RDN is used to find certificate
cert_rdn.cRDNAttr = 1;//only one CERT_RDN_ATTR
cert_rdn.rgRDNAttr =&cert_rdn_attr;//pointer to CERT_RDN_ATTR the
//structure contains 1 attribute
const TCHAR * pszUserName=_T("SNS");//Common Name is SNS
cert_rdn_attr.pszObjId = szOID_COMMON_NAME;//go for Common Name
//attribte in RDN
cert_rdn_attr.dwValueType = CERT_RDN_ANY_TYPE;
cert_rdn_attr.Value.cbData = _tcslen(pszUserName);//length of //Common
Name
#ifdef _UNICODE
char *pszUn = new char[wcslen(pszUserName)+1];
WideCharToMultiByte(CP_ACP,0,pszUserName,-1,pszUn,wcslen(pszUserName)+1,NULL,NULL);
cert_rdn_attr.Value.pbData = (BYTE *)pszUn;
#else
cert_rdn_attr.Value.pbData = (BYTE *)pszUserName;
#endif
//search for the certificate in the certificate store
PCCERT_CONTEXT m_pCertContext;
m_pCertContext =
CertFindCertificateInStore(m_hMyCertStore,
ENCODING_TYPE,
0,//use default values
CERT_FIND_SUBJECT_ATTR,
&cert_rdn,
NULL);
#ifdef _UNICODE
delete [] pszUn;
#endif
//If the function fails and a certificate that matches the search
criteria is not //found,the return value is NULL
if(m_pCertContext == NULL &&::GetLastError()==CRYPT_E_NOT_FOUND)
{
::OutputDebugString(_T("error:"));
}
::OutputDebugString(_T("pointer to the certificate context is
available"));
SCHANNEL_CRED m_SchannelCred;
SecurityFunctionTable m_SecurityFunc;
CredHandle m_hCreds;
PCredHandle phCreds=&m_hCreds//pointer to the credential handle
ZeroMemory(&m_SchannelCred, sizeof(m_SchannelCred));
//Credentials are required by the Schannel authentication
m_SchannelCred.dwVersion = SCHANNEL_CRED_VERSION;
m_SchannelCred.cCreds = 1;//only one certificate store
m_SchannelCred.paCred = &m_pCertContext;//pointer to the pointer of
//CERT_CONTEXT structure this how the certificate enters the credential
//which is used for security context in schannel authentication
m_SchannelCred.hRootStore = m_hMyCertStore;//handle to certificate
store
m_SchannelCred.dwMinimumCipherStrength = 80;//strength of cipher
DWORD m_dwProtocol=0;//use any protocol
m_SchannelCred.grbitEnabledProtocols = m_dwProtocol;//use any protocol
m_SchannelCred.dwFlags |= SCH_CRED_NO_SYSTEM_MAPPER ;
//function, which returns a handle to the requested credentials
Status = m_SecurityFunc.AcquireCredentialsHandle(
NULL, // Nameof principal
UNISP_NAME,//schannel package
SECPKG_CRED_INBOUND,
NULL,
&m_SchannelCred,
NULL,
NULL,
phCreds
&tsExpiry);
//here i refered MSDN for returned Status and put different values of
Status //check the exact cause for error and i found the returned value
of Status is
//SEC_E_INTERNAL_ERROR
if(Status != SEC_E_OK &&Status==SEC_E_INTERNAL_ERROR)
{
::OutputDebugString(_T("error channel credentials"));
}
::OutputDebugString(_T("handle to channel credential is available"));
//Pls help me.Thanx in advance for any suggestion.
-- modified at 3:32 Friday 30th September, 2005
|
|
|
|
|
I am writing a CAD program that requires floating points to draw lines and cirlces in which using DirectX or OpenGL is muct easier. After that, I need to get the pixel data from the drawing for analysis. Does anyone know how to get these data? Or other method other than the DirectX or OpenGl?
Max
-- modified at 3:23 Friday 30th September, 2005
|
|
|
|
|
Render to texture, then get the juicy bits.
http://developer.nvidia.com/object/ogl_rtt.html
http://www.riaz.de/tutorials/d3d16/d3d16.html
Regards,
BB
http://spin.neostrada.pl
|
|
|
|
|
Is there a way to manage the printer spool for adding documents in stand-by mode, remove them when necessary, ... ?? I'm wondering if there's a way to do that not depending onto the printer selected.
Thanks in advance,
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
Hi,
I am asking something different. I need Win98 DDK (Driver development kit). can you send it to me if it is unlicenced. I didn't find it any where and need it urgently. yaa Win2000 DDK may also do.
|
|
|
|
|
I dont' think anybody can help you..All DDk's are now part of MSDN subscription..Moreover, MS discourages sticking to Win98 DDK..
|
|
|
|
|
Hi,
I am getting the following error, while i filter the process using Createprocess API.
---------------------------
E:\__MyFolder\__Testing\HookApp\1.htm
---------------------------
Windows cannot find 'E:\__MyFolder\__Testing\HookApp\1.htm'. Make sure you typed the name correctly, and then try again. To search for a file, click the Start button, and then click Search.
---------------------------
OK
---------------------------
I need it to be hide this error message or don't show it to user. How could I do this. Anyone help me.
Be simple and Be sample.
|
|
|
|
|
I am not sure I understand exactly what you want, but you may consider one of the following:
- if the path is to be passed as a string to some function, then use two backslashes instead of one
- if you do not want to show the error message, you may try to use a try-catch block and treat the error yourself.
SkyWalker
|
|
|
|
|
Hello...I am trying to develop FTP application with SSL security layer.
Base on your article on CAsyncSocketEx, I do not understand how to change the CAsyncSocket to CAsyncSocketEx? Do I have to change other files besides to change CAsyncSocket occurences to CAsyncSocketEx?
Please Help me.
This is my alternate email : hanan6014@yahoo.com
But still...i am in the process of studying those code for FTP application Server and Client.
Thanks.
|
|
|
|
|
Friends,
I'm developing an application in which i've used bitmaps to fill the dialog boxes.I've added the bitmaps using the OnEraseBkgnd function and set the background of the controls in the dialog box in the OnCtlColor function.the problem what i'm facing now is,i've few radio buttons and group boxes in the dialog boxes ,the background of the text what they(radio buitton & group box) display is always GRAY and i'm not able to change it.
Is there any method using which i can change the background colour of the radiobuttons text?it would be great if someone can help me out in this.thank you.
NOTE:I've tried using SetTextColor & SetBkColor functions.
|
|
|
|
|
rajeev82 wrote:
Is there any method using which i can change the background colour of the radiobuttons text?it would be great if someone can help me out in this.thank you.
Actually Radio, Check Boxes and Button all share comon class with diffrent style, now for changing color of Button control you have to make them owner drawn and then darw accroding on you dialog Box... or look for alternative bitmap supporting button class.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
U have got he righ question for me?
I have just done some R&D on this topic .
Do one this add this message handler to your
code WM_CTLCOLOR
IN the Code
By the Controls Resource ID get the
pointer to that control's window
and then send
pDC->SetBkMode(TRANSPARENT);
message to the control
remember to set the HBRUSH as NULL by
adding this line
hbr = (HBRUSH)GetStockObject( NULL_BRUSH );
// if u dont set this then the label will not be trasparent
if u are not able to get me then i send u the code
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|