|
You can associate a HWND with a CWnd object using CWnd::Attach() BUT...
IsKindOf() works with object types so I don't think this will work for you.
You could use GetClassInfoEx() and examine the WNDCLASSEX lpszClassName member to find the
window's type.
Mark
|
|
|
|
|
That will not work correctly, at least not the way you would want it to.
You can pass the HWND to the ::GetClassName(...) function. Look up that function for more info on how to use it.
If the control is a standard Edit control, the returned class name will be EDIT . Lookup the predefined window classes for more info.
You could also check by sending the window a edit-control-specific message and see if the response you get back makes sense.
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
|
|
|
|
|
::GetClassName()!! I knew it existed but I swear I couldn't find it.
If only Microsoft used a more appropriate name for the API
|
|
|
|
|
Look up CWnd::Attach , CWnd::FromHandle and CWnd::FromHandlePermanent . Which you use depends on your situation.
Steve
|
|
|
|
|
You can use of CWnd::FromHandle
and From the MSDN:
"If a CWnd object is not attached to the handle,a temporary CWnd object is created and attached"
|
|
|
|
|
Max++ wrote: then I want to use IsKindof() function that is member of CWnd for check it is CEdit object or not
CWnd::FromHandle is one option.
Max++ wrote: function that is member of CWnd for check it is CEdit object or not.
You can achieve this without using above approach. Have a look at this code ,
static const TCHAR szEdit[] = _T("Edit");
TCHAR szCompare[256] = {0};
::GetClassName(hEdit, szCompare,256);
if (lstrcmpi(szCompare, szEdit) == 0)
{
}
|
|
|
|
|
Hi
Does anyone know how to get this behaviour to appear within a CDialog (with an editbox set with password property)?
I'm using VS2003.
|
|
|
|
|
Normally, you will get this functionality automatically [1] when running on XP (or above?) and [2] your application has a common control manifest that specifies that the new/XP common control libraries be used.
Or are you asking how you can create that behavior so that your application always does something like it, regardless of platform or manifest?
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
|
|
|
|
|
Yes, running on XP, not too concerned about other platforms.
Here is my manifest - am I not specifying the correct libraries?
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="X86"
name="Microsoft.Windows.TestApp"
type="win32"
/>
<description>Your app description here</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>
|
|
|
|
|
That looks correct to me - do you have it in the correct location? If not embedded, it should be in an external file named the same as your executable file with .manifest appended to it.
For example, if your executable is called MyApp.exe , the manifest file should be MyApp.exe.manifest , and kept in the same directory that the executable is in.
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
|
|
|
|
|
James
Many thanks for your help. I've finally sorted it! I've added an external manifest (ensuring the language is set to English(US) in the resource properties, and as if by magic, the XP Themes are applied.
Graham
|
|
|
|
|
Hi everyone
Ive recently been tasked to add a bitmap to a listctrl, which ive done sucessfully, with a little help from Matt Weagle's excellent article (http://www.codeproject.com/listctrl/listctrldemo.asp[]
However, when text is placed over it, the text background color is white (which obviously obcures the image).
This was fine - even the demo app does this, but having passed this code to my collegue, his bitmap doesnt get obscured. We are using the same code, environment, both using Visual Studio 2003. Checked everything I can think of (project settings, resource & stdafx files etc.).
Can anyone help please?
|
|
|
|
|
What is the code you're using to place text over the bitmap?
Mark
|
|
|
|
|
Hi Mark
>Mark Salsbery wrote:
>What is the code you're using to place text over the bitmap?
Its a standard SDI app:
void MyRightView::OnInitialUpdate()
{
CListView::OnInitialUpdate();
CListCtrl& ctlList = (CListCtrl&) GetListCtrl();
ModifyStyle ( LVS_TYPEMASK,LVS_REPORT);
ListView_SetExtendedListViewStyle (m_hWnd, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_HEADERDRAGDROP);
ctlList.InsertColumn(1,"A",NULL,50,NULL);
ctlList.InsertColumn(2,"B",NULL,100,NULL);
ctlList.InsertColumn(3,"C",NULL,100,NULL);
ctlList.InsertColumn(4,"D",NULL,50,NULL);
ctlList.InsertColumn(5,"E",NULL,80,NULL);
ctlList.InsertColumn(6,"F",NULL,50,NULL);
ctlList.DeleteAllItems();
for (int f=0; f<20;f++)
DisplayLine(f);
EnableBkImage(TRUE);
}
void MyRightView::DisplayLine(int line)
{
CListCtrl& ctlList = (CListCtrl&) GetListCtrl();
ctlList.InsertItem(line,_T("12345"),0);
ctlList.SetItemText(line,1,_T("Test"));
ctlList.SetItemText(line,2,_T("A"));
ctlList.SetItemText(line,3,_T("1F"));
ctlList.SetItemText(line,4,_T("2006-12-1"));
ctlList.SetItemText(line,5,_T("AM (N)"));
ctlList.SetItemText(line,6,_T("22-12-2006"));
}
void MyRightView::EnableBkImage(BOOL bEnable)
{
CListCtrl& ctlList = (CListCtrl&) GetListCtrl();
if (bEnable)
{
// Load the resource and apply it to the background
TCHAR szBuffer[_MAX_PATH];
VERIFY(::GetModuleFileName(AfxGetInstanceHandle(), szBuffer, _MAX_PATH));
CString sPath;
sPath.Format(_T("res://%s/#2/#139"),szBuffer);
LVBKIMAGE bki;
bki.ulFlags = LVBKIF_STYLE_NORMAL | LVBKIF_SOURCE_URL ; //LVBKIF_STYLE_TILE
bki.pszImage = sPath.GetBuffer(sPath.GetLength());
bki.cchImageMax = sPath.GetLength();
bki.xOffsetPercent= 50;
bki.yOffsetPercent=50;
VERIFY(ctlList.SetBkImage( &bki));
}
else
ctlList.SetBkImage( HBITMAP(0));
}
|
|
|
|
|
Can you show your code(of course not all )
|
|
|
|
|
Hi
Mangaged to fix this - 1 line of code (strangly my collegue doesnt need to use this though )
ctlList.SetTextBkColor(CLR_NONE);
pity MSDN doesnt seem give you a list of these parameters
Thank you for your attention!
|
|
|
|
|
thefainster wrote: Mangaged to fix this
Cool
It's good practice IMO to always setup drawing the way you want it so you don't rely on behavior
between machines.
Glad you got it fixed!
Mark
|
|
|
|
|
Hi All,
is it possible to search & find a specific MAC address of NIC card without knowing the IP address or any other details?
B Regards
Ajith
Ajith
|
|
|
|
|
IP Helper has the GetAdaptersInfo() API to get info on all the adapters on the computer,
including the hardware address and associated IP address(es).
Maybe this helps?
Mark
|
|
|
|
|
hello, I search a source for a client/serveur of mailslot or somebody which are motivated to help me to do one (I can dream no? )
thanks and sorry for the english
|
|
|
|
|
Go Here[^] and search for mailslot .
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
|
|
|
|
|
|
I try to run step by step code below but I can't go in to "CALLBACK EnumChildProc".
What wrong in my code?
void CHideWindowsDlg::OnGethandle()
{
CString strText;
HWND hWndAppearance = NULL;
HWND hWndChild = NULL;
GetDlgItemText(IDC_EDIT,strText);
hWndAppearance = ::FindWindow(NULL,_T(strText));
if(hWndAppearance)
{
EnumChildWindows(hWndAppearance, EnumChildProc,(LPARAM)&hWndChild);
if(hWndChild)
{
.....
.....
}
}
}
BOOL CALLBACK EnumChildProc(HWND hWnd, LPARAM lParam)
{
TCHAR buff[512];
GetWindowText(hWnd,buff,512);
if(_tcscmp(buff,_T("&1234")) == 0)
{
*reinterpret_cast<HWND*>(lParam) = hWnd;
return FALSE;
}
return TRUE;
}
|
|
|
|
|
You cannot easily step-into the callback function, but you should be able to set a breakpoint at the start of it and hit it.
If your callback is not firing at all, there is something wrong with the call to EnumChildWindows(...) - be sure to check its return code and/or ::GetLastError(...) .
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
|
|
|
|
|
Hi friends,
Sorry for such basic question. but I wanted to know where does new operator or malloc operator allocate memory? in actualy physical memory or virtual memory?
Vikram S
|
|
|
|