|
GetAsyncKeyState(); seems to work perfectly so far!
thanks all of you!!!
Just a quick question:
i can do int data = 0xF; but how do i do the same thing with binary?
//Johannes
|
|
|
|
|
Johpoke wrote: i can do int data = 0xF; but how do i do the same thing with binary?
In short: you can't.
You may write integer values in your source code using decimal, octal or hexadecimal notation.
For decimal notation you have no prefix and use digits from 0 to 9, e.g. 255 .
For octal notation you prefix the number with '0' and use digits from 0 to 7, e.g. 0377 .
For hexadecimal notation you prefix the number with '0x' and use digits from 0 to F, e.g. 0xFF .
Each example represents the same value but with different notations.
Regarding how to read and interpret the hexadecimal notation...
Each digit represents four bits, a nibble, which can hold values between 0 and 15. You simply have to get it into your spinal cord how to represent a nibble using the different notations, e.g. that 1100 in binary equals 0xC in hex which equals 12 in decimal.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Hi,
I am trying to notify the user about events of my application by placing an item in his outlook inbox. Unfortunately, up to now this is just a nice plan.
Is there a direct way to create pseudo-E-Mails in the Inbox? I cannot send a real e-mail, as notifcations have to be instantaneous.
It would be great if you could get me started somehow. I haven't programmed anything that accesses Outlook so far.
Thanks a lot.
Dominik
|
|
|
|
|
I have several Edit boxes in my dialog application..
Can any one tell me how to create tool tips for each of the edit boxes...
Proud To Be an Indian
|
|
|
|
|
|
m_ToolTip.Create(this);
m_ToolTip.AddTool(GetDlgItem(IDC_CC_BODY_LENGTH_MIN),"Min Body Lenght");
m_ToolTip.AddTool(GetDlgItem(IDC_CC_BODY_LENGTH_MAX),"Max Body Lenght");
m_ToolTip.AddTool(GetDlgItem(IDC_CC_BODY_LENGTH_VAR),"Max Var Body Lenght");
m_ToolTip.Activate(TRUE);
I had given like this in my code -
where IDC_CC_BODY_LENGTH_MIN,IDC_CC_BODY_LENGTH_MIN,IDC_CC_BODY_LENGTH_VAR -are edit boxes - But the appln is running into a MEMORY ERROR , Why?
Proud To Be an Indian
|
|
|
|
|
Try to this code
void CDialogDlg::SetToolTip(LPCTSTR Text,HWND hwnd)
{
TOOLINFO ti;
ti.cbSize = sizeof(TOOLINFO);
ti.lpszText = (LPTSTR)Text;
ti.hinst = AfxGetInstanceHandle();
ti.hwnd = hwnd;
ti.uFlags = TTF_SUBCLASS | TTF_IDISHWND;
ti.uId = (UINT) hwnd;
m_tooltip.SendMessage(TTM_ADDTOOL, 0, (LPARAM) &ti);
}
void CDialogDlg::OnBnClickedButton1()
{
m_tooltip.Create(this);
SetToolTip("Test",hwnd);
SetToolTip("Test2",hwnd2);
}
What happens?
|
|
|
|
|
Hi,
Drive from the CEdit class and create a new CEditTool class, which will support the ToolTip.
In Drived class CEditToolTip, have a member of type CToolTipCtrl. Create the Instance of this member in constructor, also u can set the ToolTipText Dynamically. And Finally in the MouseMove event u can call Update to display the tooltip.
Manoj
Never Give up
|
|
|
|
|
In my program i created an public variable
CToolTipCtrl m_tooltip in the *.h file of my prg.
WHen i changed the var declaration to protected the error was cleared
protected:
CToolTipCtrl m_tooltip;
Frndz For information there is an easy way to create tooltips {Bosses plz excuse its for beginners}
Projects->Add to Project->Components & controls ->Gallery->Visual C++ Components->ToolTip Support
Its DONE .. . so simple
Proud To Be an Indian
|
|
|
|
|
I am trying to change position of property sheet but i couldn't ,i tried with SetWindowPos(), it's returning 1 but position is not changing.
If anybody is having idea abt it pls let me know.
Thank You.
Sethuraman.K
|
|
|
|
|
Sethuraman.K wrote: i tried with SetWindowPos(),
Can you show your attempted code?
Prasad
MS MVP - VC++
|
|
|
|
|
//This is my code...
// Mypropertysheet.cpp : implementation file
//
#include "stdafx.h"
#include "freshpdk.h"
#include "Mypropertysheet.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern int presentlyreading;
/////////////////////////////////////////////////////////////////////////////
// CMypropertysheet
IMPLEMENT_DYNAMIC(CMypropertysheet, CPropertySheet)
CMypropertysheet::CMypropertysheet(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
:CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
{
}
CMypropertysheet::CMypropertysheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
:CPropertySheet(pszCaption, pParentWnd, iSelectPage)
{
//AddPage(&fstpg);//Commected By Abhi on 170507
AddPage(&secpg);
}
CMypropertysheet::~CMypropertysheet()
{
}
BEGIN_MESSAGE_MAP(CMypropertysheet, CPropertySheet)
//{{AFX_MSG_MAP(CMypropertysheet)
ON_WM_CLOSE()
ON_WM_CREATE()
ON_WM_KEYDOWN()
ON_WM_KEYUP()
ON_WM_VKEYTOITEM()
ON_COMMAND(IDOK, OnOK)
ON_WM_ENABLE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMypropertysheet message handlers
void CMypropertysheet::OnClose()
{
// TODO: Add your message handler code here and/or call default
if(presentlyreading != 0)
return;
EndDialog(IDOK);
CPropertySheet::OnClose();
}
int CMypropertysheet::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CPropertySheet::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
CWnd *pTemp;
pTemp = GetDlgItem(ID_APPLY_NOW);
if(pTemp != NULL)
pTemp->DestroyWindow();
if(pTemp != NULL)
pTemp->DestroyWindow();
pTemp = GetDlgItem(IDCANCEL);
if(pTemp != NULL)
pTemp->SetWindowText("Close");
return TRUE;
return 0;
}
void CMypropertysheet::OnCancel()
{
// MessageBox("hello");
// CDialog::OnCancel();
}
BOOL CMypropertysheet::OnInitDialog()
{
BOOL bResult = CPropertySheet::OnInitDialog();
CWnd *pTemp;
pTemp = GetDlgItem(ID_APPLY_NOW);
if(pTemp != NULL)
pTemp->DestroyWindow();
/////////// sujith 07-02-07 (delete) ////////////
//pTemp = GetDlgItem(IDOK);
//if(pTemp != NULL)
// pTemp->DestroyWindow();
/////////// sujith 07-02-07 ////////////
pTemp = GetDlgItem(IDCANCEL);
if(pTemp != NULL)
pTemp->SetWindowText("Close");
//////****/Here am changing the position of Propertysheet window
int i= ((CWnd*)this)->SetWindowPos((CWnd*)this ,1038,73,0,0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
//////****
return TRUE;
}
void CMypropertysheet::OnOK()
{
// TODO: Add extra validation here
//CDialog::OnOK();
//MessageBox("Hello");
}
void CMypropertysheet::OnEnable(BOOL bEnable)
{
CPropertySheet::OnEnable(bEnable);
// TODO: Add your message handler code here
}
Sethuraman.K
|
|
|
|
|
I should have mention "relevent code".
Sethuraman.K wrote: int i= ((CWnd*)this)->SetWindowPos((CWnd*)this ,1038,73,0,0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
You are using same window handle as hWndInsertAfter . Refer documentation for correct parameter.
And you are giving 0 and 0 as width and height of window. (Again, refer documentation)
Prasad
MS MVP - VC++
|
|
|
|
|
prasad_som wrote: I should have mention "relevent code".
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
prasad_som wrote: You are using same window handle as hWndInsertAfter . Refer documentation for correct parameter.
And you are giving 0 and 0 as width and height of window. (Again, refer documentation)
Having a zero width and height is fine - that is what the SWP_NOSIZE flag allows for (they are ignored), and since he also specified the SWP_NOZORDER flag, the first HWND parameter is ignored as well (I would say to "refer to the documentation", but that would be just plain scarstatic my telling that to an MVP...). His problem is with one of the other flags he sets, can you guess which one...?
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Yup, by seeing first two flags, I overlooked last parameter. My bad.
James R. Twine wrote: His problem is with one of the other flags he sets, can you guess which one...?
You have already answered that.
James R. Twine wrote: Please rate this message - let me know if I helped or not!
Definitely , this time.
Prasad
MS MVP - VC++
|
|
|
|
|
Sethuraman.K wrote: int i= ((CWnd*)this)->SetWindowPos((CWnd*)this ,1038,73,0,0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
You are specifying the SWP_NOMOVE flag, which tells the function not to move the window, which is exactly what you are trying to do! You might want to add the SWP_NOZORDER flag and change the first parameter to NULL as well (sorry - did not see you already had that flag set).
Peace!
-- modified at 8:10 Friday 18th May, 2007
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Hi,
is anybody having idea?
thanks
rakesh
|
|
|
|
|
brakeshbaldhab wrote: what it return? UTC or something else?
It's a user input control. It returns whatever the user set the value to.
led mike
|
|
|
|
|
goodmorning i am trying to type a fuction that it return me how many times a str exist in a line .Christian told me to work with CString Find but i have some problems here :/
Problem is, i think ,my while loop is wrong and my program becomes (Not Responding)
int CInfoRecoverDlg::Compare( CString line , CString str2)
{
int nCount = 0;
for (int i = 0 ; i < line.GetLength() ; i++)
{
while ( line.Find(str2,i+1)!= -1 )
{
nCount = nCount +1;
}
}
return nCount ;
}
void CInfoRecoverDlg::OnButton1()
{
CString str = "yes";
CString line = "yes i said yes , yes ";
int nCount;
nCount = Compare( line , str);
AfxMessageBox(""+nCount);
}
|
|
|
|
|
Have you tried to debug the code ?
Immunity18 wrote: while ( line.Find(str2,i+1)!= -1 )
I guess, you could modify this to,
while ( line.Find(str2,i)!= -1 )
Again, I'm not sure about aim of the function.
Prasad
MS MVP - VC++
|
|
|
|
|
Try to this code
int CMyDialog::Compare( CString line , CString str2)
{
int nCount = 0;
int index=0;
for (int i = 0 ; i < line.GetLength() ; i++)
{
index=line.Find(str2,index);
if( index!= -1 )
{
nCount++;
index++;
}
else
return nCount;
}
return nCount ;
}
|
|
|
|
|
Hi all,
I design a form with about 50 combo boxes and I want to handle the notification message CBN_SELCHANGE of those combo boxes in a same routine, so I use the macro ON_NOTIFY_RANGE(CBN_SELCHANGE, IDC_COMBO1, IDC_COMBO50, MyMsgHandler).
But it seems that nothing happens. Am I wrong?
Pls help me to solve this.
Thanks in advance.
|
|
|
|
|
ON_CONTROL_RANGE try this. I hope it will solve the problem
|
|
|
|
|
What happens if you use ON_NOTIFY for only one of the controls?
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|