|
Hi;
My first post... silly and simple questions, but i've poured through MS Disaster Network (MSDN) and
Wrox "Professional MFC 6.0", and can't find answers to easy questions. I've done these in the past, but it's been so long that i've forgotten how.
First, how in the blink do you add a custom app icon (upper left corner icon)? I modified the stock Wizard supplied icon (the building blocks one) and yet, the app doesn't use it! It's in the project and the IDR_MAINFRAME rc is pointing at the correct file but... argh!
Secondly, I need to intercept both the minimize button on the right of the title bar and also the minimise menu item on the system menu so that when the user clicks on those, I can minimize to the tray instead of the task bar - client requirement (and i'd like to know how to do it myself!). I already have a menu item for minimize to tray (on the view menu), but need it this way too.
TIA!
Dave LeBlanc
|
|
|
|
|
For custom Icon, in your dialog constructor, add
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDI_MYICON);
There may be other ways but this is what the wizard gives me and it works when I am using MFC.
Have Fun!
|
|
|
|
|
G'day Dave,
Re: The icon problem. Have you edited the 32x32 pixel icon and forgotten to do the 16x16 version? Been there, done that...
There's a drop list just above the icon editing window to let you select the size of icon to work on.
Sorry, I cant help with the minimizing problem, but there's a CP article here that might set you straight.
Hope this helps.
Steve
|
|
|
|
|
Take a loot at this article:
http://www.codeproject.com/gdi/replaceicon.asp
Enjoy!
|
|
|
|
|
You need a handler for WM_SYSCOMMAND message. Maybe something like this:
void CMainFrame::OnSysCommand(UINT nID, LPARAM lParam)
{
CFrameWnd::OnSysCommand(nID, lParam);
if (nID == SC_MINIMIZE)
{
}
}
Don't forget to add ON_WM_SYSCOMMAND() to the message map .
HTH, peter
|
|
|
|
|
Hi;
My first post... silly and simple questions, but i've poured through MS Disaster Network (MSDN) and
Wrox "Professional MFC 6.0", and can't find answers to easy questions. I've done these in the past, but it's been so long that i've forgotten how.
First, how in the blink do you add a custom app icon (upper left corner icon)? I modified the stock Wizard supplied icon (the building blocks one) and yet, the app doesn't use it! It's in the project and the IDR_MAINFRAME rc is pointing at the correct file but... argh!
Secondly, I need to intercept both the minimize button on the right of the title bar and also the minimise menu item on the system menu so that when the user clicks on those, I can minimize to the tray instead of the task bar - client requirement (and i'd like to know how to do it myself!). I already have a menu item for minimize to tray (on the view menu), but need it this way too.
TIA!
Dave LeBlanc
|
|
|
|
|
Hi every body,
CListCtrl in Visual c++ 6.0
I have a list view ( list control) with three columns and three lines and i want to navigate in my control like this :
for (i=0; i
|
|
|
|
|
I'm surprised no-one answered this already - I had to wait to get home and look at code where I did it.
I'm using SetItemText to put them in, but GetItemText takes them back out the same way:
// Create list view columns
LV_COLUMN listColumn;
LV_ITEM listItem;
char* arColumns[2] = { "Account", "Password"};
listColumn.mask = LVCF_FMT|LVCF_WIDTH|LVCF_TEXT|LVCF_SUBITEM;
listColumn.fmt = LVCFMT_LEFT;
int Width[2]={190,63};
listColumn.cx = 180;
for ( int nColumn = 0;nColumn<2;nColumn++)
{
listColumn.cx = Width[nColumn];
listColumn.iSubItem = nColumn;
listColumn.pszText = arColumns[nColumn];
m_listCtrl.InsertColumn(nColumn,&listColumn);
}
// Add list items
listItem.mask = LVIF_TEXT | LVIF_IMAGE;
listItem.iSubItem = 0;
TCWACCOUNT* pCurrent;
pCurrent = m_TCWACCOUNT.pNext;
int nItem = 0;
while(pCurrent != NULL)
{
listItem.iItem = nItem;
listItem.pszText = pCurrent->pCustName;
CString Check = (CString)pCurrent->pPasswd;
if (Check.Left(4) == "NuLl")
{
listItem.iImage = 1;
m_listCtrl.InsertItem (&listItem);
m_listCtrl.SetItemText (nItem, 1, "No");
}
else
{
listItem.iImage = 0;
m_listCtrl.InsertItem (&listItem);
m_listCtrl.SetItemText (nItem, 1, "Yes");
}
pCurrent = pCurrent->pNext;
nItem++;
}
Ignore all the account stuff, it's just stepping through a linked list. The important part is that the item is the row, the sub item is the column. GetItemText looks like this in the MSDN:
int GetItemText( int nItem, int nSubItem, LPTSTR lpszText, int nLen ) const;
CString GetItemText( int nItem, int nSubItem ) const;
So you can do this
for (int i = 0; i < listsize; i++)
{
Column1[i] = m_List.GetItemText(i, 0);
Column2[i] = m_List.GetItemText(i, 1);
Column3[i] = m_List.GetItemText(i, 2);
}
Of course, you'd be better putting them in a struct ( or class ) but that is another story....
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
lets say I got a listctrl with items from A-Z
and i want to walk up/down left/right the lista with more then the arrow keys
like 'A' and 'D' (left/right). but the problem is that as soon as a press 'D' the selections
jumps to the items that begin with 'D' and with 'A' i get to the item starting with A,
this is often a very good thing.. but I dont want it..
i Tried to catch the message in the OnKeyDown and there move the selection up/down but the
autoselection feature is activated later on.. how do i disable / override it ??
Mathias S.
mathias@isalive.com
|
|
|
|
|
Hi
In the developer edition of Office 2000 its says it includes the "Royalty free runtime distribution libraries for Access2000". If I use a Access database in my app. does this mean I need these libraries to run the software on applications that don't have Access2000? If not, what is it?
Thanks
|
|
|
|
|
Yes,
Most (if not all) MS Windows versions do not support DAO out of the box and you need to install the drivers when you plan to use Access databases in your application.
Peter
|
|
|
|
|
Thanks for the reply Peter. Unfortunately I'm still not quite clear on this:
1/ Does this mean I *do* have to pay royalties if I don't buy the Developer Office 2000?
2/ I would have thought just installing the right drivers (MDAC?) was good enough? I don't need the user to be able to open the database (its all just through ADO and the Jet 4.0 engine).
Thanks
|
|
|
|
|
No you do not have to pay royalties, but you have to include the DAO redistribution disks together with your application's install.
|
|
|
|
|
|
Dear all,
Does anyone know whether a MFC program can get the URL at the activating
Internet Explorer or not? If yes, how can I get the URL?
Thanks a lot!
Vickie
|
|
|
|
|
http://codeguru.earthweb.com/ieprogram/enumIE.html
good luck,
Dror
|
|
|
|
|
I have a dialog based app and when I call ShowWindow(SW_HIDE) it hides the window and removes the taskbar button. I need a way to keep the taskbar button there even though the window is hidden.
Any ideas?
Thanks
Peter Papanikolaou
|
|
|
|
|
instead of hiding the window, remember it's position and move it offscreen.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
The problem with your solution is, what if a user has multiple monitors?
You might be moving the window right onto another screen, not exactly what you had in mind.
|
|
|
|
|
I have two monitors myself, it is possible to enumerate them and thus make sure you move the window outside their bounds. But I admit your suggestion of minimising is more obvious, more elegant and generally less of a hassle.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Why don't you just minimize it instead?
|
|
|
|
|
minimize only
or
what about taskbar-tray icon?
|
|
|
|
|
I have a dialog based app and when I call ShowWindow(SW_HIDE) it hides the window and removes the taskbar button. I need a way to keep the taskbar button there even though the window is hidden.
Any ideas?
Thanks
Peter Papanikolaou
|
|
|
|
|
With CRecordSet and Memo AssertionFailed when
CString > 255 characters and < 65535 characters into Memo
The memo type get max 65535 characters in Access.
Why??
|
|
|
|
|
There's a new feature in VC6 that adds a length param to RFX_Text - it defaults to 255. Class wizard doesn't know about it.
You might try revising the DoFieldExchange code to add this fourth parameter:
pFX->SetFieldType(CFieldExchange::outputColumn);
RFX_Long(pFX, _T("[ID]"), m_ID);
RFX_Text(pFX, _T("[Name]"), m_Name);
RFX_Text(pFX, _T("[Notes]"), m_Notes, 32768);
|
|
|
|