|
Nice icons all in .ico format and high color for those that are really big (>30KB) and 8bit color(256color) those that are 766 bytes. for the moment lets forget high color, so we are talking about 256 color 32x32 .ico format that most of them do not have transparent colors.
The way I use them is pretty much straight forward,in visual studio 2005 in Resource view under toolbar node, I add a toolbar then I copy the icon of button that I've already opened as icon resource and paste it over the button. The toolbar has an ID for example ID_MY_TOOLBAR.
then I define a CToolbar member variable in CMainFrame and in OnCreate function I create my toolbar.
<br />
m_barMyOwnToolBar.CreateEx(this, tbstyle-flat, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);<br />
m_barMyOwnToolBar.LoadToolBar(ID_MY_TOOLBAR);<br />
now if my original icons in toolbar are large 32x32 then toolbar will be large and if my original icon are 16x16 then my toolbar will be at right size. the problem is I want to load 32x32 but I want 16x16 size.
still am I asking too much?
|
|
|
|
|
I personally have a problem with the LoadToolBar() method of constructing a toolbar - it alters
the color table of the bitmap. It works great for 16-color bitmaps and RAD but I like control
over my code .
For best results, I prefer to use an image list - it lets you specify a transparent color and
supports 24-bit RGB bitmaps nicely.
It takes a few extra steps, but the reward is complete control over your button bitmaps...
static TBBUTTON ToolBarButtonDescs[] =
{
{0, ID_BUTTON1, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0,0}, 0, 0},
{1, ID_BUTTON2, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0,0}, 0, 0}
};
...
CBitmap bitmap;
bitmap.LoadBitmap(IDB_TOOLBARBITMAP);
m_ToolBarImageList.Create(16, 16, ILC_COLOR24|ILC_MASK, 2, 1);
m_ToolBarImageList.Add(&bitmap, RGB(0x00,0xFF,0x00));
...
m_barMyOwnToolBar.CreateEx(this, TBSTYLE_FLAT,
WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_FLYBY |
CBRS_SIZE_DYNAMIC);
m_barMyOwnToolBar.GetToolBarCtrl().SetImageList(&m_ToolBarImageList);
m_barMyOwnToolBar.GetToolBarCtrl().AddButtons(2, ToolBarButtonDescs);
Note that you need to create the bitmap for the imagelist. It needs to be 16 pixels high by
(16 * numberofbitmaps) pixels wide. Create this bitmap with a good bitmap editor as mentioned
before - your buttons will look like whatever you make the bitmap look like (unlike when you use
LoadToolBar()).
Also note that this works for me....I'm not saying it's the best method - it's just one example.
I find it very flexible at the expense of a few extra ines of code.
You don't have to use a 24-bit RGB bitmap for the imagelist. If you choose to use 256-color,
create it something like:
//CBitmap bitmap;
//bitmap.LoadBitmap(IDB_TOOLBARBITMAP);
//m_ToolBarImageList.Create(16, 16, ILC_COLOR24|ILC_MASK, 2, 1);
//m_ToolBarImageList.Add(&bitmap, RGB(0x00,0xFF,0x00));
m_ToolBarImageList.Create(IDB_TOOLBARBITMAP, 16, 1, RGB(0x00,0xFF,0x00));
Hope you can extract something useful from that!
Mark
-- modified at 15:59 Wednesday 27th June, 2007
oops - edits marked in red
"Go that way, really fast. If something gets in your way, turn."
|
|
|
|
|
Thanks Mark, Though original problem persists but your way of attaching bitmaps difinately is better than mine, thanks. I have to solve this issue one way or another either programistic way(accomodate 32x32 bit icons in 16x16 place) or artistic way(work on my drawing skills to draw 16x16 icons that look really good).
|
|
|
|
|
Electronic75 wrote: work on my drawing skills to draw 16x16 icons that look really good)
Yeah....I'm not good at it....I just steal them right out of microsoft exe/dlls
Just kidding Microsoft!
"Go that way, really fast. If something gets in your way, turn."
|
|
|
|
|
Mark Salsbery wrote: I just steal them right out of microsoft exe/dlls
Don't ever look at the issue this way! every program that you write for MS-Windows platform causes many users of that program are being forced to use MS-Windows, so in fact you are a microsoft employee working for free for them. if something is being stealed it is from the other side!;)
|
|
|
|
|
Of course! That was just my public comments about the subject
*edit* Oh, and if anybody asks, I was never here...
"Go that way, really fast. If something gets in your way, turn."
|
|
|
|
|
Hi all,
I have this sample data in a .txt file,
-- Ne doit pas faire
-- é
select PARC.CONTYP
, PARC.CONSTA
, count(*)
from ParcNonCede PARC
, PLAN P
and PARC.CONSTA not in ('Stock', 'Détourné')
group by CONTYP, CONSTA
;
I am saving this in UTF-8 (not necessarily using Notepad).
Now I have this sample code to detect the Codepage of a buffer as below..
void
ExamineData(String &codepage, String &buffer)
{
IMultiLanguage2 *mlang;
DetectEncodingInfo info = {0};
MIMECPINFO codepageinfo;
int length = 0, cnt = 1;
String codepagestr; // String Datatype is my class
unsigned int len =1;
if(buffer.GetString())
length = buffer.GetLength();
HRESULT hr = S_OK;
SUCCEEDED(CoInitialize(NULL)); // init COM
hr = CoCreateInstance(CLSID_CMultiLanguage, NULL, CLSCTX_INPROC_SERVER, IID_IMultiLanguage2,(void **)&mlang);
hr = mlang->DetectInputCodepage(0,0, (wyChar *)buffer.GetString(), &length, &info, &cnt);
if(SUCCEEDED(hr))
{
hr = mlang->GetCodePageInfo(info.nCodePage, info.nLangID, &codepageinfo);
if(SUCCEEDED(hr))
codepage.SetAs(codepageinfo.wszDescription);
}
mlang->Release();
CoUninitialize();
}
Now this Function Detects the Codepage for the Buffer as "Western European (Windows)" even though it is an UTF-8. But Notepad is able to correctly detect it as UTF-8.
I am Not able to come to a conclusion whether it is a problem with the code or with the API.
Please Help me.
Thanks in Advance,
Manohar.S
|
|
|
|
|
anybody?
I need some help over here..
Regards
Manohar.S
|
|
|
|
|
There has a Client connected with the Server.
How should the Server could test the Client's net-speed?
GOOD LUCK
|
|
|
|
|
kcynic wrote: How should the Server could test the Client's net-speed?
I dont know a reliable method. However, monitor the maximum transfer rate or let the user on the client end enter his connection speed (client needs to communicate that to the server). In any case the average network transfer rate depends on many factors and won't be a fixed value over time.
kcynic wrote: GOOD LUCK
?
|
|
|
|
|
I have a project complied using shared dll of MFC.I should release it now.
How but the .exe could not run on other PC with no VC.
I know I should release all the .dll files with the .exe file.But how should I find witch .dll files I should copy it?
Thanks
|
|
|
|
|
Run the Microsoft Tools->Dependency walker and put the dll in it. It will show all dependency.
|
|
|
|
|
I find there has no such tool in VS2005. I use vc6's Dependency Walker to view the dll it need.I add all the dlls.
But when I make a install project and using the result setup file to install it in another PC,it could not run but terminated with the message that the configuration is wrong.
How to resolve it?
Thanks
|
|
|
|
|
I have a project complied using shared dll of MFC.
Try with make changes in project settings.
Compile using static library.
May be u'll get the result
|
|
|
|
|
the problem is that,if i compiled it using static library,the program would crash at runtime.
But the debug version works well.Why?
|
|
|
|
|
Hi All,
Our programmes use a generic thread creation and destruction so it makes it easy to create and control threads in the system without everybody having to re-implement the creation code. The problem however is that in debug mode we get:
The thread '___thread_callback' (0x8ec) has exited with code 0 (0x0).
___thread_callback is repeated a number of times equivilant to the number of threads created. Is there any way of changing this debug output in VS2005 to indicate which thread exited?
thanks,
Rich
"Programming today is a race between software engineers striving to build bigger and
better idiot-proof programs, and the Universe trying to produce bigger and better idiots.
So far the Universe is winning." -- Rich Cook
|
|
|
|
|
I think so, you could give your thread a meaningful name.
Use the following code snippit.
{
typedef struct tagTHREADNAME_INFO
{
DWORD dwType;
LPCSTR szName;
DWORD dwThreadID;
DWORD dwFlags;
} THREADNAME_INFO;
const DWORD MS_VC_EXCEPTION = 0x406D1388;
THREADNAME_INFO thrdInfo;
thrdInfo.dwType = 0x1000;
thrdInfo.szName = "The Name";
thrdInfo.dwThreadID = 0xffffffff;
thrdInfo.dwFlags = 0;
__try
{
RaiseException( MS_VC_EXCEPTION, 0, sizeof(thrdInfo)/sizeof(DWORD), (DWORD*)&thrdInfo );
}
__except(EXCEPTION_CONTINUE_EXECUTION)
{
}
}
I use this technique to simplify the debugging for My CWinThread derived, but i'm confident that it
should work for Worker threads as well. At low lever there isn't a difference.
Hope that this helps.
codito ergo sum
|
|
|
|
|
That is an interresting way round the problem
Thanks.
"Programming today is a race between software engineers striving to build bigger and
better idiot-proof programs, and the Universe trying to produce bigger and better idiots.
So far the Universe is winning." -- Rich Cook
|
|
|
|
|
That's good but you could have just given him the link[^] to the documentation you got that from.
|
|
|
|
|
I' guess I could have done that but then I would be forced to google for it. Since I didn't remember the link where I first found it.
So I thought that whilst i'm in my project containing this little piece of code, maybe i could just could copy/paste it.
Don't worry won't happen again ...
codito ergo sum
|
|
|
|
|
Hi together,
I put a ListView in my Dialog and wand to catch the LVN_BEGINDRAG Notify-Message.
The ListView has his Notify-property to TRUE.
I tried a ON_NOTIFY_RECENT(LVN_BEGINDRAG,OnDrag) but i never step into it.
A tutorial says that the LVN_BEGINDRAG Notify message is catchable with adding a
new handler via the class wizard.
I tried a lot of things, but i don't find it
Does anyone knows where to add it?
Big thanks
|
|
|
|
|
Resource view -> mark the listctrl
Right click -> Context menu "Add event handler..."
proceed...
It is not so easy to find I still miss the VC6 (CTRL+W) wizard
Greetings from Germany
|
|
|
|
|
Danke für deine Antwort
I only have SetFocus, KillFocus, ThemeChanged, ...
No one likely "BeginDrag" or Notify
|
|
|
|
|
First you must open the Resource view (open the *r.rc file) of your dialog then click at the Treeview. Now right click ...
Greetings from Germany
|
|
|
|
|
Muss ich die Liste zuerst noch als Klasse ableiten?
Denn ich bin im Ressourcen-Modus, sehe den Dialog mit ner Textbox & dem Listen-Control.
Dann wähle ich die Liste aus und gehe auf "Ereignishandler wird hinzugefügt"
Dort drin habe ich jedoch nur Doppelklick, Focus Ereignisse
Nicht was mit Drag&Drog zu tun hat.
Irgendwo ist da der Wurm drin LOL
|
|
|
|
|