|
Nelek wrote: Can you put a bit of code where the error is coming?
DISP_PROPERTY_EX(CMyCtrl, "AutoChecking", GetAutoChecking, SetAutoChecking, VT_BOOL)
//=============================================
afx_msg void SetAutoChecking(BOOL bNewValue);
afx_msg BOOL GetAutoChecking();
//=============================================
void CMyCtrl::SetAutoChecking(BOOL bNewValue)
{
bAutoCheck = bNewValue;
SetModifiedFlag();
}
//=============================================
BOOL CMyCtrl::GetAutoChecking()
{
// TODO: Add your property handler here
return bAutoCheck;
}
//=============================================
dispidAutoChecking = 17L,
|
|
|
|
|
Change version of lib.
See MSDN[^] for more information.
Prasad
MS MVP - VC++
|
|
|
|
|
Is it possible for me to use GetControlUnkown() function of CWnd in a static library built with the option of not using MFC
Regards
|
|
|
|
|
Look in the MFC source code and see how it implements that function. MFC is, at its heart, a wrapper for the Win32 API.
Judy
|
|
|
|
|
I want to draw a calendar on desktop.
I use SPI_GETDESKWALLPAPER & SPI_SETDESKWALLPAPER to get & set the wallpaper. But I don't know how to create a bitmap with a specific path & how to copy a bitmap to another bitmap so that we can save the previous desktop. Until now, I just add bitmap to resource & use. So, I don't know how to do. S ome one plz help me ...
|
|
|
|
|
Take a look here[^]
Edit: Changed Link with more precise search
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
modified on Sunday, May 18, 2008 6:36 AM
|
|
|
|
|
If I can find, I won't ask you
|
|
|
|
|
capint wrote: If I can find, I won't ask you
If you don't say you have already searched we can not adivinate it.
By the way, in that results there are articles that use some things that you will need to make what you want. Just to explain all is a bit large to be done at once. Take a look on the articles, make tests and ask when you have problem in one section. You will easily get the help asking something concrete that you can't solve that something with so much information to be given as your first post.
capint wrote: how to copy a bitmap to another bitmap so that we can save the previous desktop
Take a look into the articles 2,3 and 4 of the search results I gave you. Make a screenshot can be more or less the same as getting the bitmap of the desktop.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Hello everyone,
I need for my program to store some results (recordings) into a database and then to access or search that recordings from/in DB.
I searched on Msdn but didn't find a concrete example. Has anyone an explicit easy to understand example?
I need to store: file names, size, last time modified, if readonly and other things.
the program is something like:
int main( void )
{
struct _finddata_t c_file;
intptr_t hFile;
// Find first .c file in current directory
if( (hFile = _findfirst( "*.c", &c_file )) == -1L )
printf( "No *.c files in current directory!\n" );
else
{
printf( "Listing of .c files\n\n" );
printf( "RDO HID SYS ARC FILE DATE %25c SIZE\n", ' ' );
printf( "--- --- --- --- ---- ---- %25c ----\n", ' ' );
do {
char buffer[30];
printf( ( c_file.attrib & _A_RDONLY ) ? " Y " : " N " );
printf( ( c_file.attrib & _A_SYSTEM ) ? " Y " : " N " );
printf( ( c_file.attrib & _A_HIDDEN ) ? " Y " : " N " );
printf( ( c_file.attrib & _A_ARCH ) ? " Y " : " N " );
ctime_s( buffer, _countof(buffer), &c_file.time_write );
printf( " %-12s %.24s %9ld\n", c_file.name, buffer, c_file.size );
} while( _findnext( hFile, &c_file ) == 0 );
_findclose( hFile );
}
}
Thanks very much!
|
|
|
|
|
All these examples and none of them come close to satisfying your request. Amazing.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
[DllImport("user32")] static int SendMessage(HWND^hwnd, int wMsg, int wParam, IntPtr^lParam);
How do I use this C# in C++?
|
|
|
|
|
|
I've been using XML to persist my data structures. But now as the amount of data I process and the small numbers of changes I make to the data...
Flushing it out as XML has become VERY TIME CONSUMING. At least it is in one 12MB file...
There must be a better way!
Any good alternatives out there?
- I would like to store "tree data" (maps within maps)
- I would like to have quick disk write for small changes...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<a href="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</a>
|
|
|
|
|
Hi
Can I change the title and icon of a given dialog box at run time?
Thanx
|
|
|
|
|
About the icon... I am not sure, but the title can be done with SetWindowText .
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Nelek already answered about the title. For the icon try
SetClassLong(hWnd, GCL_HICON, (LONG) hNewHicon);
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
|
|
|
|
|
But this is to be used once the dialog is already created and shown or by the creation? In a project I was changing icons as well but in the CChildFrm when creating the View, so with size and styles.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
CWnd::SetIcon()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<a href="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</a>
|
|
|
|
|
Or you can use of WM_SETTEXT and WM_SETICON.
|
|
|
|
|
Hi ,
i coded a working treeview(SDI/Windows Explorer Style), but hardly without icons, there is shown only one icon in my treeview.
Pic :
http://filehosting.at/images/download.php?file=b14ad20aa1a01412004995061e3202bb
I want to show the original explorer icons in my treeview so i tried it with
SHGetFileInfo()
...but it won't work
Here is some sample code (i don't want to post too much):
1. This function detects the drives and labels :
void CLeftView::CreateRoots()
{
CString strMessage;
int nPos = 65;
CString strDrive;
TCHAR szLabel[128];
DWORD dwVolumeSerialNumber;
DWORD dwMaxNameLength;
DWORD dwFileSystemFlags;
TCHAR szFileSysName[128];
UINT uDriveType;
CString cstrWirDir;
TCHAR infoBuf[INFO_BUFFER_SIZE];
DWORD dwDriveList = GetLogicalDrives ();
GetWindowsDirectory(infoBuf, INFO_BUFFER_SIZE);
cstrWirDir = infoBuf;
cstrWirDir = cstrWirDir.GetAt(0);
cstrWirDir = cstrWirDir + ":";
while (dwDriveList)
{
if (dwDriveList & 1)
{
strDrive = "?:\\";
strDrive.SetAt (0,nPos);
uDriveType = GetDriveType(strDrive);
GetVolumeInformation (strDrive, szLabel,
sizeof( szLabel ) - 1,
&dwVolumeSerialNumber,
&dwMaxNameLength,
&dwFileSystemFlags,
szFileSysName,
sizeof( szFileSysName ) - 1);
switch(uDriveType)
{
case 2:
strDrive = strDrive.Left(2);
InsertFileItem("3½-Diskette (" + strDrive +")");
break;
case 3:
strDrive = strDrive.Left(2);
InsertFileItem((CString)szLabel + " (" + strDrive +")");
break;
case 5:
strDrive = strDrive.Left(2);
InsertFileItem((CString)szLabel + " (" + strDrive +")");
break;
default:
break;
}
}
dwDriveList >>= 1;
nPos++;
}
}
2. This function should build the tree with all the icons :
void CLeftView::InsertFileItem(const CString sFile)
{
CTreeCtrl &trCtrl = this->GetTreeCtrl();
trCtrl.SetImageList(&m_SysImageList.GetImageList(), TVSIL_NORMAL);
SHFILEINFO sfi;
SHGetFileInfo(sFile, 0, &sfi, sizeof(SHFILEINFO),SHGFI_SYSICONINDEX | SHGFI_SMALLICON);
int nIconIndex;
nIconIndex = sfi.iIcon;
CString sTemp = sFile;
TV_INSERTSTRUCT tvis;
ZeroMemory(&tvis, sizeof(TV_INSERTSTRUCT));
tvis.hParent = TVI_ROOT;
tvis.hInsertAfter = TVI_LAST;
tvis.item.mask = TVIF_CHILDREN | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT;
tvis.item.pszText = sTemp.GetBuffer(sTemp.GetLength());
tvis.item.iImage = nIconIndex;
trCtrl.InsertItem(&tvis);
sTemp.ReleaseBuffer();
I don't know if it is enough code or not to detect my mistake so i uploaded a very small project (only the treeview with my code) here :
[url]http://www.filehosting.at/files/download.php?file=1cadb172342f4f83577c45e72addfc42[/url]
Thank you very much for your help
best regards
Cocodile Buck
|
|
|
|
|
CrocodileBuck wrote: SHGetFileInfo(sFile, 0, &sfi, sizeof(SHFILEINFO),SHGFI_SYSICONINDEX | SHGFI_SMALLICON);
When you create the tree control, you need to call SHGetFileInfo with SHGFI_SYSICONINDEX | SHGFI_SMALLICON , and get the return value, which is a handle to the system image list. You then need to set your tree view's small icon image list to be the system image list. After that, your tree view should show the right icons. The code would be something like this:
HANDLE hSystemImageList = SHGetFileInfo(sKnownFile, 0, &sfi, sizeof(SHELLFILEINFO), SHGFI_SYSICONINDEX | SHGFI_SMALLICON);
trCtrl.SetImageList(CImageList::FromHandle(hSystemImageList), TVSIL_NORMAL);
Nathan
|
|
|
|
|
Hi Nathan ,
thanx for your quick reply.
But when I try your 2 lines of code it won't work.
There will not be any error message, there are simply no icons in the tree !
My coding skills aren't as good as yours!
Perhaps, if it is not too much effort you could have a closer look to my code which i have uploaded and implement the code how and where it has to be?
I really tried it to build up this view for 2 day's, i'm not too lazy i simply couldn't get it to work
Please help me
Thank and best regards
Crocodile Buck
|
|
|
|
|
Lazy reply:
Go check my article on detecting drives - it has code for showing drive icons, etc.
And read the comments, where most of that information came from.
Iain.
Plz sir... CPallini CPallini abuz drugz, plz plz help urgent.
|
|
|
|
|
Hi Mr. Clarke,
i know your article, and it is very good.
I can show the drive letters and the lablels that's not the problem. I know how to detect the drives etc.
The Problem is that i couldn't show the system icons.
I think there is something wrong with my SytemImageList , i think there are not enough icons in it, or not the right icons !
Perhaps if you have a look at the small sample i have uploaded, it will take you only seconds to detect and terminate the mistake!
Thanx for your quick reply
best regards
Crocodile Buck
|
|
|
|
|
I solved the Problem
Best regards
Crocodile Buck
|
|
|
|