|
I juse copy-pasted your class into a basic dialog based project, removed the message handlers (since you didn't provide the code for those) and tried it, there was no failing assert, no problem at all. I think without actually seeing your full code i am at this point unable to suggest anything.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Hi
I want to make a button with two tool tips
I,e when the mouse cursor over the left half of the button it displays different tooltip than when the mouse over the right half
As you can see in www.visualcsamples.blogspot.com
I made a button with a button with 2 hover states one on the left and one on the right
Now I,am interested in making a button with 2 tooltips
It works fine the button with 2 hover state
help me
Thanks
|
|
|
|
|
As you can see in the documentation of CToolTipCtrl::AddTool[^], you can specify it a rectangle in the lpRectTool parameter, so basicly i guess all you need to do is add your button twice to the tooltip specifying the left and then the right part of it. Something like this:
m_myToolTip.AddTool(&m_myButton, _T("left side of my cool button"), &left_side_rect, left_tool_id);
m_myToolTip.AddTool(&m_myButton, _T("right side of my cool button"), &right_side_rect, right_tool_id);
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
hi
how to get left_side_rect ?
thanks
|
|
|
|
|
RECT exampleRect = {50,50,100,100};
RECT leftRect, rightRect;
leftRect = exampleRect;
leftRect.right -= (exampleRect.right-exampleRect.left) / 2;
rightRect = exampleRect;
rightRect.left = leftRect.right;
|
|
|
|
|
CRect left_side_rect, right_side_rect;
m_myButton.GetClientRect(&left_side_rect);
right_side_rect = left_side_rect;
left_side_rect.right = right_side_rect.left = left_side_rect.right / 2;
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Yeah, pretty much - though the code won't work in all cases(fails in cases where rect.left != 0).
What if I had a rect that had rect.left=10 & rect.right=20 ?
Clearly, the middle of these points is 15. Your code will return 10.
|
|
|
|
|
If you check out the documentation of GetClientRect[^], you see it states:
The GetClientRect function retrieves the coordinates of a window's client area. The client coordinates specify the upper-left and lower-right corners of the client area. Because client coordinates are relative to the upper-left corner of a window's client area, the coordinates of the upper-left corner are (0,0).
Since we are working with the client rect here i don't see the need to handle the non-zero left-top case.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Oops, of course it does. It seems that my habit of working in screen co-ords has bitten me on the bum this time.
sorry.
|
|
|
|
|
No problem, we all suffer from occupational hazard
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
what is right_tool_id and right_tool_id ?
|
|
|
|
|
Come on, read the documentation(s) of the tooltip control and the AddTool method. Anyways, those are numeric values you use to identify the tools you feed to the tooltip control. Make sure these are unique for every tool you add to the tooltip control. Basicly, when you give a whole button or list or edit field or any other control to the tooltip control you can later on easily refer to the right tooltip by using the window handle you gave to the tooltip control. So, for example, if you add your custom button to the tooltip control and later want to change the tooltip text you can tell the tooltip control to "hey, tooltip control, please change the tooltip for the window with this handle to blablabla". But if you specify multiple areas for the tooltip which are on the same control, you need to have a way to identify those too. So for example, you add the left and right rectangles to the tooltip control which are on the same button and later on you want to change the tooltip text of the left part, saying "change the tooltip text of the button with this handle" won't be enough for the tooltip control because since this button has multiple areas added, it can't know which area you meant. So you also give your areas an ID. For example, you add the left part of the button with ID 12 and the right part with ID 23, and then you can tell the tooltip to change the tip text of the tool with the ID 12. Get it?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
|
Step 1: Add this data member to your CTasheDlg class: CToolTipCtrl m_tooltip;
Step 2: Add this method to your CTasheDlg:
BOOL CTasheDlg::PreTranslateMessage(MSG *pMsg)
{
if (m_tooltip.m_hWnd) m_tooltip.RelayEvent(pMsg);
return __super::PreTranslateMessage(pMsg);
}
Step 3: Add this to the OnInitDialog of your CTasheDlg:
m_tooltip.Create(this);
CRect leftRect(button_rectangle), rightRect(button_rectangle);
leftRect.right = rightRect.left = leftRect.right / 2;
m_tooltip.AddTool(&m_double_tooltips_button, "Left side", &leftRect, 1);
m_tooltip.AddTool(&m_double_tooltips_button, "Right side", &rightRect, 2); right after the line m_double_tooltips_button.GetClientRect(button_rectangle) ;
I believe you got all the help you need to get this to work...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
|
Erm? What do you want to do? How did you try it?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
|
|
i need a c program code on the turing method for substraction. please do post me the reply at the earliest.
|
|
|
|
|
krsrinivas wrote: please do post me the reply at the earliest.
Is this early enough?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I did not get the c program code suiting my requirement. I was expecting to find a code from you but not a proverb or saying of any person. sorry for my remark but I mean it.
|
|
|
|
|
you should really do your own homework.... IF (really big if) you pass your course and actually start commercial development you cant rely on forum posters to do your work for you.
|
|
|
|
|
krsrinivas wrote: I was expecting to find a code from you
You expect a lot, don't you ? Now, if you want help, read the posting guidelines and ask your question properly. If you really want the full code for your program, then this is certainly not the correct forum to ask. You should instead go on rentacoder and pay somebody to do your work for you.
|
|
|
|
|
Hello!
I'm trying to get ACL from HKEY_LOCAL_MACHINE (also such problem with HKEY_CURRENT_CONFIG) registry key.
#include <iostream>
#include <conio.h>
#include <sddl.h>
#include <Aclapi.h>
#include<string.h>
#include <strsafe.h>
#include <windows.h>
char information[1024];
int My_GetObjectAcl(int qtype,char *filestr){
int i,j;
char sd[4096];
char temp1[256];
DWORD sdsize;
char strnew[4096];
DWORD sdnewlen=0; DWORD count;
PEXPLICIT_ACCESS pList[10];
BOOL d1,d2;
PACL pDacl=NULL;
DWORD aclSize;
BYTE bACEType;
LPVOID pAce;
LPBOOL bbb=0;
PSID pSID=NULL;
PSID osid=NULL;
SID_NAME_USE SidType;
ACCESS_ALLOWED_ACE *ACE;
DWORD tmp;
SE_OBJECT_TYPE otype;
char Name[100], Domain[100];
DWORD NameSize = 100, DomainSize = 100;
LPSTR *sidstring;
char str1[512], str2[512];
memset(temp1,0,256);
switch (qtype){
case 1: otype=SE_FILE_OBJECT; break;
case 2: otype=SE_REGISTRY_KEY; break;
default: return 5;
}
printf("Trying read: %s\n",filestr);
pDacl=(PACL)GlobalAlloc(GMEM_FIXED,1000);
if (qtype==1){
if (!GetFileSecurityA((LPCSTR)filestr,DACL_SECURITY_INFORMATION,sd,4096,&sdsize)) {printf("Error %d\n",GetLastError());return 5;}
i=GetSecurityDescriptorDacl(sd,&d1,&pDacl,&d2);
if (!i){ printf("Error %d\n",GetLastError());return 5;}
} else
if(GetNamedSecurityInfoA((LPSTR)filestr,otype,DACL_SECURITY_INFORMATION,NULL,NULL,&pDacl,NULL,NULL)!=ERROR_SUCCESS){printf("::%d",qtype); return 5;}
memset(temp1,0,256);
sprintf(temp1,"Number of ace entries: %d \n",pDacl->AceCount);
strcat(information,temp1);
for (i=0;i<pDacl->AceCount;i++){
memset(str1,'\0',512);
j=0;
NameSize = 100; DomainSize = 100;
GetAce(pDacl,i,&pAce);
bACEType = ((ACE_HEADER*)pAce)->AceType;
ACE = ((ACCESS_ALLOWED_ACE *)pAce);
pSID = (PSID)&(ACE->SidStart);
j=LookupAccountSidA(NULL,pSID,Name,&NameSize,Domain, &DomainSize,&SidType);
if (j==0) printf("\n\n%lu\n\n",GetLastError());
strcpy(str1,Domain);
strcat(str1,"\\");
strcat(str1,Name);
CharToOemA(Name,Name);
memset(temp1,0,256);
sprintf(temp1,"%s\\%s: \n",Domain,Name);
strcat(information,temp1);
switch(bACEType){
case ACCESS_ALLOWED_ACE_TYPE:memset(temp1,0,256);sprintf(temp1,"%s","TYPE:ALLOWED ");strcat(information,temp1);break;
case ACCESS_DENIED_ACE_TYPE:memset(temp1,0,256);sprintf(temp1,"%s","TYPE:DENIED ");strcat(information,temp1); break;
}
memset(temp1,0,256);
sprintf(temp1,"Mask: %X\n",ACE->Mask);
strcat(information,temp1);
memset(temp1,0,256);
tmp=0x80000000;
for (j=0;j<32;j++){
if ((ACE->Mask)&tmp) strcat(temp1,"1"); else strcat(temp1,"0");
tmp=tmp>>1;
}
strcat(information,temp1);
}
return 0;
}
int main()
{int k;
k=My_GetObjectAcl(2,"CURRENT_USER\\");
printf("%s\n",information);
memset(information,0,1024);
k=My_GetObjectAcl(2,"LOCAL_MACHINE\\");
printf("%s\n",information);
getch();
} ;
With CURRENT_USER\\ , USERS\\ and CLASSES_ROOT\\ - all fine. But LOCAL_MACHINE\\ and CURRENT_CONFIG\\ - error. It's really necessary to me to understand why it doesn't work. Please, help me to manage with this problem.Thank You.
modified on Sunday, May 3, 2009 5:53 AM
|
|
|
|
|
The code I'm trying to use:
std::string url = "http://www.psc-range.com/";
browser->Navigate(SysAllocString(url.c_str()),&vFlags,&vTargetFrameName,NULL,NULL);
The error:
'SysAllocString' : cannot convert parameter 1 from 'const char *' to 'const OLECHAR *'
I've managed to get this working:
browser->Navigate(SysAllocString(L"http://www.psc-range.com/"),&vFlags,&vTargetFrameName,NULL,NULL);
Unfortunately I need to get it work with any valid URL, not just one. If someone would please point me in the right direction I would appreciate it.
|
|
|
|
|