|
on a 32bit OS you'll have a little problem getting the __int64 value
Not only that. double numbers will be more serious problem.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
well to got the 64 bits value (e.g. __int64 or double) we do it like this:
(*** lets say we're working on a 32bit OS ***)
in the .h file:
#define GetParam(arg,num) (((int *)(&arg))[num])
func1(const char *lll, ...);
The arguments come in 32 bits pieces.
There for the 64bits variable will come in 2 pieces (64/32=2).
and we will get the value like this
func1(const char *lll, ...)
{
__int64 l_nNumber;
int pos=0;
((__int32 *)&l_nNumber)[0]= GetParam(lll, ++pos);
((__int32 *)&l_nNumber)[1]= GetParam(lll, ++pos);
}
BTW: for some of you that wished for CodeProject irc server
I create a channle on DalNet called "#CodeProject "
|
|
|
|
|
1) Do you think it's better than va_xxx?
2) Do you think this solves the original poster's problem?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
1) what is the "original poster's problem"?
2) I have no problem with it, as a matter of fact it works perfect.
BTW: for some of you that wished for CodeProject irc server
I create a channle on DalNet called "#CodeProject "
|
|
|
|
|
what is the "original poster's problem"?
He wanted to pass va_list from one function that takes a variable number of arguments to another function. Your macros do not solve this problem.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
thanks for the answers guys!
|
|
|
|
|
How to register a window class exactly the same as the "View" window except the backcolor in a MDI/SDI application?
Thanks.
Maer
|
|
|
|
|
Handle OnEraseBackground to change the background colour if that's all you want to change. I don't believe you can change it by creating a Window class ( although I could be wrong ). Full instructions are in the FAQ.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
You *can* control the background color in a view by creating a Window class. See TN001 in MSDN Library.
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"
|
|
|
|
|
What means ATOM?
Thanks.
Maer
|
|
|
|
|
VC help -> Contents -> Platform SDK -> Base Services -> Interprocess Communications -> Atoms
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi, Sowinski!
Thanks for your reply.
It helps a lot.
Best regards,
Maer
|
|
|
|
|
Hi,
In one of my apps I have a class requiering an HBITMAP as input but my
images are all stored as icons.
Does anyone know of a nice way of converting between an icon and a bitmap?
I know the CImageList does this somehow but it is not a very neat solution.
Johannes
|
|
|
|
|
|
I am writing a class to create our own toolbar in Win32. For Dialog boxes I create a dialog template dynamically and then call CreateDialogIndirect. I want to create a toolbar with the WS_EX_TOOLWINDOW style set, so that the caption and system menu are the smaller size. Am I right in thinking that this means I need to create a *window* with this style, draw the background grey and then add my buttons ? This is a major pain as it means I can't inherit from my dialog class....
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Dialogs can certainly have the WS_EX_TOOLWINDOW style. Are you trying this and it's just not working?
--Mike--
http://home.inreach.com/mdunn/
You are the weakest link, GOODBYE!
|
|
|
|
|
It doesn't work if I set the style to include this value, but using SetWindowLong works just dandy - I was about to post and say I'd got it working
I have another problem though - I am currently creating a lot of windows that all have their own 'button' on the status bar, but when I click on some of them they are not shown. I tried handling WM_SHOWWINDOW, to find it's not being called. Can you suggest what I might need to do to fix this ?
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
I was wondering how can I have a text area liked control in my dialog based application (win32). I try to use the resource editor but cannot find any text area liked control ?
thank you
|
|
|
|
|
How is what you want different from the edit box and rich edit control provided by the resource editor ?
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Hi,
Am using an owner drawn list control, and I handle the WM_MEASUREITEM message to set the item height. Problem is, this message is sent only when a window is created (or so the MSDN documentation says). I'd like to set the item height, in response to user button clicks (to provide for the effect of zooming items)-this would let the user increase or decrease item heights by clicking buttons. Problem is, as noted earlier, the message is sent only when the list control is created-how do I set the item height, without destroying and creating the control again?
Any help is much appreciated.
--Shanker.
"When it's done" - 3D Realms.
|
|
|
|
|
The fact that there is no way to set an item's RECT and that ListViews only supports LVS_OWNERDRAWFIXED leads me to believe that you are, unfortunately, out of luck...
Unless, you only have one column in the ListView in question, then might I recommend moving to a ListBox instead... its WM_MEASUREITEM suffers the same problem ( only ever getting called once ), but you can set an items RECT at runtime ( like when the user clicks on it ).
void CMyZoomListBox::OnSelchange()
{
if ( -1 != m_nLastSelection ) {
SetItemHeight ( m_nLastSelection, m_nNormalSize );
}
m_nLastSelection = GetCurSel ();
SetItemHeight ( m_nLastSelection, m_nZoomSize );
Invalidate ();
}
Ben Burnett
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|
I asked this same question for SendMessage HERE once before. However, it appears as though the solution for SendMessage does not work for PostMessage.
I want to pass a CString as one of the parameters of PostMessage. How is this done?
|
|
|
|
|
I want to pass a CString as one of the parameters of PostMessage. How is this done?
Well, you can pass a pointer to a CString, however this will work only if the receiver of the message to is in the same process as the sender, otherwise the pointer will be meaningless. You also have to make sure that the CString object exists long enough for the receiver to use it. Since posted messages are handled asynchronously, you'll need to arrange this part yourself.
--Mike--
http://home.inreach.com/mdunn/
You are the weakest link, GOODBYE!
|
|
|
|
|
Assuming the target window is in the same process, you can send a CString via PostMessage like this:
void SendTextToWindow(HWND hwndTarget, UINT uiMessage, LPCSTR lpszText);
{
CString* pText = new CString;
(*pText) = lpszText;
::PostMessage(hwndTarget, uiMessage, (WPARAM)pText, 0);
}
Then, in the message handler for uiMessage,
LRESULT OnSomeMessage(WPARAM wParam, LPARAM lParam)
{
CString* pText = (CString*)wParam;
ASSERT(pText);
delete pText;
return 0;
}
I have used this, but I do not recommend it because there is a potential that the message could not make it to the target window and thus the CString never be destroyed. Also, this only works if the target window is in the same process. Ultimately, if you really need to do this often, I would recommend creating a manager class (something line CStringMessageManager), and have it be responspilble for deleting CString objects created and passed via PostMessage.
|
|
|
|
|
I went ahead and posted the code I use to deal with this situation. You can find it at
http://www.codeproject.com/useritems/sendcstring.asp
|
|
|
|