|
If you want to set the cursor after the last character then use CRichEditCtrl::SetSel(-1,-1);
If you want to set the cursor just before the last character in the control then use the following code;
CHARRANGE cr;<br />
m_wndRE.SetSel(-1,-1);<br />
m_wndRE.GetSel(cr);<br />
cr.cpMax--;<br />
cr.cpMin--;<br />
m_wndRE.SetSel(cr);
where m_wndRE is the control variable for the rich edit control.
Hope this helps.
Adam.
My world tour
What I do now..
"I spent a lot of my money on booze, birds and fast cars. The rest I just squandered"
George Best.
"I suppose if it was a choice between bon jovi and the interior of a car, the car would win, even it didnt have a radio and I had to sit in silence" James Simpson on Light Metal.
|
|
|
|
|
Hi
Is there is any method to run a process without puting it in the process list (Ctrl+ Alt+ Del)
That mean I need to run a precess and I don't want the user to know about it!
Please Help
Thanks very much
|
|
|
|
|
bfadi wrote:
Is there is any method to run a process without puting it in the process list
No, not that I've ever come across. I can't think of a reason for doing this anyway.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Actually, I've seen an application (Invisible KeyLogger) which doesn't seem to show up on the task list. I've always wondered how it did it. There ought to be a way to modify the windows task list. Maybe not in the Win32 API's, maybe through direct access to the list memory.
"It was when I found out I could make mistakes that I knew I was on to something."
-Ornette Coleman
|
|
|
|
|
The only way I can think of getting around it is actually to use a device driver. For a keylogger, it would simply install a new keyboard driver that would transparently pass all the information to the previous driver, after logging it.
Again, why is it necessary to remove your process from the task list? Why do you not want the user to know it's running?
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hi,
I was just looking around, and I found this http://www.codeproject.com/useritems/PreventClose.asp[^]
I'd like to warn you, it's not the best written article i've read on CP
"It was when I found out I could make mistakes that I knew I was on to something."
-Ornette Coleman
|
|
|
|
|
Thats nice. I'm still wanting to know why he wants the app to not appear in task manager. I can't see any reason to do this, other than if it's a malicious app, which is why I'm not going to help yet.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I am creating an application in VC++ which can communicate with Internet Explorer.For eg:- I want my application to know which site is being accessed from Internet Explorer and control Internet Explorer through my application.I want to Know which MFC class to use for this purpose. I would be very thankful to any person who could help me in this matter.
|
|
|
|
|
One solution is COM via IWebBrowser2 ActiveX control.
Kuphryn
|
|
|
|
|
I found this project in the code project archives but I'm getting the error messages at the bottom. I was hoping someone might give me a hand getting this going. Am I missing a header or something? Thanks, Dave
<br />
<br />
<br />
<br />
#ifndef _MT <br />
#define _MT <br />
#endif <br />
<br />
#include "stdio.h" <br />
#include "windows.h" <br />
#include "process.h" <br />
#include "resource.h" <br />
<br />
bool bDone = false; <br />
<br />
void InputThreadProc( void *dummy ) <br />
{ <br />
HWNDhWnd = ::CreateDialog(NULL,<br />
MAKEINTRESOURCE(IDD_DIALOG),NULL,NULL); <br />
if ( hWnd!=NULL ) <br />
{ <br />
::ShowWindow(hWnd,SW_SHOW); <br />
} <br />
else <br />
{ <br />
printf("Failed to create dialog\n"); <br />
bDone = true; <br />
return; <br />
} <br />
MSG msg; <br />
while(1) <br />
{ <br />
if ( ::PeekMessage(&msg, hWnd, 0, 0, PM_REMOVE) ) <br />
{ <br />
if ( msg.message==WM_KEYUP ) <br />
{ <br />
int nVirtKey = (int) msg.wParam; <br />
if ( nVirtKey==VK_ESCAPE ) <br />
{ <br />
HWND hEdit = ::GetDlgItem(hWnd,IDC_EDIT); <br />
if ( hEdit ) <br />
{ <br />
char pText[3201]; <br />
int nSize = ::GetWindowText( hEdit, <br />
pText, 3200 ); <br />
pText[nSize] = 0; <br />
printf("\nYou have entered the "); <br />
printf("following text in a second ");<br />
printf("thread:\n\n%s\n\n",pText);<br />
} <br />
else <br />
{ <br />
printf("Failed to get edit control\n"); <br />
} <br />
::DestroyWindow(hWnd); <br />
bDone = true; <br />
break; <br />
} <br />
} <br />
::TranslateMessage(&msg); <br />
::DispatchMessage(&msg); <br />
} <br />
else <br />
{ <br />
::Sleep(100); <br />
} <br />
} <br />
} <br />
<br />
void main( int argc, char** argv ) <br />
{ <br />
printf("Hello, world of console apps\n"); <br />
if( _beginthread(InputThreadProc, 0, NULL )==-1) <br />
{ <br />
printf("Failed to create thread"); <br />
return; <br />
} <br />
while ( !bDone ) <br />
{ <br />
::Sleep(3000); <br />
printf("main thread running\n"); <br />
} <br />
} <br />
<br />
<br />
---------------------------------------------------------<br />
--------------------Configuration: console_window - Win32 Debug--------------------<br />
Compiling...<br />
console_window.cpp<br />
C:\Program Files\Microsoft Visual Studio\MyProjects\console_window\console_window.cpp(20) : error C2065: 'HWNDhWnd' : undeclared identifier<br />
C:\Program Files\Microsoft Visual Studio\MyProjects\console_window\console_window.cpp(21) : error C2065: 'IDD_DIALOG' : undeclared identifier<br />
C:\Program Files\Microsoft Visual Studio\MyProjects\console_window\console_window.cpp(21) : error C2440: '=' : cannot convert from 'struct HWND__ *' to 'int'<br />
This conversion requires a reinterpret_cast, a C-style cast or function-style cast<br />
C:\Program Files\Microsoft Visual Studio\MyProjects\console_window\console_window.cpp(22) : error C2065: 'hWnd' : undeclared identifier<br />
C:\Program Files\Microsoft Visual Studio\MyProjects\console_window\console_window.cpp(47) : error C2065: 'IDC_EDIT' : undeclared identifier<br />
Error executing cl.exe.<br />
<br />
console_window.exe - 5 error(s), 0 warning(s)<br />
<br />
"The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson
|
|
|
|
|
In line 20, change HWNDhWnd to HWND hWnd .
IDD_DIALOG and IDC_EDIT should be defined in resource.h. You have created a dialog resource with those IDs have you not?
ps. why do people rate a question a 1? If the question is so dumb, and the answer so obvious, then answer the question or else totally ignore it and move on.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
I actually answered this a few minutes after he posted it, but my reply got posted on the last page of the forum. Wierd...
PJ Arends wrote:
why do people rate a question a 1? If the question is so dumb, and the answer so obvious, then answer the question or else totally ignore it and move on.
I did both - rated it a 1 and posted a reply, which unfortunately got lost
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Ryan Binns wrote:
I did both - rated it a 1 and posted a reply, which unfortunately got lost
It's probably Karma dude...
My world tour
What I do now..
"I spent a lot of my money on booze, birds and fast cars. The rest I just squandered"
George Best.
"I suppose if it was a choice between bon jovi and the interior of a car, the car would win, even it didnt have a radio and I had to sit in silence" James Simpson on Light Metal.
|
|
|
|
|
adamUK wrote:
It's probably Karma dude...
Probably. I must have been punished for voting it a 1, even though I voted after I replied...
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Wow... pre-Karma or deja-karma.. now that's spooky.
My world tour
What I do now..
"I spent a lot of my money on booze, birds and fast cars. The rest I just squandered"
George Best.
"I suppose if it was a choice between bon jovi and the interior of a car, the car would win, even it didnt have a radio and I had to sit in silence" James Simpson on Light Metal.
|
|
|
|
|
I did what you said PJ and it eliminated 3 of the errors, now I only have 2 errors left...see below. I'm not sure what a dialog is. I thought specifying the header was enough, no?
Thanks, Dave
<br />
--------------------Configuration: console_window - Win32 Debug--------------------<br />
Compiling...<br />
console_window.cpp<br />
C:\Program Files\Microsoft Visual Studio\MyProjects\console_window\console_window.cpp(21) : error C2065: 'IDD_DIALOG' : undeclared identifier<br />
C:\Program Files\Microsoft Visual Studio\MyProjects\console_window\console_window.cpp(47) : error C2065: 'IDC_EDIT' : undeclared identifier<br />
Error executing cl.exe.<br />
<br />
console_window.exe - 2 error(s), 0 warning(s)<br />
<br />
"The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson
|
|
|
|
|
DaveE9th wrote:
I'm not sure what a dialog is.
Oh boy
A dialog is a form based window that is used to get input from a user. The colour picker, font picker, and file open/save dialogs that you encounter frequently are examples of dialogs.
Check out these articles for a good beginners intro to using dialogs
http://www.codeproject.com/dialog/dialogapptute.asp[^]
http://www.codeproject.com/dialog/dialogapptute2.asp[^]
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
PJ Arends wrote:
You have created a dialog resource with those IDs have you not?
I'm not sure what you mean by "dialog resource." I know what a dialog box is, I should have been more specific.
I found this project in the archives. It builds a window in a CONSOLE program. You referred me to the MFC tutorials, that's a different ball game. I'm just trying to study the differences between the type of programs. I still can't get the above program going. It wants something in the header file. Anyone?
Thanks much, Dave
"The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson
|
|
|
|
|
VC++ needs the dialog resource file which it should have got from resource.h.
If you used the wizard to create a simple application and then pasted the code, then it may have created the resource.h for you, but it is empty, and you should create a dialog with the id that is missing...
Sorry that I can't be more specific, but it is ages since I last used resources.
"After all it's just text at the end of the day. - Colin Davies
"For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus
|
|
|
|
|
I found this project in the codeproject archives but I'm getting the error messages at the bottom. I was hoping someone might give me a hand getting this going. Am I missing a header or something? Thanks, Dave
[code]
/********************** test.cpp **************************/
// define _MT so that _beginthread( ) is available
#ifndef _MT
#define _MT
#endif
#include "stdio.h"
#include "windows.h"
#include "process.h"
#include "resource.h"
// global flag
bool bDone = false;
// this function is called by a new thread
void InputThreadProc( void *dummy )
{
// create the dialog window
HWNDhWnd = ::CreateDialog(NULL,
MAKEINTRESOURCE(IDD_DIALOG),NULL,NULL);
if ( hWnd!=NULL )
{
// show dialog
::ShowWindow(hWnd,SW_SHOW);
}
else
{
printf("Failed to create dialog\n");
bDone = true;
return;
}
// message loop to process user input
MSG msg;
while(1)
{
if ( ::PeekMessage(&msg, hWnd, 0, 0, PM_REMOVE) )
{
if ( msg.message==WM_KEYUP )
{
int nVirtKey = (int) msg.wParam;
// if the user pressed the ESCAPE key, then
// print the text the user entered and quit
if ( nVirtKey==VK_ESCAPE )
{
// get the edit control
HWND hEdit = ::GetDlgItem(hWnd,IDC_EDIT);
if ( hEdit )
{
// get the input text the user entered
// and print it to the console window
char pText[3201];
int nSize = ::GetWindowText( hEdit,
pText, 3200 );
pText[nSize] = 0;
printf("\nYou have entered the ");
printf("following text in a second ");
printf("thread:\n\n%s\n\n",pText);
}
else
{
printf("Failed to get edit control\n");
}
// destroy the dialog and get out of
// the message loop
::DestroyWindow(hWnd);
bDone = true;
break;
}
}
// process message
::TranslateMessage(&msg);
::DispatchMessage(&msg);
}
else
{
// if there is no message to process,
// then sleep for a while to avoid burning
// too much CPU cycles
::Sleep(100);
}
}
}
void main( int argc, char** argv )
{
printf("Hello, world of console apps\n");
// create a new thread to allow user input
if( _beginthread(InputThreadProc, 0, NULL )==-1)
{
printf("Failed to create thread");
return;
}
// wait for the new thread to finish
while ( !bDone )
{
// sleep 3 seonds
::Sleep(3000);
printf("main thread running\n");
}
}
/************************** end ************************/
---------------------------------------------------------
--------------------Configuration: console_window - Win32 Debug--------------------
Compiling...
console_window.cpp
C:\Program Files\Microsoft Visual Studio\MyProjects\console_window\console_window.cpp(20) : error C2065: 'HWNDhWnd' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\MyProjects\console_window\console_window.cpp(21) : error C2065: 'IDD_DIALOG' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\MyProjects\console_window\console_window.cpp(21) : error C2440: '=' : cannot convert from 'struct HWND__ *' to 'int'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
C:\Program Files\Microsoft Visual Studio\MyProjects\console_window\console_window.cpp(22) : error C2065: 'hWnd' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\MyProjects\console_window\console_window.cpp(47) : error C2065: 'IDC_EDIT' : undeclared identifier
Error executing cl.exe.
console_window.exe - 5 error(s), 0 warning(s)
[/code]
|
|
|
|
|
I an use the function Drawtextw output some words,
Is this function in the windows98 support?
if it not support, Should I how do?
|
|
|
|
|
I'd suggest you start with msdn.microsoft.com. The full answer to your question is easily found there.
Christian
NO MATTER HOW MUCH BIG IS THE WORD SIZE ,THE DATA MUCT BE TRANSPORTED INTO THE CPU. - Vinod Sharma
Anonymous wrote:
OK. I read a c++ book. Or...a bit of it anyway. I'm sick of that evil looking console window.
I think you are a good candidate for Visual Basic. - Nemanja Trifunovic
|
|
|
|
|
Yes, using the Microsoft Layer for Unicode. See MSDN for more information on using this.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
but I want to display unicode character in windows 98, what should I do?
|
|
|
|
|
Alice80 wrote:
what should I do
Search for "Microsoft Layer for Unicode" on MSDN.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|