|
GetClientRect() will give you the rectangle of the client area of the window (so left and top will be 0, and right and bottom give you the width and height). Alternatively, GetWindowRect() gives you the position of the window in screen coordinates.
Dave
|
|
|
|
|
|
Note that GetClientRect() does omit the nonclient area (I failed because of that lately).... so GetWindowRect() together with ScreenToClient() might be better.
|
|
|
|
|
this works for non-client area + client:
WINDOWPLACEMENT wp;
GetWindowPlacement(&wp);
wp.rcNormalPosition.bottom += delta_bottom;
wp.rcNormalPosition.left += delta_left;
wp.rcNormalPosition.right += delta_right;
wp.rcNormalPosition.top += delta_top;
wp.showCmd = SW_SHOW;
SetWindowPlacement(&wp);
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
Great, works good, Thank you
|
|
|
|
|
Is there a Replace in Files addin for VC6?
Todd Smith
|
|
|
|
|
Hello buddies,
Does anyone can explain to me about Hashing or Signature ?
About Hashing or Signature in Crypting ...
If anyone has a informarion about those i'll be a good listener
like Socket server
Regards,
|
|
|
|
|
hashing is a one-way encryption of data. it cannot be unencrypted. a good hash algorithm is one where there is no way to extract any information about the input data, based on the output data (the hash).
get yourself a copy of Applied Cryptography
-c
Be very, very careful what you put into that head, because you will never, ever get it out. --Thomas Cardinal Wolsey
|
|
|
|
|
Hi dear Chris,
Already, I Encrypt/Decrypt the string by CryptoAPI and without using Hashing.
I just want to know what's better ? Using Hashing in Encrypting or not !
Speed is very important in this project.
Regards,
|
|
|
|
|
Hadi Rezaee wrote:
I just want to know what's better ? Using Hashing in Encrypting or not !
better for what?
Be very, very careful what you put into that head, because you will never, ever get it out. --Thomas Cardinal Wolsey
|
|
|
|
|
I mean right now i can encrypt data by CryptoAPI and by using RC4 algorithm.
So, what's reason to use hashing in encrypting ?
|
|
|
|
|
one major use of hash functions is to sign the data:
data -> hashFunction(key,data) -> hash
then, you transmit the hash with the data. the recipient can apply the same hash function, using the same key that you used, and compare the two hash values. if they don't match, the message is not the one that you used to generate your hash. this is called a Message Authentication Code (MAC).
this is not the same as encryption.
-c
Be very, very careful what you put into that head, because you will never, ever get it out. --Thomas Cardinal Wolsey
|
|
|
|
|
Hi dear Chris,
Thank you for help
|
|
|
|
|
Hello everyone,
I want to update the icon of my app at runtime after checking to see if a certain condition is true. The new icon to use is defined in my resources. I have looked through past posts on this subject and found some information (mostly using UpdateResource), however I have not been able to get it to work. Here is the code I've got so far:
if( bcondition == TRUE){
HANDLE hIcon = LoadImage(AfxGetResourceHandle(), MAKEINTRESOURCE(IDR_MAINFRAME),
IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR);
UpdateResource (hIcon, RT_ICON, MAKEINTRESOURCE(IDI_NEWICON),
MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), NULL,0);
}
I'm probably totally off here (sorry, still a newbie ), also where should I put this? Does it need to be at a certain point during the creation of the app? Thanks so much!
|
|
|
|
|
Im not exactly sure on what you mean by "update" your icon. I am assuming you mean to change the icon on the window of the application itself and not the EXE's icon completely. If this is wrong say so. But anyways to update an icon on the window itself you could do it a varity of ways. If your using MFC you could simply use SetIcon after loading it from the resource using the LoadIcon function. If your talking about doing this in a Win32 application you may have to do it a bit differnt.
If you mean your trying to update the icon for the EXE completely so that even the icon of the .exe file in your folder changes it would be a bit more hard.
For more info feel free to contact me im not sure exactly what your question is my AIM is LiquidIceKnight or vethax0r my MSN is spartacushaxor@hotmail.com (dont email me here) if you only have yahoo my yahoo name is killereaglesoftware, and if you really don't have any of those and must reply to me only by means of email when it would be so much easier to explain through means of chatting feel free to email me. killereaglesoftware@yahoo.com
- LiquidKnight
|
|
|
|
|
Yup, you are right in saying I'm trying to update my icon. I don't want to change it completely in the exe, just update it so the user see something different at runtime. I am using MFC, I will give it a shot with the SetIcon and let you know what happens. Thanks so much for your help!
|
|
|
|
|
feel free to message if u have any other questions i know alot :/ lol
- LiquidKnight
|
|
|
|
|
Got it to work with SetIcon! Thanks so much!
|
|
|
|
|
I'm generating a popup menu and dynamically attaching it on the fly: (The STL part is incidental)
void CSTrainDoc::GenerateSearchCriteriaMenu()
{
CMenu* mmenu = ((CMainFrame*)AfxGetMainWnd())->GetMenu();
int pos = ((CMainFrame*)AfxGetMainWnd())->FindMenuItem(mmenu, "Current Search");
if (pos == -1)
return;
CMenu* submenu = mmenu->GetSubMenu(pos);
for (int i = 0; i < mmenu->GetMenuItemCount(); i++)
submenu->DeleteMenu(0, MF_BYPOSITION);
int size = m_menuKeyOptMap.size();
if(size == 0)submenu->AppendMenu(MF_STRING, NULL, "All selected");
MenuKeyOptMap::iterator itDyn = m_menuKeyOptMap.begin();
CMenu* pFlyOutMenu = new CMenu[size];
for (i = 0; itDyn != m_menuKeyOptMap.end(); itDyn++, i++)
{
char * tempDyn;
CString tempCDyn = (*itDyn).first;
tempDyn = new char [tempCDyn.GetLength() + 1];
strcpy(tempDyn, tempCDyn);
MenuOptSet& subMenuSet = m_menuKeyOptMap[tempCDyn];
pFlyOutMenu[i].CreatePopupMenu();
MenuOptSet::iterator itSub = subMenuSet.begin();
for (; itSub != subMenuSet.end(); itSub++)
{
char * tempSub;
CString tempCSub = *itSub;
tempSub = new char [tempCSub.GetLength() + 1];
strcpy(tempSub, tempCSub);
pFlyOutMenu[i].AppendMenu(MF_STRING, 0, tempSub);
delete tempSub;
}
submenu->AppendMenu(MF_POPUP,(int)(pFlyOutMenu[i].m_hMenu),tempDyn);
}
}
I call this function in my OnItemchangedList1(). If I include the delete[] above, it freezes. WIthout the delete, the first time I click my list 1, the menu comes up fine. Then if click on the listbox again, the menu now has a cyclic repeat.. (the item stored in tempdyn ). Theres no pattern. Each time I click on list1, depending on which item I clicked, another bunch of tempdyns gets added to the menu...it keeps growing and growing . Its not purely cyclic because its not A-Z-A-Z...its like H-Z-A-Z..........
Why does the app freeze if I delete[]? I stepped into it and the code assures mne that its only appending the correct tempdyns as I step along, yet when the UI comes up its got a ton of repeats. They dont start at the top and repeat ,,,.but strat repeating somewhere midway down the list, changing where the repeat starts when a different item is clicked .......
Appreciate your help,
ns
|
|
|
|
|
WHta I do when I click on the item is change the stuff in submenuset, but not the number of flyout items (which are the tempdyns...). But instead of theoriginal 31, I get 54 on the second click at some item etc...
Appreciate your help,
ns
|
|
|
|
|
GetMenuITemCount assures me I only have 31 items....every time I step through.......but ui shows many more....adding each time I click...
Appreciate your help,
ns
|
|
|
|
|
this may not be 100% correct.
You need to call Detach() of pFLyOutMenu before the delete call as when you call append the HMENU handle is then owned by the other menu. The destructor of CMenu calls DestroyMenu() on the HMENU thus you end up with a CMenu which has partially invalid data in it.
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
msdn:<br />
<pre>CMenu mnu;
HMENU hmnu = AfxGetMainWnd()->GetMenu()->GetSafeHmenu();
mnu.Attach( hmnu );
hmnu = mnu.Detach();
</pre><br />
<br />
I have:<br />
<br />
<pre> CMenu* mmenu = ((CMainFrame*)AfxGetMainWnd())->GetMenu();
</pre><br />
<br />
no hmenu...<br />
<br />
Also:<br />
<br />
<pre>
CMenu* pFlyOutMenu = new CMenu[size];
</pre><br />
<br />
which one needs detached? <br />
I did:<br />
<br />
<pre>
pFlyOutMenu->Detach();
delete[] pFlyOutMenu;</pre><br />
<br />
and its not freezing now, but still the same problem.... <br />
<br />
Appreciate your help,<br />
ns
|
|
|
|
|
I want to change the button state of the tool bar window when i will click inside a dialog box(or CFormView).
how can i ?
manoj Kumar Dalei,
IIT Delhi
|
|
|
|
|
You can map the UPDATE_COMMAND_UI handler for the toolbar buttons in your CFormView class. In that function you would call:
pCmdUI->SetCheck(TRUE/FALSE);
See the MSDN help for CCmdUI class
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|