|
Add ole32.lib to your TESTps.mk link build rule. It should look something like:
TESTps.dll: dlldata.obj TEST_p.obj TEST_i.obj
link /dll /out:TESTps.dll /def:TESTps.def /entry:DllMain dlldata.obj TEST_p.obj TEST_i.obj \
kernel32.lib rpcns4.lib rpcrt4.lib ole32.lib oleaut32.lib uuid.lib \
|
|
|
|
|
I attached tooltips to buttons derived from CWnd. Tooltips are shown only when EnableWindow( false) of selected button. How can I enable tooltips for buttons which have EnableWindow( true) ?
Hans
---------------
ON_NOTIFY_EX( TTN_NEEDTEXT, 0, OnToolTipNotify)
BOOL CKurzzeitDlg::OnToolTipNotify( UINT id, NMHDR * pNMHDR, LRESULT * pResult )
{
TOOLTIPTEXT *pTTT = (TOOLTIPTEXT *)pNMHDR;
CString csTipText;
UINT nID =pNMHDR->idFrom;
if (pTTT->uFlags & TTF_IDISHWND)
{
// idFrom is actually the HWND of the tool
nID = ::GetDlgCtrlID((HWND)nID);
if(nID)
{
// Select which Control has been hit by cursor
switch( nID)
{
case IDC_BUTTON1:
csTipText = "My Text";
break;.... }
m_Button.EnableWindow( false); -> I´ll have Tooltips
m_Button.EnableToolTips( true);
m_Button.EnableWindow( true); -> No Tooltips are shown
|
|
|
|
|
Did you set the Notify style for each of the buttons in the dialog editor?
Roger Allen the man
|
|
|
|
|
Can you please give me source code for the second way?I'm loading items from a database
|
|
|
|
|
Basically, you want to avoid copying text during combobox load. Each item is marked as 'callback' - whenever combo actually needs the text (when it needs to repaint or show the dropdown list), it will ask your app. The loading is simple - you just pass LPSTR_TEXTCALLBACK as item text.
COMBOBOXEXITEM cbitem;
cbitem.mask = CBEIF_TEXT;
imax = ...;
for (int i = 0; i < imax; i ++)
{
cbitem.iItem = i;
cbitem.pszText = LPSTR_TEXTCALLBACK;
m_cbx.InsertItem(&cbitem);
}
Then, you should handle CBEN_GETDISPINFO notification in the parent window (probably this will be a dialog, property page or formview). Use ClassWizard to add the appropriate handler.
void CYourDialog::OnGetdispinfoNodeType(NMHDR* pNMHDR, LRESULT* pResult)
{
NMCOMBOBOXEX *pNMCBX= (NMCOMBOBOXEX *)pNMHDR;
pNMCBX->ceItem.pszText = someTable[pNMCBX->ceItem.iItem];
*pResult = 0;
}
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Does anyone know how to find installed application on computer, like application listed in Add/Remove programs icon.
Thank's a lot.
|
|
|
|
|
Look up this Registry Key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
Nish
|
|
|
|
|
Add/Remove stores the list in the Registry. You can read from the same location to find the apps installed.
On 2000 the path is:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
Deepak Khajuria
|
|
|
|
|
Ok,
Thank's a lot everybody.
But now my other problem is how to find "the start program file" for each entry (i have just the uninstall program in this registry key).
Sorry for my english
|
|
|
|
|
Uninstall branch in the registry doesn't contain filenames of application itself - note that sometimes one uninstall removes more than one .exe.
Depending on your definition of 'installed applications' you should look elsewhere. Maybe you should just scan the start menu?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Could you tell me how scan the start menu ?
Thank's in advance
|
|
|
|
|
if I send an email with a *.jpg attachmen ,the route I must follow ,
1,I open the jpg file in binary mode;
2,I must call CBase64::Encode() to encode the attachment;
3,send the email.
4,when I receive the email,I muse call
CBase64::Decode() to decode the attachment.
what I say is right?
any suggetion?
now where can I get the standard class CBase64?
thank you in advance!
|
|
|
|
|
I did a similar thing to send binary files as attachments in a project of mine. I did it by overriding the CDocument::OnFileSendMail(0 function and adding code to modify what the attachments are etc.
I have included the function here in its entirity, some of the stuff may not be relevant to your problem.
void CRefinementProDoc::OnFileSendMail()
{
ASSERT_VALID(this);
ASSERT(_afxIsMailAvail);
CWaitCursor wait;
_AFX_MAIL_STATE* pMailState = _afxMailState;
if (pMailState->m_hInstMail == NULL)
pMailState->m_hInstMail = ::LoadLibraryA("MAPI32.DLL");
if (pMailState->m_hInstMail == NULL)
{
AfxMessageBox(AFX_IDP_FAILED_MAPI_LOAD);
return;
}
ASSERT(pMailState->m_hInstMail != NULL);
ULONG (PASCAL *lpfnSendMail)(ULONG, ULONG, MapiMessage*, FLAGS, ULONG);
(FARPROC&)lpfnSendMail = GetProcAddress(pMailState->m_hInstMail, "MAPISendMail");
if (lpfnSendMail == NULL)
{
AfxMessageBox(AFX_IDP_INVALID_MAPI_DLL);
return;
}
ASSERT(lpfnSendMail != NULL);
TCHAR szTempName[_MAX_PATH];
TCHAR szPath[_MAX_PATH];
BOOL bRemoveTemp = FALSE;
if (m_strPathName.IsEmpty() || IsModified())
{
CString old_filename ;
CString old_path ;
VERIFY(GetTempPath(_countof(szPath), szPath) != 0);
if (DatasetType == TYPE_DATASET)
{
old_filename = pntr->m_Filename ;
old_path = pntr->m_Path ;
sprintf(szTempName, "%s%s", szPath, pntr->m_Filename) ;
}
else
{
old_filename = mpntr->m_Filename ;
old_path = mpntr->m_Path ;
sprintf(szTempName, "%s%s", szPath, mpntr->m_Filename) ;
}
m_sending_as_attachment = TRUE ;
BOOL bModified = IsModified();
BOOL bResult = DoSave(szTempName, FALSE);
SetModifiedFlag(bModified);
if (!bResult)
{
TRACE0("Warning: file save failed during File.Send Mail.\n");
return;
}
bRemoveTemp = TRUE;
m_sending_as_attachment = FALSE ;
if (DatasetType == TYPE_DATASET)
{
pntr->m_Filename = old_filename ;
pntr->m_Path = old_path ;
}
else
{
mpntr->m_Filename = old_filename ;
mpntr->m_Path = old_path ;
}
SetPathName(old_path + "\\" + old_filename, FALSE) ;
}
else
{
lstrcpyn(szTempName, m_strPathName, _countof(szTempName));
}
#ifdef _UNICODE
char szTempNameA[_MAX_PATH];
_wcstombsz(szTempNameA, szTempName, _countof(szTempNameA));
#endif
TCHAR szTitle[_MAX_PATH];
if (!m_strPathName.IsEmpty())
AfxGetFileName(m_strPathName, szTitle, _countof(szTitle));
else
{
lstrcpyn(szTitle, m_strTitle, _countof(szTitle));
if (m_strTitle.Find('.') == -1)
{
CString strExt;
CDocTemplate* pTemplate = GetDocTemplate();
if (pTemplate != NULL &&
pTemplate->GetDocString(strExt, CDocTemplate::filterExt))
{
lstrcat(szTitle, strExt);
}
}
}
#ifdef _UNICODE
char szTitleA[_MAX_PATH];
_wcstombsz(szTitleA, szTitle, _countof(szTitleA));
#endif
MapiFileDesc *fileDesc;
int num_attachments = 1 ;
if (DatasetType == TYPE_DATASET)
{
fileDesc = new MapiFileDesc ;
}
else
{
fileDesc = new MapiFileDesc[1 + mpntr->no_in_use] ;
num_attachments = 1 + mpntr->no_in_use ;;
}
memset(fileDesc, 0, sizeof(MapiFileDesc) * num_attachments);
fileDesc[0].nPosition = (ULONG)-1;
char szPathAM[MAX_DATASETS_PER_MULTI][_MAX_PATH];
char szTitleAM[MAX_DATASETS_PER_MULTI][_MAX_PATH];
#ifdef _UNICODE
fileDesc[0].lpszPathName = szTempNameA;
fileDesc[0].lpszFileName = szTitleA;
#else
fileDesc[0].lpszPathName = szTempName;
fileDesc[0].lpszFileName = szTitle;
#endif
if (DatasetType == TYPE_MULTISET)
{
for (int i = 0 ; i < mpntr->no_in_use ; i++)
{
fileDesc[i + 1].nPosition = (ULONG)-1 ;
#ifdef _UNICODE
CString temp_string ;
temp_string = mpntr->pntr[i]->m_Path + "\\" + mpntr->pntr[i]->m_Filename ;
_wcstombsz(szPathAM[i], temp_string, _countof(temp_string));
_wcstombsz(szTitleAM[i], mpntr->pntr[i]->m_Filename, _countof(mpntr->pntr[i]->m_Filename));
fileDesc[i + 1].lpszPathName = szPathAM[i] ;
fileDesc[i + 1].lpszFileName = szTitleAM[i] ;
#else
sprintf(szPathAM[i], "%s\\%s", mpntr->pntr[i]->m_Path, mpntr->pntr[i]->m_Filename) ;
sprintf(szTitleAM[i], "%s", mpntr->pntr[i]->m_Filename) ;
fileDesc[i + 1].lpszPathName = szPathAM[i] ;
fileDesc[i + 1].lpszFileName =szTitleAM[i] ;
#endif
}
}
MapiMessage message;
memset(&message, 0, sizeof(message));
message.nFileCount = num_attachments;
message.lpFiles = fileDesc;
AfxGetApp()->EnableModeless(FALSE);
HWND hWndTop;
CWnd* pParentWnd = CWnd::GetSafeOwner(NULL, &hWndTop);
pParentWnd->SetCapture();
::SetFocus(NULL);
pParentWnd->m_nFlags |= WF_STAYDISABLED;
int nError = lpfnSendMail(0, (ULONG)pParentWnd->GetSafeHwnd(),
&message, MAPI_LOGON_UI|MAPI_DIALOG, 0);
::ReleaseCapture();
pParentWnd->m_nFlags &= ~WF_STAYDISABLED;
pParentWnd->EnableWindow(TRUE);
::SetActiveWindow(NULL);
pParentWnd->SetActiveWindow();
pParentWnd->SetFocus();
if (hWndTop != NULL)
::EnableWindow(hWndTop, TRUE);
AfxGetApp()->EnableModeless(TRUE);
if (nError != SUCCESS_SUCCESS &&
nError != MAPI_USER_ABORT && nError != MAPI_E_LOGIN_FAILURE)
{
AfxMessageBox(AFX_IDP_FAILED_MAPI_SEND);
}
delete []fileDesc ;
if (bRemoveTemp)
CFile::Remove(szTempName);
}
Not sure if it will help out.
Roger Allen the man
|
|
|
|
|
Here is a class that can en/decode Base64...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
|
Hi,
I have to solution in my project. Use CListView or MSFlexGrid.
The project is to display a automation in execution.
My problem is How can I do for to do this :
1/ I have 10 playlist. Each playlist have 1, 2 or 3 functions.
=> I would like to display each playlist with a color. So, if one function -> One line, if two functions -> two lines , ...
2/ I would like to design a rectangle for distinging the playlist in the automation
So, if anyone can help me.
Best regards
youssef
|
|
|
|
|
|
hiya ..
wanna customize my projects makefile by specufying some other CPU type else than x86 .. and use NMAKE for it ..... how can i customize the makefile to achieve this ..
Thanks in advance .....
Farid ....
|
|
|
|
|
- How to change one font to another system-defined font?
- How to restore a font ?
- Can you help?
-Regards,
Maer
|
|
|
|
|
Where do you want to change the font ? System wide ? In a control ?
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
|
|
|
|
|
- Thanks pal!
- I simply want to get the general codes for changing font. It is not for specific use.
- Can you help? Can you show me an example?
-Regards,
Maer
|
|
|
|
|
Try this article,
Automatic Font Handling Class in Fonts & GDI >> GDI Objects
Jonathan de Halleux, Belgium.
|
|
|
|
|
- Thanks pal!
- Your reply clarifies my doubts.
- Regards,
Maer
|
|
|
|
|
- From MSDN it is said,
... A call to TlsAlloc() returns a global TLS index. This one TLS index is valid for every thread within the process that allocated it ...
... when TlsAlloc() is called, every thread within the process has its own private ULONG_PTR-sized space reserved for it (in its stack space, but this is implementation-specific) ...
- Suppose in a case, when thread A1 loads Dll B, and Dll B allocates a TLS in thread A1. And there are 2 threads in process P, thread A1 and thread A2. So when Dll B allocates a TLS in thread A1, thread A2 is also allocated a TLS with the same index. So we have 2 TLSs with the same index now.
- Am I right? But I think the TLS in thread A2 is useless place. (Suppose only thread A1 access Dll B)
- Can you help?
- Best regards,
Maer
|
|
|
|
|
Basically, you're right. The TLS slot alloated in A2 is useless if A2 does not use the same data items as A1.
The reason for this is this. Suppose you want to save the creation time for each thread in your process. And for the sake of completeness we can do the saving in a DLL. When the DLL loads it calls TlsAlloc and saves the returned index in a global variable (e.g. g_iTlsIndex). Now, as each thread is created it can save the creation time in the TLS slot with index g_iTlsIndex - the same index but a unique memory location for each thread. Of course, if your threads are totally unrelated and does totally different things they will probably not have the need for common TLS indices. But you got at least 64 TLS slots available, so you can use new one for each thread type.
TLS, DLLs and multithreading programming is described in great detail in Richters "Advanced Windows". I for (i=0; i<A_WHOLE_LOT;i++, printf("really ")); recommend you get a copy if you're doing MT programming. It's worth every dime.
Cheers
Steen.
"To claim that computer games influence children is rediculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|