|
Rather than implement a push design, why not go for a pull design? You could create a scheduled task on each of the computers that periodically started a .BAT file that contained the appropriate net time command.
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
Hi guys,
I have stumped through something that I think should be easy to do, but yet to make it work. Basically, I have a plan edit control (CEdit) which I want to make it un-editable, no text, space etc can be put it. The content will only be changeable by the app internally, using SetWindowText().
I can't make it Read-Only as it will grey out the content area, I still want the text inside the edit control selectable. Disabling the control greys out the whole box too. I had a thought to override OnKeyDown and OnKeyUp messages for this particular control but maybe I had them written wrong.
in the class declaration, .h file,
afx_msg void OnKeyDownEdit1();
in the .cpp file
BEGIN_MESSAGE_MAP(MyMainDlg, CDialog)<br />
ON_WM_KEYDOWN(IDC_EDIT1, OnKeyDownEdit1)<br />
END_MESSAGE_MAP()
void MyMainDlg::OnKeyDownEdit1<br />
{<br />
}
It'd be great if someone could point me out where I did wrong here. Or if completely wrong, what shoudl I do instead.
Thanks alot
|
|
|
|
|
you need to derive your own edit class from CEdit , and in which you handle the keystrokes.
or if it's always a read-only control, maybe a CStatic derived class can be used.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
CEdit includes a SetReadOnly( )[^] function.
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
J.B. wrote:
I have stumped through something that I think should be easy to do, but yet to make it work. Basically, I have a plan edit control (CEdit) which I want to make it un-editable, no text, space etc can be put it. The content will only be changeable by the app internally, using SetWindowText().
Then why not just use a static control? It satisfies all of your requirements.
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
Mr.Crow if you dont me mind saying that you shuold give a proper ans or nothing at all. Do you know that you cant have scrolling effect with the static control, Or horizontal scrolling with the static control. What if he just wants to display some long text that can only be viewed and not edited?? Did you consider this? or were you giving with some unwanted suggestion?
Any ways the solution to the problem is checking the Read-only in Styles of the edit box.
"When death smiles at you, only thing you can do is smile back at it" - Russel Crowe (Gladiator)
|
|
|
|
|
Goodness gracious, someone woke up on the wrong side of the bed this morning! Are you always so tactfulless on Thursdays?
Did you know that using the ES_READONLY style also has the side effect of graying the edit control? I suppose that's just as incorrect as my answer. Yes?
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
Now, now, chaps. Let's have some decorum in here. Anyone would think you were all Java developers*
One possible solution is to use ES_READONLY, but handle the WM_CTLCOLORSTATIC message in the dialog, (or the reflection of it, in the control). The edit control sends this message, rather than WM_CTLCOLOREDIT, if it is either disabled, or read-only.
You could then return an appropriate HBRUSH value to change the grey/gray background accordingly.
Steve S
*Please, no flames about Java. I've just been told who my new line manager is, and he's an anti-MS pro-Java pro-linux man. Given that I work mainly in C++ using ATL on COM+ components, life is about to get more interesting, unless I find an alternative form of employment
|
|
|
|
|
ok what ever you think.
"When death smiles at you, only thing you can do is smile back at it" - Russel Crowe (Gladiator)
|
|
|
|
|
I think you'll find it much easier to make the control read-only and handle the drawing of the edit control to make it look like it's a non-read-only control. Handle WM_CTLCOLORSTATIC and do something like this:
LRESULT CMyDlg::OnCtlColorStatic
(WPARAM wParam, LPARAM lParam)
{
HDC hDC = (HDC)wParam;
HWND hwndCtl = (HWND) lParam;
UINT uCtrlId = ::GetDlgCtrlID (hwndCtl);
if (uCtrlId == IDC_MY_EDIT) {
CDC *pDC = CDC::FromHandle (hDC);
pDC->SetBkColor (RGB (255, 255, 255));
return (LRESULT) (HBRUSH) m_brushBkg.GetSafeHandle();
}
return Default();
} Of course, you should use GetSysColor() instead of the hardcoded constant RGB (255,255,255). You'll also need to create/destroy the background CBrush within your dialog.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Thanks Ravi, and the other guys who have posted to help,
really appreciate it.
Ravi's suggested method seems to work for my needs for now. In addition to the original codes, I also have to re-initialise the brush. Without doing that, the area that is outside the text rectangle area (depends on the font size that is set) will be all in black.
LRESULT MyDlg::OnCtlColorStatic(WPARAM wParam, LPARAM lParam)
{
HDC hDC = (HDC)wParam;
HWND hwndCtl = (HWND) lParam;
UINT uCtrlId = ::GetDlgCtrlID (hwndCtl);
m_brushBkg.DeleteObject();
m_brushBkg.CreateSolidBrush(RGB (255, 255, 255));
if (uCtrlId == IDC_LABEL_DISPLAY) {
CDC *pDC = CDC::FromHandle (hDC);
pDC->SetBkColor (RGB (255, 255, 255));
return (LRESULT) (HBRUSH) m_brushBkg.GetSafeHandle();
}
return Default();
}
|
|
|
|
|
I think you're better off creating/deleting m_brushBkg just once (outside the handler). That would be more efficient.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Thank you Ravi,
for this further suggestion.
Cheers
|
|
|
|
|
Hello
I want to create a small and simple AVI animation to be used by the CAnimateCtrl in a dialog. I have created the series of bitmaps that I want to use, but I can't find a small and simple tool (preferrably free since this is a one time problem) that does the job.
Since the dawn of DivX the web is bloated with information on AVIs that is useless for this simple job, and all the old postings I have found is from the mid-90's and I can't find the tools.
I have tried the CAVI32 program, but it changes the pink background to white, which makes all my whites transparent (with the effect ov having gray papers floating through the air).
Does anybody have a suggestion?
|
|
|
|
|
If you're using XP there's the included "Windows Movie Maker" which seems to let me put BMPs into the video timeline. Tried that?
|
|
|
|
|
The standard interfaces for soundcards (waveIO, DirectSound) only offer limited functionality (e.g. enumerating capabilities - sampling frequencies only enumerated up to 44k, or enabling the digital loopback that most cards offer)
Are there any other general/quasi-standard API's, or stuff for individual soundcards? Am I missing any?
Peter
Flirt harder, I'm a Coder
mlog || Agile Programming | doxygen
|
|
|
|
|
Well if you want to further down then i guess Createfile, writefile, and apis related to that is ur answer, For this i believe you need to know the specification of the Sound card that you intend to program.
Regards. "When death smiles at you, only thing you can do is smile back at it" - Russel Crowe (Gladiator)
|
|
|
|
|
Hi.
I'm having some troble overriding the HyperLink function in CHtmlEditCtrl.
In what format am I supposed to have my URL that I send into the Hyperlink function?
I've tried with http://www.bla.com
and some variations but it won't accept them, and I don't want to use the auto dialog for adding a link, I wan't to make my own. But then I have to know how to format the LPCTSTR correct.
Anyone who can help me?
Thanks in advance...
/Markus
|
|
|
|
|
I have developing over microsoft platform from the past 3 years. I am quiet a bit stucked in a task, which I would like to discusss with you.
Problem:
1)Read any .exe created on the microsoft platform using File IO operation
2)Store in in a buffer
3)Execute it from the bufffer
4) We donot have the option of writing this buffer to a file and then
execute it. The requirement is to run the executable in the buffer. i.e we cannot use shell commands like ShellExecute, Execv etc.
How do we go about it...? ) It appears to me that asking this question is like runnign a program
for which you may not have the valid permissions or for which you dont
want to leave any trace in the system logs about the file creation. but .. thats just my guess
Hope to see reply soon from forum people
Sincerest Regard's
Imran A. Baset
Imran A. Baset
|
|
|
|
|
Imran Abdul Baset wrote:
How do we go about it...?
You can't.
If the data already exists as a file, why bother reading it into a buffer? It's an EXE, so run it!
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
You can't. The EXE that starts a process must be on disk, because the OS loader uses the memory-mapped file APIs to get the contents of the EXE into memory.
And besides, if you could do what you're suggesting, how would the code in the buffer execute? Each EXE has its own process space.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
If my rhyme was a drug, I'd sell it by the gram.
|
|
|
|
|
I dont think any proper design of any software wants to do what you are looking for... Except you want to do what the operating system wants to do i.e first step towards writing a virus.
"When death smiles at you, only thing you can do is smile back at it" - Russel Crowe (Gladiator)
|
|
|
|
|
Didn't try it myself (and honestly don't see a need for that, creating temp file should work), but here is an idea.
You probably will need to use native api and repeat the steps the OS doing.
Look at ZwCreateSection (create pagefile backed section, map it, write you data there), ZwCreateProcess or NtCreateProcess, NtCreateThread... + some initialization.
The main problem here is the lack of documentation.
How the CreateProcess works:
http://www.microsoft.com/mspress/books/sampchap/4354a.asp
Or you can try to call CreateProcess and by hooking ZwCreateSection and ZwMapViewOfSection trick it into initializaing and executing executing the code in you buffer
Edward
|
|
|
|
|
I do as following:
Why not work?
>code>
HBRUSH cWaitDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// Create a hollow brush used in making static controls transparent
//Transparent static:
if( CTLCOLOR_STATIC == nCtlColor )
{
hbr = (HBRUSH)GetStockObject( HOLLOW_BRUSH );
pDC->SetBkMode( TRANSPARENT );
}
else //PROGRESS --???????? is not
if(pWnd->GetDlgCtrlID() == IDC_PROGRESS_BISY)
{
hbr = (HBRUSH)GetStockObject( HOLLOW_BRUSH );
pDC->SetBkMode( TRANSPARENT );
}
else
{
hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
}
return hbr;
}
thanks
|
|
|
|
|
What part of the progress bad do you want to make it transparent, its quite transparent already rite ?
"When death smiles at you, only thing you can do is smile back at it" - Russel Crowe (Gladiator)
|
|
|
|