|
mechalien wrote: plz can someone send me the code for a working chat at TREEMinceMeat@hotmail.com
buddy.. thats not easy task!...
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
MSDN has a sample program, CHATSERVER which has code and shows you how to do it.
Cheers,
- Ed.
--------------------------------
|
|
|
|
|
I would appreciate any information someone might have on how to save the console's output buffer so that I can have another screen temporarily display it's contents and then restore the former contents as though nothing happened. I would prefer any code or class references to be ANSI (Dev c++ compatible) but I will take any kind of suggestions anyone can offer. Thank you greatly!
sincerely, Brett Peirce - PolerBear
To err is human; To forgive: divine.
|
|
|
|
|
When you create the child process (i.e., CreateProcess() ), just redirect its standard output handle. See here and here.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Thanks for the idea.
I am hesitant to go that route for a few reasons, though. I was hoping that it would be possible to accomplish without using windows.h and other such things - hoping for pure console-type code. Aside from that, though, I haven't used handles or child processes or a few other things in that code before, and it's very daunting to look at it and challenging to understand it.
Would you have any other ideas or a link to some reading material that might help me understand all that a little better? Also: I noticed the use of printf() in that code. Is it possible to use streams (cout and cin ) or at least getch() and such with that code? I appreciate your time and knowlege.
sincerely, Brett Peirce - PolerBear
To err is human; To forgive: divine.
|
|
|
|
|
I might have been a bit premature in my reply. Looking at both of your posts, I don't have a firm grasp of what it is that you are trying to do. Do you have one console application that needs to start another?
The use of CreateProcess() does not necessarily mean the application has a GUI. You can use it in a console application (to start another console application or a GUI application).
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
    I am not attempting to start another application or window or process, unless that is the only way to accomplish my goal.
    My goal is to basically have a splash screen or menu or notification box or anything, pop up in the middle of an application, getting a response from the user, and then disappearing, leaving the former output intact.
    This is an ideal situation - I know it must be possible, because I have seen it in several DOS applications. I assume that they were written in c++ or that this function can be emulated or reproduced in c++ in some way.
    It is not necessary to the function of the program, but looks a lot nicer than clearing the screen or buffer. Also, I think it must be easier to save and restore the buffer (that is, whatever may be displayed on the console screen at the time) than it would be to figure out whatever may be displayed and restoring it manually.
    I don't want to open another window or start another program, I want to more or less simulate what windows shows with menus or dialog boxes (except extremely simplified) in a single console/DOS window or from the command prompt.
