|
i want to specify the caption of the owner draw button at design time.
|
|
|
|
|
Place your caption in the resource file (as with a classic button), then extract your text at runtime using GetWindowText. With an owner-drawn button, you will need to draw the text yourself.
Regards,
BB
http://spin.neostrada.pl
|
|
|
|
|
Hello,
I am developing an USB pen drive app,
the program works well with XP(or 2000) administrative privileges,
but it doesn't work without it,
because the way I get the drive handle is(suppose the usb pen drive is E:\):
HANDLE hDevHandle;
char szDrive[]= "\\\\.\\E:";
hDevHandle = CreateFile(szDrive,
GENERIC_WRITE | GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
0,
NULL);
CreateFile fail without administrative privileges,
following is the description of limitation from MSDN:
You can use the CreateFile function to open a physical disk drive or a
volume. The function returns a handle that can be used with the
DeviceIoControl function. This enables you to access the disk's partition
table. It is potentially dangerous to do so, since an incorrect write to a
disk could make its contents inaccessible. The following requirements must be
met for such a call to succeed:
1.The caller must have administrative privileges.
2.The dwCreationDisposition parameter must have the OPEN_EXISTING flag.
3.When opening a volume or floppy disk, the dwShareMode parameter must
have the FILE_SHARE_WRITE flag.
item 1 cause the fail,
How could I get drive handle without administrative privileges?
Thanks,
Chandler
|
|
|
|
|
|
can anyone tell me how to print in MFC
application
I have a public derived class whose
base class is CScrollView.
Have displayed some text on the view
want to just preview & print it on
the printer
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
Hi
I have used CBannerStatic Class functions and running my text horizontally like Banner.
Now I have two to three sentence and I want to show one Bullete (may be one filled dot/circle) then how to show it ?
Thankx
Amarelia Maehsh
Gujarat
India
|
|
|
|
|
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..
|
|
|
|