|
You are more likely to get help on Crypto++ by posting to their mailing list.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
the qusetion is at:
http://www.codeproject.com/listctrl/xlistctrl.asp?forumid=3227&fr=101&select=478331&df=100#xx478331xx
|
|
|
|
|
Hi All.
I am having with a toolbar rendering it'self when its created. It doesn't display the buttons except when I run my mouse over them. they all work as far as letting the application know its working..
here is the code I am using.. as you can see Its all in win32..
Hope somebody can help.. I can supply more code if needed..
Cheers
Chris
void JumpmanEditor::CreateSideBar()<br />
{<br />
RECT rc;<br />
GetWindowRect(m_hWnd, &rc);<br />
<br />
m_hWndTopBar = ::CreateWindowEx(0,<br />
"JumpmanStaticChild",<br />
"",<br />
WS_VISIBLE | WS_CHILD,<br />
0,
0,
rc.right - rc.left,
TOOLBAR_HEIGHT,
m_hWnd,<br />
NULL,
g_hInst,<br />
0);<br />
<br />
m_hWndTopBarScroll = ::CreateWindowEx(0,<br />
"JumpmanStaticChild",<br />
"",<br />
WS_VISIBLE | WS_CHILD | WS_HSCROLL,<br />
(TOOLBAR_BUTTON_SIZE + 2) * (TBCOUNTMAIN-1),<br />
0,<br />
rc.right - rc.left,<br />
TOOLBAR_PALETTE_HEIGHT + SCROLL_HEIGHT,<br />
m_hWndTopBar,<br />
NULL,<br />
g_hInst,<br />
0);<br />
<br />
m_hWndToolbarMain = CreateToolbar((TBBUTTON *)g_tbbuttonMain, TBCOUNTMAIN, m_hWndTopBar, TOOLBAR_BUTTON_SIZE, TRUE);<br />
m_hWndToolbarPalette = CreateToolbar((TBBUTTON *)g_tbbuttonPalette, TBCOUNTPALETTE, m_hWndTopBarScroll, TOOLBAR_PALETTE_BUTTON_SIZE, FALSE);<br />
<br />
palettescroll = 0;<br />
SetScrollPos(m_hWndToolbarPalette, SB_HORZ, palettescroll, TRUE);<br />
<br />
ShowWindow(m_hWndToolbarPalette, SW_SHOWNORMAL);<br />
ShowWindow(m_hWndToolbarMain, SW_SHOWNORMAL);<br />
}<br />
<br />
<br />
<br />
HWND JumpmanEditor::CreateToolbar(TBBUTTON *p_tbbutton, int count, HWND hwndParent, int size, BOOL text)<br />
{<br />
#define MAXRESLEN 128<br />
<br />
int i;<br />
HWND hwnd;<br />
<br />
hwnd = CreateToolbarEx( hwndParent,<br />
WS_CHILD | TBSTYLE_FLAT,
1,<br />
count,<br />
g_hInst,<br />
IDB_TOOLBAR,<br />
p_tbbutton,<br />
count,<br />
24,
24,<br />
24,<br />
24,<br />
sizeof(TBBUTTON));<br />
<br />
SendMessage(hwnd, TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_DRAWDDARROWS);<br />
<br />
int foo;<br />
<br />
if (text == TRUE)<br />
{<br />
char szBuf[MAXRESLEN];<br />
<br />
for (i=0;i<count;i++)<br />
{<br />
LoadString(g_hInst, p_tbbutton[i].dwData, szBuf, MAXRESLEN-1);<br />
szBuf[lstrlen(szBuf) + 1] = 0;
foo = SendMessage(hwnd, TB_ADDSTRING, 0, (LPARAM) szBuf);<br />
}<br />
}<br />
<br />
SendMessage(hwnd, TB_SETBUTTONWIDTH, 0, (LPARAM)(DWORD)MAKELONG(size,size));<br />
<br />
for (i=0;i<count;i++)<br />
{<br />
TBBUTTONINFO tbbi;<br />
tbbi.cbSize = sizeof(tbbi);<br />
tbbi.dwMask = TBIF_SIZE | TBIF_COMMAND | TBIF_STATE | TBIF_STYLE;<br />
foo = SendMessage(hwnd, TB_GETBUTTONINFO, p_tbbutton[i].idCommand, (LPARAM)&tbbi);<br />
foo = SendMessage(hwnd, TB_SETBUTTONINFO, p_tbbutton[i].idCommand, (LPARAM)&tbbi);<br />
}<br />
<br />
SendMessage(hwnd, TB_AUTOSIZE, 0, 0);<br />
<br />
return hwnd;<br />
}<br />
|
|
|
|
|
Hi, everyone!
I ofter heard from others that the place where to define
a friend function of a class depend on whether the
client code is supposed to call that function or not. But
in my experience I always define the friend function in
.h file. I simply want to know what means "whether the
client code is supposed to call that function or not".
Can you give me an example?
regards,
George
|
|
|
|
|
Dude, you seem to hear a lot of things from others!
Software is everything. It also sucks. Charles Fishman [^]
Awasu 1.0.3 (beta)[^]: A free RSS reader with support for Code Project.
|
|
|
|
|
Thanks, Taka buddy!
I like to hear and read experience by experienced
people. For example, programming experience. But
for a newbie, some experiences are too beief without
an example. For example, something like "10 rules of
...". So I just want to let experienced people to tell
me what they are talking about.
regards,
George
|
|
|
|
|
No problems
So, where did you hear this? Friends are *always* defined in the class definition which is usually going to be in a header file.
Software is everything. It also sucks. Charles Fishman [^]
Awasu 1.0.3 (beta)[^]: A free RSS reader with support for Code Project.
|
|
|
|
|
Thanks, Taka buddy!
If you have ever studied how the compiler is working,
you will see what is my trouble. Suppose functionA is defined
in a header file. The compiler will recognize functionA as
valid identifier in any translation unit that includes A.h.
The function has external linkage by default. So I think if
a function is not called by others, it will be a waste to
define the function in the header file. Define it in .cpp
file is just OK. Since compiler external linkage will make
my program larger. But I do not know whether I am correct.
Can anyone help?
regards,
George
|
|
|
|
|
Defining a function in a header simply tells the compiler that the function exists (somewhere else) and has the specified signature.
You need to do it so that the compiler won't flag an error when you try to use it. That's all. If you don't call that function, it won't make your EXE bigger.
Declaring it in a CPP file is *wrong* since it is easy to change the signature of the function and forget to update the other declarations. If you have it in a single place i.e. the header file, you are more likely to get it right. If you are using a C++ compiler, name-mangling means that the linker is likely to flag an error but it's still bad practice.
Software is everything. It also sucks. Charles Fishman [^]
Awasu 1.0.3 (beta)[^]: A free RSS reader with support for Code Project.
|
|
|
|
|
Thanks, Taka buddy!
Your reply has answered most of my questions. Now I
have a last question, can you show me a case
where the client code is not supposed to call that
function but we must define the function in .cpp file
and better not in .h file? I can not imagine that case.
regards,
George
|
|
|
|
|
Hello George,
Since MS introduced MC++ they've been promoting inline function definitions for classes. This renders the need for a separate header file a mere formality and thus some people actually avoid using header files.
But if you are planning on writing some global fucntions then it might be a darn good idea to keep them in a separate header file.
Regards,
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
Thanks, Nishant buddy!
When you say inline function. Do you mean define a
function inside the .h file?
What means "This renders the need for a separate header
file a mere formality and thus some people actually
avoid using header files" in your reply? Why people avoid
using that way? Can you show me an example?
regards,
George
|
|
|
|
|
George2 wrote:
When you say inline function
Something like :-
class Abc()
{
void Hello()
{
}
};
Hello is defined directly here as you can see. If you were using separate CPP and H files you'd have put just the declration in the H file and the definition would have been in the CPP file
George2 wrote:
Can you show me an example?
Well the main CPP file for an MC++ project need not have a H file. You juyst put all your classes into this main CPP file. And similarly any other classes might be fully defined in a H file (this time no separate CPP files)
Regards,
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
Thanks, Nishant buddy!
George
|
|
|
|
|
Hi, everyone!
I have heard that type conversion operator will
produce ambiguity when the compiler is implicitly
converting your types for you when the error will
occur "there are two or more functions that match..."
But I have not found an example code. I just heard that
but have never met with the very case.
Can you show me one example of that?
regards,
George
|
|
|
|
|
Here's a really rough example
void f(int n) { }
void f(char* p) { }
class C
{
public:
operator int() { return 1; }
operator char*() { return "hi!"; }
};
main()
{
C obj;
f(obj);
}
--Mike--
THERE IS NO THERE IS NO BUT THERE IS
MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT
Homepage | RightClick-Encrypt | 1ClickPicGrabber
"You have Erica on the brain" - Jon Sagara to me
|
|
|
|
|
Thanks, Michael buddy!
George
|
|
|
|
|
Does there exist on sourceforge or similar a set of classes for an OOP interface and implementation for using FTP and P2P...?
I much prefer working with objects rather than c api's.
I would like them to be as platform independant as possible also, so MFC's classes won't cut it.
Thanks in advance.
BTW - I want open source (free would be prefered)
Cheers
"Two wrongs don't make a right, but three lefts do!" - Alex Barylski
|
|
|
|
|
My MFC7 app needs to be able to create a resource dll and add resources (string and html) to it on-the-fly. How would I go about doing that? I've looked around in MSDN and using Google, but I haven't found any information on doing that yet.
|
|
|
|
|
|
I agree with you, but unfortunately the programmers at Digital Anvil didn't think so when they made Freelancer Freelancer stores all the text information in a number of resource-only dlls, and I'm the maker of a mod manager program for Freelancer (FLMM). I'm wanting to let mods easily add new string/html resources to a dll for Freelancer to use.
I looked at that documentation, but it seems awfully complicated Do you know if there is any (free) code out there that would do what I want to do?
Thanks
|
|
|
|
|
I'd go the easier route - compile a bare-bones DLL and put that in your app, maybe stick it in as a binary resource. Then when you need to create a new DLL, use that bare-bones one as starting point and use the *UpdateResource() APIs to modify the resources (as long as you can require your users to have some flavor of NT).
--Mike--
THERE IS NO THERE IS NO BUT THERE IS
MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT
Homepage | RightClick-Encrypt | 1ClickPicGrabber
"You have Erica on the brain" - Jon Sagara to me
|
|
|
|
|
That is EXACTLY what I was looking for; thanks!
I need to be able to work with Win98 and ME, though, so that might present a problem. I was looking at the MSDN documentation on UpdateResource(), and it said the following at the end:
"Windows 95/98/Me: UpdateResourceW is supported by the Microsoft® Layer for Unicode (MSLU). To use this, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows 95/98/Me Systems."
Does that mean that the unicode version works with 98/ME?
|
|
|
|
|
IGx89 wrote:
Does that mean that the unicode version works with 98/ME?
It might, you'd just have to try it out (or search the net for someone else who's tried it and posted the results)
--Mike--
THERE IS NO THERE IS NO BUT THERE IS
MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT
Homepage | RightClick-Encrypt | 1ClickPicGrabber
"You have Erica on the brain" - Jon Sagara to me
|
|
|
|
|
I use an older version of MSLU and it works just fine. The hardest part is getting it setup the first time. But once you get the linking process done properly, everything works great.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|