sincerely, Brett Peirce - PolerBear
To err is human; To forgive: divine.
|
|
|
|
|
If what I'm thinking of is what you are after, I'm going way back in my brain to retrieve it. If this "splash screen" is part of the console window, as opposed to a GUI splash screen, you need to read 4,000 bytes from memory address 0xb8000000. That is the starting address of the video display. Something like:
char far *pDisplay = (char far *) 0xb8000000;
char sBuffer[4000];
char far *pTemp = pDisplay;
for (int x = 0; x < sizeof(sBuffer); x += 2)
{
sBuffer[x] = *pTemp++;
sBuffer[x+1] = *pTemp++;
}
for (x = 0; x < sizeof(sBuffer); x += 2)
{
*pTemp++ = sBuffer[x];
*pTemp++ = sBuffer[x+1];
} Am I way off track here?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Sorry I took so long to respond. This looks like basically what I'm after, assuming I can figure it out (and the memory address is correct) - It'll take me a bit to figure it out. Thanks for your help; I hope I get it working - we'll see. I appreciate your time.
sincerely, Brett Peirce - PolerBear
To err is human; To forgive: divine.
|
|
|
|
|
can anyone tell me what I am doing wrong here?
CString SelectedFile (passed into function)
ofstream OutputFileStream;
OutputFileStream.open (fileBrowser.GetFileName(), ios::out);
OutputFileStream<<"FileName;"<
|
|
|
|
|
ldsdbomber wrote: OutputFileStream<<"FileName;"<<selectedfile<<endl;< blockquote="">
Try:
OutputFileStream<<"FileName;"<<(LPCTSTR)SelectedFile<<endl;
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Thanks. I thought that might work, but it just looks wrong. I guess I just couldn't believe that you couldn't throw a CString into a stream without messing about
|
|
|
|
|
Hi
I have below the following piece of code in a vc++6 MFC dialog project. i want to have it that the ip address can be entered into a "edit box" and that ip address can then be pinged.
im guessing that i change the WHERE Address=\"127.0.0.1\"" to WHERE Address='"+Addy+"'" or is that wrong?
how do i declare the variable Addy, as i have tried a few but no sucess
please help
Existing code....
hres = pSvc->ExecQuery( L"WQL", L"SELECT * FROM Win32_PingStatus WHERE Address=\"127.0.0.1\"", WBEM_FLAG_FORWARD_ONLY, NULL, &pEnumerator);
-- modified at 12:01 Thursday 2nd March, 2006
|
|
|
|
|
Are you wanting something like:
CString strIPAddress = L"127.0.0.1";
CString strQuery;
strQuery.Format(L"SELECT * FROM Win32_PingStatus WHERE Address = %s", (LPCTSTR) strIPAddress);
hres = pSvr->ExecQuery(L"WQL", strQuery, ...);
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
thx for the reply
but that turned up two errors...
1) error C2664: 'void __cdecl CString::Format(const char *,...)' : cannot convert parameter 1 from 'unsigned short [50]' to 'const char *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
2) error C2664: 'ExecQuery' : cannot convert parameter 2 from 'class CString' to 'unsigned short *const '
|
|
|
|
|
So try removing the Ls from the string literals. Are you using Unicode or not?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
i honstly couldnt tell you as visual c++ is new to me, im still just getting to hand with these new variable types.
the error i get now is as follows....
error C2664: 'ExecQuery' : cannot convert parameter 1 from 'char [4]' to 'unsigned short *const '
my code is now....
CString strIPAddress = "127.0.0.1";
CString strQuery;
strQuery.Format("SELECT * FROM Win32_PingStatus WHERE Address = %s", (LPCTSTR) strIPAddress);
hres = pSvc->ExecQuery("WQL", strQuery, WBEM_FLAG_FORWARD_ONLY, NULL, &pEnumerator);
many thanks for your help
|
|
|
|
|
Put the L back in front of the "WQL" string - ExecQuery() is expecting a Unicode string, which is what the 'L' specifies.
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"
|
|
|
|
|
In trying that i still get an error
the error is....
error C2664: 'ExecQuery' : cannot convert parameter 2 from 'class CString' to 'unsigned short *const '
my code is......
CString strIPAddress = "127.0.0.1";
CString strQuery;
strQuery.Format("SELECT * FROM Win32_PingStatus WHERE Address = %s", (LPCTSTR) strIPAddress);
hres = pSvc->ExecQuery(L"WQL", strQuery, WBEM_FLAG_FORWARD_ONLY, NULL, &pEnumerator);
|
|
|
|
|
keithlee wrote: strQuery.Format("SELECT * FROM Win32_PingStatus WHERE Address = %s", (LPCTSTR) strIPAddress);
hres = pSvc->ExecQuery(L"WQL", strQuery, WBEM_FLAG_FORWARD_ONLY, NULL, &pEnumerator);
strQuery.Format(_T("SELECT * FROM Win32_PingStatus WHERE Address = %s"), (LPCTSTR) strIPAddress);
hres = pSvc->ExecQuery(_T("WQL"), strQuery, WBEM_FLAG_FORWARD_ONLY, NULL, &pEnumerator);
Does this help?
Nibu thomas
Software Developer
|
|
|
|
|
that shows the followng error
error C2664: 'ExecQuery' : cannot convert parameter 1 from 'char [4]' to 'unsigned short *const '
|
|
|
|
|
Have you done any Unicode programming? You need to convert your string to Unicode. Include the atlconv.h file and do this:
CString strIPAddress = _T("127.0.0.1");
CString strQuery;
strQuery.Format(_T("SELECT * FROM Win32_PingStatus WHERE Address = %s"), (LPCTSTR) strIPAddress);
hres = pSvc->ExecQuery(L"WQL", T2W(strQuery), WBEM_FLAG_FORWARD_ONLY, NULL, &pEnumerator); This will ensure that all the strings are of the correct type and should work nicely.
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
no luck there with the above code, any idea whats wrong?
i get the following errors....
error C2065: '_lpa' : undeclared identifier
error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class CString' (or there is no acceptable conversion)
error C2065: '_convert' : undeclared identifier
|
|
|
|
|
just found the problem, did a look up on MSDN and you need to specify
USES_CONVERSION;
wohoo, finally it works!
|
|
|
|
|