|
klutez123 wrote: while (lc = 'y')
my answer is certainly not related to your question, but are you sure you didn't want to write this instead ?
while (lc <code>==</code> 'y')
|
|
|
|
|
Totally unrealated to your question, but this
char end, lc;
is an example for a very bad comment.
Everyone who knows a little C++ knows the he read a char variable declaration before he even comes to reading the comment.
Write what the role of the variables will be, comment why , not what .
Failure is not an option - it's built right in.
|
|
|
|
|
I would even go as far as saying that the comment is plain wrong. He is not declaring char, he is declaring the variables end and lc.
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
|
|
|
|
|
I'd like to draw pixels in a game, which isn't programmed by me(e.g. Warcraft 3, Halo, etc.(DirectX games)) (like XFire).
The pixels should be on top of the game (after the game has rendered, my pixels should be drawn).
I thought about something like a Hook for drawing (when the game is refreshing screen,
the Hook of my application is bing activated and I can draw my pixels).
Best would be a non-MFC Code (I usualy use normal Win32).
|
|
|
|
|
You can draw pixels on the whole area of your screen, by locking on the display context device
//this example draws sloping straight line
case WM_PAINT:<br />
hdc=CreateDC("DISPLAY",NULL,NULL,NULL); <br />
MoveToEx(hdc,15,15,NULL);<br />
LineTo(hdc,150,150);<br />
DeleteDC(hdc);<br />
break;
You can draw on the window you choose with it's process PID using these functions:
long lp=0;<br />
EnumWindows((WNDENUMPROC)EnumProc,lp);
bool __stdcall EnumProc(HWND hWnd,long)<br />
{<br />
unsigned long* pPid;
unsigned long result;
void *hg;
unsigned long id;<br />
<br />
if(hWnd==NULL)<br />
return false;<br />
<br />
hg = GlobalAlloc(GMEM_SHARE,sizeof(unsigned long));<br />
pPid = (unsigned long *)GlobalLock(hg);<br />
<br />
result = GetWindowThreadProcessId(hWnd,pPid);<br />
<br />
if(result){<br />
if(*pPid==MyPID)
{<br />
WindowYouWantToDrawOn=hWnd;<br />
return false;<br />
}<br />
}<br />
else{<br />
GlobalUnlock(hg);<br />
GlobalFree(hg);<br />
return false;<br />
}<br />
GlobalUnlock(hg);<br />
GlobalFree(hg);<br />
return true;<br />
}<br />
hdc=GetWindowDC(WindowYouWantToDrawOn);
And now you can use your new hdc to draw pixels on the concrete window but I don't know how to synchronize your drawing program with some other program's window and it's refresh method.
-- modified at 5:56 Tuesday 20th February, 2007
|
|
|
|
|
|
hmm, it would work by using a thread, but not realy good.
The line is sometimes disappearing when I'm ingame.
Does somepne have a better idea?
|
|
|
|
|
It's no problem drawing anywhere on the screen but how are you going to time redraws properly
as the game refreshes it's screen?
Great job, team. Head back to base for debriefing and cocktails.
|
|
|
|
|
Does no one have a better idea?
the idea by drawing with GDI isn't working really good!
|
|
|
|
|
How can i change the minimize and maximize boxes icons in window?
|
|
|
|
|
urid wrote: How can i change the minimize and maximize boxes icons in window?
To what?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
Owner draw and overwrite CWnd::OnNcPaint .
But I have no practical experiences with that.
Failure is not an option - it's built right in.
|
|
|
|
|
And also on the codeproject is articles about insert buttons to system menu and change color did you search codeproject
|
|
|
|
|
Sorry I confused some where. so let me post this massage again. Any body kwown please show me how to use List Controlfor in my case that is explained as following:
In my dialog, I created two ListBox1 and ListBox2 with multiline and 1 button Send. So when I push button send the String ar row 1 form ListBox1 will be send to ListBox2, that means the string in row 1 of List control 1 will be disappeared and insert to row 1 of ListBox2, the sequence is run step by step up to there is no string in ListBox1
Thank very much.
|
|
|
|
|
Kiethnt wrote: Sorry I confused some where. so let me post this massage again.
Why don't you modify your previous post?
|
|
|
|
|
try following code.
if( ListBox1.GetCount() > 0 )
{
CString csText;
ListBox1.GetText( 0, csText );
ListBox2.AddString( csText );
ListBox1.DeleteString( 0 );
}
where ListBox1 is the control variable for the listbox 1 and ListBox2 is the control variabale for the listbox 2.
nave
|
|
|
|
|
My program had run already, I really thank for your help Naveen R. However, the problem here is I want the string will be send continuosly when I push Send button once only.
One more question I would like ask you that how to write all string in a Listbox control to file .txt and read string in text file to Listbox control.
Please help me solve this problem.
|
|
|
|
|
CStdioFile File;
File.Open( _T("C:\\listboxdata.dat"), CFile::modeCreate|CFile::modeWrite );
int nCount = m_list.GetCount();
for( int nIdx =0;nIdx< nCount;nIdx++ )
{
CString csText;
m_list.GetText( nIdx, csText );
File.WriteString( csText );
}
File.Close();
Do the reverse for reading...
nave
|
|
|
|
|
Can you show your code how do you use of it
|
|
|
|
|
Any body kwown please show me how to use List Controlfor in my case that is explained as following:
In my dialog, I created two List Control 1 and List Control 2 with multiline and 1 button Send. So when I push button send the String ar row 1 form List control 1 will be send to List control 2, that means the string in row 1 of List control 1 will be disappeared and insert to row 1 of List control 2, the sequence is run step by step up to there is no string in List control 1
Thank very much.
|
|
|
|
|
Same question isnt helpfuls for get answer
|
|
|
|
|
All,
Did any one used the MS script control for developing, executing VBScripts from the VC++ application ?
Provide me details regarding, how to use the script engine to aware of the VBScript code, what are all the things that I need to take care before and after executing the VBScript from my application developed using VC++.
Are there any tutorials which talks about these topics ?
Any suggestions or Links, please let me know in detail.
Thanks in advance,
AKS
|
|
|
|
|
Any inputs from anybody from this forum?
|
|
|
|
|
Hi all,
How can I set the focus to a MessageBox. For example: When a certain key is pressed, I show a messagebox asking the user a question. If the user would answer No the program continues as normal. And when the user presses that same key the messagebox displays, but behind the application.
Makes sense ??
Thanx in advance
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|